Skip to content

Increase clink response limit#415

Closed
edzme wants to merge 2 commits intoBeehiveInnovations:mainfrom
edzme:increase-clink-response-limit
Closed

Increase clink response limit#415
edzme wants to merge 2 commits intoBeehiveInnovations:mainfrom
edzme:increase-clink-response-limit

Conversation

@edzme
Copy link
Copy Markdown

@edzme edzme commented Mar 10, 2026

PR Title Format

Please ensure your PR title follows Conventional Commits format:

Version Bumping Types (trigger semantic release):

  • feat: <description> - New features → MINOR version bump (1.1.0 → 1.2.0)
  • fix: <description> - Bug fixes → PATCH version bump (1.1.0 → 1.1.1)
  • perf: <description> - Performance improvements → PATCH version bump (1.1.0 → 1.1.1)

Breaking Changes (trigger MAJOR version bump):

For breaking changes, use any commit type above with BREAKING CHANGE: in the commit body or ! after the type:

  • feat!: <description>MAJOR version bump (1.1.0 → 2.0.0)
  • fix!: <description>MAJOR version bump (1.1.0 → 2.0.0)

Non-Versioning Types (no release):

  • build: <description> - Build system changes
  • chore: <description> - Maintenance tasks
  • ci: <description> - CI/CD changes
  • docs: <description> - Documentation only
  • refactor: <description> - Code refactoring (no functional changes)
  • style: <description> - Code style/formatting changes
  • test: <description> - Test additions/changes

Docker Build Triggering:

Docker builds are independent of versioning and trigger based on:

Automatic: When PRs modify relevant files:

  • Python files (*.py), requirements*.txt, pyproject.toml
  • Docker files (Dockerfile, docker-compose.yml, .dockerignore)

Manual: Add the docker-build label to force builds for any PR.

Description

Please provide a clear and concise description of what this PR does.

Changes Made

  • List the specific changes made
  • Include any breaking changes
  • Note any dependencies added/removed

Testing

Please review our Testing Guide before submitting.

Run all linting and tests (required):

# Activate virtual environment first
source venv/bin/activate

# Run comprehensive code quality checks (recommended)
./code_quality_checks.sh

# If you made tool changes, also run simulator tests
python communication_simulator_test.py
  • All linting passes (ruff, black, isort)
  • All unit tests pass
  • For new features: Unit tests added in tests/
  • For tool changes: Simulator tests added in simulator_tests/
  • For bug fixes: Tests added to prevent regression
  • Simulator tests pass (if applicable)
  • Manual testing completed with realistic scenarios

Related Issues

Fixes #(issue number)

Checklist

  • PR title follows the format guidelines above
  • Activated venv and ran code quality checks: source venv/bin/activate && ./code_quality_checks.sh
  • Self-review completed
  • Tests added for ALL changes (see Testing section above)
  • Documentation updated as needed
  • All unit tests passing
  • Relevant simulator tests passing (if tool changes)
  • Ready for review

Additional Notes

Any additional information that reviewers should know.

edzme added 2 commits March 10, 2026 14:35
Raise MAX_RESPONSE_CHARS from 20k to 100k to avoid truncating CLI
output. Remove the hardcoded 4000-char excerpt cap so the fallback
excerpt scales proportionally (half the limit) instead of being
artificially clamped.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4013284ee7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/clink.py
logger = logging.getLogger(__name__)

MAX_RESPONSE_CHARS = 20_000
MAX_RESPONSE_CHARS = 100_000
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep clink output cap below MCP transport budget

Raising MAX_RESPONSE_CHARS to 100_000 makes clink emit payloads that can exceed MCP’s documented transport envelope: docs/advanced-usage.md states the protocol budget is ~25K tokens combined request+response, and 100K characters is already around that size before JSON wrapping/escaping and metadata are added. In practice, any large clink reply in the 20K–100K range can now fail to deliver or be truncated by the client transport even though _apply_output_limit considers it valid, so this change regresses reliability for large responses.

Useful? React with 👍 / 👎.

@edzme edzme closed this Mar 10, 2026
@edzme edzme deleted the increase-clink-response-limit branch March 10, 2026 14:57
@edzme edzme restored the increase-clink-response-limit branch March 10, 2026 14:58
@edzme edzme deleted the increase-clink-response-limit branch March 10, 2026 14:59
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the clink tool's capability to handle and process larger outputs by increasing its maximum response character limit. Concurrently, it refines the excerpt generation logic to ensure that summaries of these larger responses scale appropriately, providing more comprehensive context without premature truncation.

Highlights

  • Increased response character limit: The maximum number of characters allowed for a clink response has been increased from 20,000 to 100,000.
  • Dynamic excerpt scaling: The hardcoded 4,000 character limit for response excerpts has been removed, allowing the excerpt length to dynamically scale with the MAX_RESPONSE_CHARS setting.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • thoughts/commits/10768dc/reasoning.md
    • Added a new file documenting the commit 10768dc for the increase-clink-response-limit branch.
  • tools/clink.py
    • Increased the MAX_RESPONSE_CHARS constant from 20,000 to 100,000.
    • Modified the _apply_output_limit function to remove the fixed 4,000 character limit for excerpt_limit, making it dynamically MAX_RESPONSE_CHARS // 2.
Activity
  • No specific activity (comments, reviews, etc.) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The maximum response characters for clink was increased from 20,000 to 100,000. The excerpt scaling logic was also updated. A review comment suggests adding a margin for the template text when calculating the excerpt limit to ensure the total output size stays within the intended limit, even for smaller MAX_RESPONSE_CHARS values.

Comment thread tools/clink.py
)

excerpt_limit = min(4000, MAX_RESPONSE_CHARS // 2)
excerpt_limit = MAX_RESPONSE_CHARS // 2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While using MAX_RESPONSE_CHARS // 2 is simpler, it can be fragile. If MAX_RESPONSE_CHARS were set to a small value (e.g., under 2000), the overhead from the message template could cause the final truncated message to exceed MAX_RESPONSE_CHARS.

To make this more robust, it's safer to reserve a margin for the template text when calculating the excerpt limit. This ensures the total output size stays within the intended limit, even for smaller MAX_RESPONSE_CHARS values. The magic number 1024 here is a safe margin in bytes for the template text.

Suggested change
excerpt_limit = MAX_RESPONSE_CHARS // 2
excerpt_limit = min(MAX_RESPONSE_CHARS // 2, max(0, MAX_RESPONSE_CHARS - 1024))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant