Bug: DeepSeek "Input token exceed the limit" (400 quota_limit_reached) not classified as context overflow - auto recovery never triggers #3399
Replies: 2 comments
|
I traced this against rc.7 (
That explains why this fails immediately even though it is physically a context overflow. It also explains why trying A narrow regression should include both sides:
Operationally, I would capture the raw body plus normalized code, lower requested output only when there is actual headroom, try I wrote up the evidence chain and bounded recovery flow here: https://sandbaseai.github.io/deepseek-harness-handbook/context-window-overflow.html Independent community handbook, not an official DeepSeek AI project. |
|
Thanks for the independent confirmation — this matches what I found exactly, and it's good to have the evidence chain written down. On the regression matrix: the fix I prepared already covers both sides you listed.
The change is one additional pattern in Agreed on the operational flow, with one nuance worth adding: automatic recovery can only help before the history is already over the window. Once the summarizer itself cannot read the history, a new session with a concise handoff is the only way out — exactly as you wrote. |
Uh oh!
There was an error while loading. Please reload this page.
Bug: DeepSeek
Input token exceed the limit(HTTP 400, codequota_limit_reached) is not classified as context overflow, so automatic compaction recovery never triggers现象 / Symptom
When a conversation exceeds the model context window, the DeepSeek API rejects the request with:
{"message":"Input token exceed the limit (request id: ...)","type":"api_error","param":"","code":"quota_limit_reached"}The harness classifies this as
INVALID_REQUEST(the 400 fallback), the turn fails, and a manual/compactafterwards fails with "Compaction could not produce a useful summary", because the history is already too long for the summarizer to read. I hit this against the official API through an OpenAI-compatible proxy (pi-ai provider).根因 / Root cause
isContextWindowExceededErrorinpackages/llm/llm/src/error.tsrecognizes wording likecontext length exceeded,maximum context length, andtoo large for the model context, but not DeepSeek's terse production messageInput token exceed the limit(thequota_limit_reachedcode name is reused for this failure). So both thellm-deepseekandllm-pi-aiadapters normalize it toINVALID_REQUEST.The consequence is more than cosmetic: compaction-basic's automatic overflow recovery (
agent/request-errorlistener) keys onCONTEXT_WINDOW_EXCEEDED, so the prune → compact → retry path never runs and the turn just dies with 400.建议修复 / Suggested fix (already prepared)
Add an
INPUT_TOKEN_EXCEED_LIMITpattern to the classifier:Requiring
the limitto followexceedimmediately keeps usage-limit phrasings such asinput tokens exceed the monthly usage limitout of the branch. The fix is implemented and verified locally (classifier unit tests +llm-deepseekmock-server test with the real 400 body +llm-pi-aistream test;error.tsstays at 100% coverage). It is available for reference on a fork branch:fantasywinter207/deepseek-harnessbranchfix/classify-deepseek-input-token-exceed-limit(commit6efce3a26e), in case the team wants to pick it up.Happy to adjust anything if the team prefers a different wording/approach.
All reactions