fix(github-copilot): Lower problem_statement truncation limit#110600
Merged
fix(github-copilot): Lower problem_statement truncation limit#110600
Conversation
… length The existing truncation used Python string length (29,900 chars), but GitHub Copilot's 30,000 character limit is on the JSON-serialized value. Characters like \n, \", and \\ expand during JSON encoding, so prompts with heavy escaping (e.g. minified JS stack traces) could exceed the limit even after truncation. Now measures the actual JSON-encoded length and scales the raw string proportionally. Agent transcript: https://claudescope.sentry.dev/share/amHLtSlX7RtQwj_2G1233fd_LCxUpJR7WWMPcbEVQAU
…limit Replace json.dumps-based encoded length measurement with a simple 25,000 character limit. This provides sufficient headroom below the 30,000 char API limit to account for JSON encoding expansion, without the complexity of proportional scaling and iterative trimming. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/eZU4taoDKUIFtUzcHX_iwlQF2EWijOK4cifRNJ9ZOGU
a3b9c1a to
4449b04
Compare
isaacwang-sentry
approved these changes
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Copilot's API rejects
problem_statementvalues exceeding 30,000 characters. The previous truncation at 29,900 raw characters was too close to the limit — JSON encoding expansion (e.g.\n,\",\\) could push the serialized length over 30,000.Lowers the limit to 25,000 characters to leave headroom for encoding expansion.
Fixes SENTRY-5M31