Repository navigation
fix: derive an output ceiling from the window and answer a refused dial as not_ready - #10
Merged
Merged
Conversation
…al as not_ready Co-authored-by: Cursor <cursoragent@cursor.com>
| if syncMaxOutputTokensFromContext(cfg) { | ||
| changed = true | ||
| slog.Info("model-spec max_output_tokens derived from context_size", | ||
| "context_size", cfg.Spec.ContextSize, "max_output_tokens", cfg.Spec.MaxOutputToks) |
| if syncMaxOutputTokensFromContext(cfg) { | ||
| changed = true | ||
| slog.Info("model-spec max_output_tokens derived from context_size", | ||
| "context_size", cfg.Spec.ContextSize, "max_output_tokens", cfg.Spec.MaxOutputToks) |
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Why
A local chat card reporting
max_output_tokensequal to its whole window (131072 of 131072) led clients to reserve the entire context for the reply, which the KV budget refused askv_budget_exhausted. Separately, each card edit relaunches the engine, and during that gap a request that found nothing listening surfaced as 502upstream_unreachable, which callers treat as a hard failure.What changes
max_output_tokensis unset or not smaller thancontext_size, it is derived as a quarter of the window, on boot and onPUT /api/model-spec, alongside the existingcontext_sizederivation. A ceiling the author set below the window is kept.*net.OpErrorwithOp == "dial") is now 503not_readywithRetry-After: 5, matching the readiness gate. Nothing reached the engine, so resending is safe. A connection the engine accepted and then dropped is still 502upstream_unreachable.Compatibility
Retry-After, which is the documented retryable shape.-np 1).Verification
go vet ./...andgo test ./...pass.TestSyncMaxOutputTokensFromContext,TestProxy_UpstreamErrorJSONEnvelope(now 503not_readywithRetry-After), andTestProxy_DroppedConnectionStaysBadGateway.Made with Cursor