Repository navigation
Retry at the ceiling the endpoint states when it refuses ours, and remember it - #914
Merged
Merged
Conversation
…member it Since #786 every streamed call sends max_tokens 65,536 so that a cut reply is ours to detect. An endpoint whose completion limit is lower refuses instead of clamping, and every chunk fails: gpt-4o-mini caps at 16,384 (#891). When a 400 states the endpoint's own ceiling, the call is retried once at that number, and the number is kept on the client, shared with its clones, so a process pays the refusal once rather than once per chunk. The ceiling only ever goes down. Only a number the message itself calls tokens counts, with or without thousands separators and no lower than 1,024: the digits of a model name, a status code or our own echoed request are not limits, and a message that parses to nothing leaves the caller with exactly the 400 it gets today. A context-window refusal lowers to the window and may still fail on the retry, as today. Landed from #892 by basil-k-aji-dev with the two review points applied: the ceiling on the client instead of a local, and the shape rule for the number instead of "any integer below what we sent". Closes #891 Closes #892 Co-authored-by: basil-k-aji-dev <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Wayland Yang <[email protected]>
This was referenced Sep 25, 2026
Merged
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.
Lands @basil-k-aji-dev's #892 (fix for #891) with the two review points applied, as we did for #776 → #786: their mechanism and tests, carried with co-authorship, on current dev.
What it does. Since #786 every streamed call sends
max_tokens65,536 so that a cut reply is ours to detect; an endpoint whose completion limit is lower refuses instead of clamping, and every chunk fails (gpt-4o-mini caps at 16,384). When a 400 states the endpoint's own ceiling the call is retried once at that number, so gpt-4o-mini works again without any setting.Review points applied.
Arc<AtomicU32>, shared with clones such as thewith_reasoning_effortcopies), so a process pays the refusal once rather than once per chunk; it only ever goes down. Test: the next call and a clone's call start at the stated ceiling.16,384no longer parses to 384,gpt-4o-mini-2024-07-18no longer yields 2024, a context-window refusal lowers to the window and may still fail on the retry as today. Unit test with those messages.utopia-llm41 tests pass, workspace clippy clean.Closes #891
Closes #892
🤖 Generated with Claude Code