mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1615] [Feature]: let harnesses recognize the context-overflow 400 (include a phrase they already match) #648
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#648
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @donnielrt on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1615
Filed by an AI agent (Claude, running in Claude Code) on behalf of the repository operator, who reviewed and approved this submission.
What do you want to do?
Let agent harnesses recognize Strata's context-overflow 400 as an overflow, so they run their own compaction-and-retry instead of showing a dead error.
What happens today.
serve/server.py(main,fb58e0d) refuses an oversized request with one of two messages:as HTTP 400 with
"type": "invalid_request_error".Harnesses detect overflow by matching the error text against the phrases servers already use. Pi (pi-coding-agent,
pi-ai/utils/overflow.js,isContextOverflow) matches, among others:exceeds the available context sizeexceeds the context windowcontext_length_exceeded/context length exceeded,too many tokens,token limit exceededStrata's wording matches none of them, so Pi treats the 400 as an ordinary provider error: no compaction, the turn fails, and the session is stuck until the user shrinks it by hand. We hit this on 0.1.40.1 with a 150,722-token prompt on a 131,072 context (one large tool result pushed the prompt past the limit in a single turn).
fit_max_tokenscannot help in that case because the prompt alone exceeds the context (theroom < 1branch).For comparison, llama.cpp's server returns
request (N tokens) exceeds the available context size (C tokens), try increasing itwith"type": "exceed_context_size_error"plusn_prompt_tokensandn_ctxfields, and Pi recovers from that automatically.Suggestion. Keep the current message and guidance, and add a phrase harnesses already match. The smallest change is appending llama.cpp's wording to both messages, e.g.
Optionally also return
"type": "exceed_context_size_error"withn_prompt_tokensandn_ctx, matching llama.cpp, for clients that check the type instead of the text.Workaround we use today. Our Pi extension rewrites the error text on the client side to include "the request exceeds the available context size" when it matches Strata's two messages, which makes Pi's compact-and-retry fire. We'd rather delete that adapter once the server says it itself.
@Niko1221 commented on GitHub (Oct 10, 2026):
Done in v0.1.42 through #1623: the overflow 400 now opens with "request exceeds the context window:", followed by the previous text. The error type stays invalid_request_error. If a harness you use matches a different phrase, tell us which and we will check it against the message.
@donnielrt commented on GitHub (Oct 10, 2026):
(Posted by an AI agent on behalf of the reporter, with their approval.) Thank you — confirmed: our harness (Pi, via pi-ai's overflow detector) matches
/exceeds the context window/i, so the v0.1.42 prefix "request exceeds the context window:" is recognized natively and no other phrase is needed. We will drop our relabel adapter once we pin v0.1.42. This can be closed from our side.@Niko1221 commented on GitHub (Oct 13, 2026):
Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.
If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.