Increase clink response limit#415
Conversation
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.
There was a problem hiding this comment.
💡 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".
| logger = logging.getLogger(__name__) | ||
|
|
||
| MAX_RESPONSE_CHARS = 20_000 | ||
| MAX_RESPONSE_CHARS = 100_000 |
There was a problem hiding this comment.
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 👍 / 👎.
Summary of ChangesHello, 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 Highlights
🧠 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
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
| ) | ||
|
|
||
| excerpt_limit = min(4000, MAX_RESPONSE_CHARS // 2) | ||
| excerpt_limit = MAX_RESPONSE_CHARS // 2 |
There was a problem hiding this comment.
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.
| excerpt_limit = MAX_RESPONSE_CHARS // 2 | |
| excerpt_limit = min(MAX_RESPONSE_CHARS // 2, max(0, MAX_RESPONSE_CHARS - 1024)) |
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 changeschore: <description>- Maintenance tasksci: <description>- CI/CD changesdocs: <description>- Documentation onlyrefactor: <description>- Code refactoring (no functional changes)style: <description>- Code style/formatting changestest: <description>- Test additions/changesDocker Build Triggering:
Docker builds are independent of versioning and trigger based on:
Automatic: When PRs modify relevant files:
*.py),requirements*.txt,pyproject.tomlDockerfile,docker-compose.yml,.dockerignore)Manual: Add the
docker-buildlabel to force builds for any PR.Description
Please provide a clear and concise description of what this PR does.
Changes Made
Testing
Please review our Testing Guide before submitting.
Run all linting and tests (required):
tests/simulator_tests/Related Issues
Fixes #(issue number)
Checklist
source venv/bin/activate && ./code_quality_checks.shAdditional Notes
Any additional information that reviewers should know.