Skip to content

Compare pilot per-request cap against visible tokens, not native - #167

Merged
w4ffl35 merged 1 commit into
masterfrom
fix/pilot-visible-cap-guard
Oct 14, 2026
Merged

w4ffl35 merged 1 commit into
masterfrom
fix/pilot-visible-cap-guard

Conversation

@w4ffl35

@w4ffl35 w4ffl35 commented Oct 14, 2026

Copy link
Copy Markdown
Member

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.

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.
@w4ffl35
w4ffl35 merged commit 25e8a8b into master Oct 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant