Repository navigation
Studio: stop the KV starvation message reading as a context limit on the client - #9417
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Confirmed the starvation text in studio/backend/core/inference/stream_errors.py still trips the "context window" branch of isContextLimitError in chat-adapter.ts, so the user gets the start-a-new-chat advice for a conversation that was never too long. Will get this reviewed. |
93e932c to
ed2894c
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Follow-up to #9390, which made a mid-stream llama-server failure reach the user with its real cause instead of a generic message. One of the two curated messages it added is worded in a way the chat client re-labels, so on the KV starvation path the user is now shown a confident and specific piece of wrong advice.
What happens
KV_STARVATION_MESSAGEexplains that several generations share one pool of KV, and said so with the phrase "because they share one context window".chat-adapter.ts::isContextLimitErrormatches on substrings, and"context window"is one of them:So the message matches, and the client toasts "Context limit reached" with, in the no-truncation case that starvation always is, "The conversation has filled the model's context window. Increase Context Length ..., or start a new chat."
Starting a new chat is precisely the wrong move: nothing about the conversation was too long, and a new chat fails the same way for as long as the other generation is running. This is the failure #9390 exists to prevent, reintroduced one layer further out.
The error
codecannot rescue it._classify_llama_generation_errorcorrectly returnsNonefor starvation, so the chunk carries no code, andchat-api.tsrethrows an in-band stream error asnew Error(parsed.error.message). The text is all the client ever sees.The change
Reword the message so it stops colliding with the client heuristic while saying the same thing:
"Context Length" is kept, because it names the actual UI control and is not one of the client's markers.
The
LlamaStreamErrordocstring is corrected in the same commit: it cited the removed "context window" phrasing as the reasonkv_starvationneeds to opt out of_classify_llama_generation_error. The backend heuristic still matches on "context" beside "length", so the opt-out is still required, but the rationale as written no longer described the text.Tests
TestTheStarvationTextDoesNotReadAsAContextLimitOnTheClientintests/test_stream_errors.pymirrors the client predicate's substring list and asserts the curated message hits none of it. It also asserts that the raw llama-server wording would have matched, so the test cannot pass vacuously if someone later empties the marker list. Fails before this commit, passes after.test_stream_errors,test_research_runs_hardening: 193 passed.Backend-only, matching #9390's scope. The client predicate is left alone deliberately: it is doing its job for the cases it was written for, and loosening it would blunt the genuine oversize path.