From the prime-agent analysis (their overflow.ts: 20 provider regexes, a NON_OVERFLOW guard list, and two behavioral detectors).
Proposal for graff's context-overflow classification (#193 arc, recoverContextOverflow):
- Non-overflow guards checked first: e.g. Bedrock's
ThrottlingException: Too many tokens is rate limiting, not context overflow — naive keyword matching misclassifies it and triggers a pointless compaction instead of a retry wait.
- Behavioral detectors:
- silent overflow: HTTP 200 with an empty/failed completion whose usage shows input at/over the context window (seen on z.ai);
- upstream truncation:
finish_reason: length with truncated output when input is near the window (seen on MiMo).
Notes: guards keep the retry/Retry-After path (where graff is already strong) from being shadowed by overflow recovery.
From the prime-agent analysis (their
overflow.ts: 20 provider regexes, a NON_OVERFLOW guard list, and two behavioral detectors).Proposal for graff's context-overflow classification (#193 arc, recoverContextOverflow):
ThrottlingException: Too many tokensis rate limiting, not context overflow — naive keyword matching misclassifies it and triggers a pointless compaction instead of a retry wait.finish_reason: lengthwith truncated output when input is near the window (seen on MiMo).Notes: guards keep the retry/Retry-After path (where graff is already strong) from being shadowed by overflow recovery.