Repository navigation
Compare pilot per-request cap against visible tokens, not native - #167
Merged
Merged
Conversation
Native completion counts include uncapped provider reasoning tokens (observed 884 reasoning of 1033 native while visible was 122), so the completion-exceeded-request-cap guard false-tripped and halted two dev-collection pilots. Budget accounting still uses native tokens.
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.
Systematic root cause behind the two halted #11 dev-collection pilots (512-cap and 1024-cap, same seed-202 slot).
Evidence: seed-202 iter 7 returned 1033 native completion tokens but only 122 normalized/visible — 884 were provider reasoning tokens, which max_tokens does not constrain. The completion-exceeded-request-cap guard compared native against the requested cap, so any reasoning-heavy turn false-tripped and fail-closed the pilot.
Fix: guard on normalized (visible) completion tokens, falling back to native when the billing record omits normalized (fail-closed). Budget accounting unchanged — still native.
Tests: new synthetic-billing case (native 1033 / visible 122 at cap 1024) failed pre-fix with abortedAttempts=1, passes post-fix with 32/32 completed and native-based budget totals. Full live-runner suite passes; tsc clean; check-standards 0 new; check-architecture 0 new.