Skip to content

Pass-level regression: odd chunk budget never reaches a provider as a fraction #17

Closed

Description

@SutuSebastian

Parent

#15

What to build

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.

Activity

  1. pullfrog commented on Nov 6, 2026

    @pullfrog

    Enrichment for #17 (child of #15).

    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:

    1. 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).
    2. 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.
    3. 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.
    4. 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.
    5. Confirm red-first against current code (strict double rejecting non-integer, or direct integer assertion failing on the .5 values), then green after Summarizer port: coerce the provider budget to a non-negative integer #16. Run vp check, bun run test, bun run typecheck, bun run pack.

    Pullfrog  | Implement a fix ➔ | View workflow run | via Pullfrog | Using muse-spark-1.3-contributor | 𝕏

  2. SutuSebastian commented on Nov 6, 2026

    @SutuSebastian
    ContributorAuthor

    Done in 0c70748 on main, not pushed yet.

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentSpec or ticket ready for an agent to pick up

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions