You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pass-level regression: odd chunk budget never reaches a provider as a fraction #17
A full compaction pass, driven end to end through the engine with a deliberately odd chunk budget, never asks a provider for a fractional budget at any stage: leaf, tiled chunk, condensed and heal. The assertion is about what the host received, so it survives a refactor of the chunking math, and it covers the path the real bug travelled rather than only the helper.
This is the regression that would have caught the report. The engine already has a pass-level harness and a recording host double; the coverage is the new part.
Acceptance criteria
A pass over a store seeded for at least two leaves, run with an odd chunk budget, records only integer maxTokens values at the host double
The same assertion holds for a condensed tier pass and for a heal run over a leaf that needs re-deriving
The test is parameterized over the stages rather than duplicated per stage
Boundary values from the seam ticket (zero, one, odd, fractional ending in .5, non-finite) are represented at the pass level for at least the leaf stage
The test asserts on recorded host requests only, with no assertion on an internal variable or a specific call site
vp check, bun run test, bun run typecheck and bun run pack pass
Blocked by
The seam ticket in this set: the pass-level test is red until the coercion exists, so it lands after it.
Duplicates checked: no duplicate. #15 is the parent report (fractional maxTokens from leafChunkBudget / 2), #16 is the sibling seam fix (coercion in requestOf), #18 is the sibling changeset. All related, none the same work as this pass-level regression.
Related context: #15 reproduction and testing decisions already describe this test (odd budget end to end, strict host double, Number.isInteger on what the provider receives); #16 must land first since this test is red until the coercion exists.
Implementation plan:
Add a pass-level test in packages/core/test/ alongside llm.test.ts (e.g. integer-budget-pass.test.ts), using existing harness only: storedPass (test/support/pass-outcome.ts) + runCompaction (src/compaction-engine.ts:86), runHeal (src/heal.ts), makeLlm (src/llm.ts:193), and a recording host double from test/support/fake-host.ts (fakeHost/scriptedHost already record maxTokens).
Seed a store with enough messages for at least two leaves; run with an odd leafChunkTokens whose scaled budget is odd so leafChunkBudget / 2 (src/compaction-engine.ts:324,416) is fractional pre-fix. Assert every entry in host.calls[].maxTokens satisfies Number.isInteger (plus >= 1 given the seam clamps). Cover reasoning and non-reasoning models since requestOf (src/llm.ts:435-444) adds REASONING_HEADROOM.
Parameterize over stages rather than duplicating: leaf pass, tiled-chunk pass (force tiling with small budget / long messages per existing storedPass fixtures), condensed-tier pass (seed leaves then condense), and heal (runHeal over a leaf needing re-deriving). One assertion helper over recorded host requests only, no internal-variable assertions.
At leaf stage, additionally cover boundary budgets from the issue (zero, one, odd, .5, non-finite) at the pass level by driving passes with the corresponding leafChunkTokens/calibration inputs.
packages/core/test/provider-budget.test.ts parameterizes over leaf, tiled chunks, condensed tier and heal, all driven through a real pass with leafChunkTokens: 2895, and asserts only on what the strict host double received. A second table drives the leaf target through zero, half, 1447.5, 1447.25, NaN and Infinity.
Verified red: with the source change stashed, 10 of the 12 pass-level tests fail, and the condensed-tier test goes red through its leaf requests, which is expected because a condensed target is an integer by construction.
Activity
pullfrog commentedon Nov 6, 2026
Enrichment for #17 (child of #15).
Duplicates checked: no duplicate. #15 is the parent report (fractional
maxTokensfromleafChunkBudget / 2), #16 is the sibling seam fix (coercion inrequestOf), #18 is the sibling changeset. All related, none the same work as this pass-level regression.Related context: #15 reproduction and testing decisions already describe this test (odd budget end to end, strict host double,
Number.isIntegeron what the provider receives); #16 must land first since this test is red until the coercion exists.Implementation plan:
packages/core/test/alongsidellm.test.ts(e.g.integer-budget-pass.test.ts), using existing harness only:storedPass(test/support/pass-outcome.ts) +runCompaction(src/compaction-engine.ts:86),runHeal(src/heal.ts),makeLlm(src/llm.ts:193), and a recording host double fromtest/support/fake-host.ts(fakeHost/scriptedHostalready recordmaxTokens).leafChunkTokenswhose scaled budget is odd soleafChunkBudget / 2(src/compaction-engine.ts:324,416) is fractional pre-fix. Assert every entry inhost.calls[].maxTokenssatisfiesNumber.isInteger(plus>= 1given the seam clamps). Cover reasoning and non-reasoning models sincerequestOf(src/llm.ts:435-444) addsREASONING_HEADROOM.storedPassfixtures), condensed-tier pass (seed leaves then condense), and heal (runHealover a leaf needing re-deriving). One assertion helper over recorded host requests only, no internal-variable assertions..5, non-finite) at the pass level by driving passes with the correspondingleafChunkTokens/calibration inputs..5values), then green after Summarizer port: coerce the provider budget to a non-negative integer #16. Runvp check,bun run test,bun run typecheck,bun run pack.muse-spark-1.3-contributor| 𝕏SutuSebastian commentedon Nov 6, 2026
Done in
0c70748onmain, not pushed yet.packages/core/test/provider-budget.test.tsparameterizes over leaf, tiled chunks, condensed tier and heal, all driven through a real pass withleafChunkTokens: 2895, and asserts only on what the strict host double received. A second table drives the leaf target through zero, half, 1447.5, 1447.25,NaNandInfinity.Verified red: with the source change stashed, 10 of the 12 pass-level tests fail, and the condensed-tier test goes red through its leaf requests, which is expected because a condensed target is an integer by construction.