Repository navigation
recognize litellm maximum-context rejections - #2129
Merged
Merged
Conversation
Refs: ENG-6011. Reported in discussion #2088.
kevinjosethomas
marked this pull request as ready for review
September 9, 2026 00:36
snimu
approved these changes
Sep 9, 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.
a2131be2773119e7ee1fe6e8cc764a95242e7803against baseline4ec05a0969825a32261ffed43ab5740071a73ae6in prime sandboxxboin1vp7ctxmzop9sjxksuh(node:24-bookworm, linux x64, node 24.18.0, npm 11.16.0, 2 cpu/4 gb ram/10 gb disk): the compiled, packed, and installed ai package changed the reported classification from false to true, with four controls unchanged; sandbox deleted after collecting logs.npm run checklocally and in the sandbox; identical baseline fixtures failed only the new rejection cases, including recovery, while controls passed; no live litellm/vllm or paid inference calls; code ci passed.Linear: ENG-6011
Note
Medium Risk
Changes shared overflow classification used by agent compaction/retry paths; misclassification could compact on rate limits or skip compaction on overflow, though new negative tests reduce that risk.
Overview
LiteLLM context rejections (when input plus requested completion exceed the model limit) are now treated as context overflow, so the coding agent runs overflow compaction and continues instead of treating the failure as a generic error or retrying the same oversized request.
The
packages/aioverflow classifier adds a pattern for messages like "exceeds the model's maximum context length", with unit tests for case-insensitive matching and guards so rate limits, token quotas, and unrelated LiteLLM errors are not misclassified. A coding-agent regression test confirms compaction and recovery for the real LiteLLM error string (and still retries rate-limit errors without compacting).Contributor workflow: the PR template and Linear ticket CI now accept ENG- tickets (in addition to RES-), with updated guidance for Engineering vs Research boards.
Reviewed by Cursor Bugbot for commit a65ce8e. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix
isContextOverflowto recognize LiteLLM maximum-context rejectionsisContextOverflowwill not detect it; the pattern only matches the documented "maximum context" wording.📊 Macroscope summarized a65ce8e. 2 files reviewed, 2 issues evaluated, 2 issues filtered, 0 comments posted
🗂️ Filtered Issues
.github/workflows/linear-ticket.yml — 0 comments posted, 2 evaluated, 2 filtered
https://notlinear.app/team/issue/ENG-123(or a path containinglinear.app/...) contains the matched substringlinear.app/team/issue/ENG-123, so it passes the gate despite not linking to Linear. Require an appropriate scheme/host boundary beforelinear.appwhen recognizing URL references. [ Out of scope (post-validation triage) ]\d+, so it accepts only the numeric prefix of a malformed reference. For example, a PR body containinghttps://linear.app/team/issue/ENG-123not-a-ticketmakesticket.test(text)succeed even though the purported issue ID has trailing word characters; the gate is therefore bypassed without a valid ticket orNo-Ticketopt-out. Add a trailing word boundary (or an equivalent URL/ID terminator) to this alternative. [ Out of scope (post-validation triage) ]