fix(proxy): start the budget above the model's reasoning floor #366

Merged
coilyco-ops merged 3 commits from fix/budget-base-above-the-reasoning-floor into main 2026-08-13 11:11:11 +00:00
Member

closes #364

The slice of #360 that lands without new measurement. 360 stays open for whether 1800 is the right number and for the confirming battery run.

The change

baseCompletionTokens 900 → 1800. Olaf measured 4.1–4.4 KB of reasoning_content before any content, on the order of a thousand tokens, so 900 made the first call structurally unable to succeed rather than unlucky. About 15% of turns paid for two model calls to answer once, and every one of them passed, so no instrument reported it.

max_tokens is a ceiling, not a target. A turn that finishes in 400 tokens is unaffected. What changes is that the turns which needed a second call stop needing one.

The one-line version is wrong, and an existing test caught it

The ladder clamps at maxCompletionTokens = 3600. With a base of 900 it read 900 → 1800 → 3600 and every rung was real. With a base of 1800 the second raise clamps to 3600 twice, so the turn retries at a budget identical to the one that just failed — which the comment three lines above already forbids:

A reasoning model can spend the whole budget on reasoning_content and return nothing. Retrying at the same budget just repeats the wall.

TestCompleteStopsRaisingAfterTheAllowedAttempts failed with model calls = 2, want 3 the moment I changed the base.

So budgetRaisesAllowed becomes 1, which is now the truth rather than an overstatement, and the raise is extracted into nextCompletionBudget which reports whether it actually raised. Exhaustion covers both the count and the ceiling, so the invariant survives the constants moving again.

That existing test then passes unchanged. The constant was wrong, not the test — I did not touch anyone's assertion to make my change fit.

What moved with it, all mechanical and all pinned by tests

  • docs/sirens-echo-budget.md
  • the two capability cards, which a test requires to name the model-call budget: ten → nine
  • the rendered prompt snapshots, regenerated
  • the prompt budget ratchet, up by exactly one byte, because "nine" is a longer word than "ten"

What I did not do

Re-measure. The prediction is that the doubled calls disappear and the retry share of model time goes to zero. Confirming that is a live battery run and belongs to whoever runs the next cycle.

ward exec gate green: build, policy-check, vet, test, test-skips, pre-commit.

closes #364 The slice of https://forgejo.coilysiren.me/coilyco-gaming/sirens-echo/issues/360 that lands without new measurement. **360 stays open** for whether 1800 is the right number and for the confirming battery run. ## The change `baseCompletionTokens` 900 → 1800. Olaf measured 4.1–4.4 KB of `reasoning_content` before any content, on the order of a thousand tokens, so 900 made the first call **structurally unable to succeed** rather than unlucky. About 15% of turns paid for two model calls to answer once, and every one of them passed, so no instrument reported it. `max_tokens` is a ceiling, not a target. A turn that finishes in 400 tokens is unaffected. What changes is that the turns which needed a second call stop needing one. ## The one-line version is wrong, and an existing test caught it The ladder clamps at `maxCompletionTokens = 3600`. With a base of 900 it read 900 → 1800 → 3600 and every rung was real. With a base of 1800 the second raise clamps to 3600 **twice**, so the turn retries at a budget identical to the one that just failed — which the comment three lines above already forbids: > A reasoning model can spend the whole budget on reasoning_content and return nothing. Retrying at the same budget just repeats the wall. `TestCompleteStopsRaisingAfterTheAllowedAttempts` failed with `model calls = 2, want 3` the moment I changed the base. So `budgetRaisesAllowed` becomes **1**, which is now the truth rather than an overstatement, and the raise is extracted into `nextCompletionBudget` which reports whether it actually raised. Exhaustion covers both the count and the ceiling, so the invariant survives the constants moving again. **That existing test then passes unchanged.** The constant was wrong, not the test — I did not touch anyone's assertion to make my change fit. ## What moved with it, all mechanical and all pinned by tests - `docs/sirens-echo-budget.md` - the two capability cards, which a test requires to name the model-call budget: **ten → nine** - the rendered prompt snapshots, regenerated - the prompt budget ratchet, **up by exactly one byte**, because "nine" is a longer word than "ten" ## What I did not do Re-measure. The prediction is that the doubled calls disappear and the retry share of model time goes to zero. Confirming that is a live battery run and belongs to whoever runs the next cycle. `ward exec gate` green: build, policy-check, vet, test, test-skips, pre-commit.
fix(proxy): start the budget above the model's reasoning floor
All checks were successful
ci / test (pull_request) Successful in 31s
ci / publish-echo-image (pull_request) Has been skipped
ci / publish-observed (pull_request) Has been skipped
ci / image-build (pull_request) Successful in 20s
e34b4de9a4
Olaf measured 4.1 to 4.4 KB of reasoning_content before any content on the
raises, which is on the order of a thousand tokens. A 900 token ceiling is
below that, so the first call was structurally unable to succeed and about 15
percent of turns paid for two model calls to answer once. Every one of them
passed, so no instrument reported it.

max_tokens is a ceiling and not a target, so a turn that finishes in 400 tokens
is unaffected by the base being 1800. What changes is that the turns which
currently need a second call stop needing one.

The one-line version is wrong, and an existing test caught it. The ladder
clamps at 3600, so with a base of 1800 the second raise clamps to the same
value twice and retries at a budget identical to the one that just failed.
The comment three lines above already says that repeats the wall.

So budgetRaisesAllowed becomes 1, which is now the truth rather than an
overstatement, and the raise is extracted into a function that reports whether
it actually raised. Exhaustion covers both the count and the ceiling, so the
invariant survives the constants moving again.

TestCompleteStopsRaisingAfterTheAllowedAttempts then passes unchanged, which
is the right outcome: the constant was wrong, not the test.

Three pinned statements move with it, all mechanical: the budget doc, the two
capability cards that must name the model call budget, and the prompt budget
ratchet, which goes up by exactly one byte because nine is a longer word than
ten.

closes #364

Co-authored-by: Kai Siren <coilysiren@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Merge branch 'main' into fix/budget-base-above-the-reasoning-floor
All checks were successful
ci / test (pull_request) Successful in 30s
ci / publish-echo-image (pull_request) Has been skipped
ci / publish-observed (pull_request) Has been skipped
ci / image-build (pull_request) Successful in 19s
569b3811d9
Merge branch 'main' into fix/budget-base-above-the-reasoning-floor
All checks were successful
ci / test (pull_request) Successful in 30s
ci / publish-echo-image (pull_request) Has been skipped
ci / publish-observed (pull_request) Has been skipped
ci / image-build (pull_request) Successful in 20s
1e1ac8374b
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coilyco-gaming/sirens-echo!366
No description provided.