Repository navigation
Description
Context
ws-turn-budgets.test.ts's "actual claude/pi completed response crosses the host token fallback and stops with budget_exceeded, preserving partial work" cases fail intermittently with BUDGET_HOST_ABORTS_ACTUAL_ADAPTER (expected true, received false).
The fixture adapter waits for the host's abort for at most 200 ms after emitting usage that crosses the budget: Bun.sleep(200) in the Promise.race after each fixture adapter emits its usage, packages/ui-server/tests/ws-turn-budgets.test.ts:58 (Claude) and :66 (Pi). Since #2896 the blocking budget report commits on the SQLite write worker (observe, packages/ui-server/src/brain/turn-budgets.ts), and the host aborts only once that commit settles. On a loaded host the commit plus the abort can take longer than 200 ms, so the adapter returns first and the test reads it as "not aborted".
Observed on 2026-10-26, running the file alone on a loaded shared host:
- main
c47483196: 2 failures in 22 runs; - an unmerged Epic: nothing on the hosted server's event loop waits for a ui.db fsync #2850 slice branch: 6 failures in 33 runs.
The full ui-server suite also failed both cases once.
Scope
Make the test wait for the host's abort decision rather than a fixed 200 ms. For example, the adapter could hold until the budget report has committed (budgets.settled() or an equivalent hook) or the turn's abort signal fires, with a long deadline. The test must still prove that the host aborts the adapter, and fails if it never does.
Out of scope
Changing how or when the host aborts a turn over budget.
Acceptance criteria
- The file passes 20 consecutive runs on a host under three
dd … conv=fsyncwriters. - A mutation that removes the host's budget abort still fails
BUDGET_HOST_ABORTS_ACTUAL_ADAPTER.
Verification
bun run test packages/ui-server/tests/ws-turn-budgets.test.ts, repeated.
Contract impact
None.
2026-11-10 triage at main d79eeed0a: the fixed 200 ms window this issue names is gone. #3459 (squash dacee8e7e, commit "wait for the host's budget abort instead of a fixed 200 ms") made the fake adapters race the abort signal against a 2.5 s failure maximum, and #3719 (5de219acf) removed the last 200 ms case for late (abortWindowMs, packages/ui-server/tests/ws-turn-budgets.test.ts:34; the two races at :71 and :79; the assertion at :114). The Context's :58/:66 citations are historical. What remains is the acceptance evidence: 20 consecutive runs under three fsync writers and the abort-removal mutation. If both hold, close this with those receipts; no source change is expected.
Activity
schlessera commentedon Oct 26, 2026
Additional completed full-suite recurrence while validating #3002, with Bun 1.4.2 and frozen dependencies through the shared heavy-command wrapper:
21f820efc6ebac1fad92082db8cd8a636ebd2c6b; base:fd51cadf42918202fe3a68e0333ffdcecbdbcb8d.bun run test packages/ui-server: 4,144 passes, four failures, 28,460 assertions, 3,585.36 seconds.BUDGET_HOST_ABORTS_ACTUAL_ADAPTERatpackages/ui-server/tests/ws-turn-budgets.test.ts:101, expected true / received false. The other budget cases in that run passed.schlessera commentedon Nov 10, 2026
2026-11-10 triage at main
d79eeed0a:priority: p1. The issue is on the open 0.45.0 release milestone, which is the current milestone commitment. It blocks nothing.Delta: the fixed 200 ms window is gone. #3459 (squash
dacee8e7e) made the fake adapters wait for the abort signal with a 2.5 s failure maximum, and #3719 (5de219acf) removed the last 200 mslatecase (abortWindowMs,packages/ui-server/tests/ws-turn-budgets.test.ts:34). The body now records this in a dated note. What remains is the evidence the acceptance criteria ask for: 20 consecutive runs under three fsync writers, and the abort-removal mutation failingBUDGET_HOST_ABORTS_ACTUAL_ADAPTER. If both hold, this should close with those receipts and no source change.agent-readystays for that verification.schlessera commentedon Nov 10, 2026
Acceptance evidence, test-health push (epic #3855), batch
e3855-ui-server-04, runth-20261110174252-07efe9#14, at the epic base0129244ad0781c426f7d3f2363c92d8993aefaeewithpackages/ui-server/tests/ws-turn-budgets.test.tsunchanged, Linux 6.18 WSL2.dd if=/dev/zero of=<scratch>/wN bs=1M count=256 conv=fsyncran on the same filesystem asTMPDIRfor the whole measurement, on a shared host whose load average was 25–45 from other workers.bun scripts/test-health.ts measure packages/ui-server/tests/ws-turn-budgets.test.ts --runs 20: 20 runs, 0 failures, verdict stable, median 53.7 s per file run. The writers were stopped afterwards.abortController.abort(stops.budget);from the budget block inpackages/ui-server/src/ws/session-run/budget.ts:91makesbun scripts/test-health.ts mutate --test packages/ui-server/tests/ws-turn-budgets.test.ts --name "actual " --expect BUDGET_HOST_ABORTS_ACTUAL_ADAPTERreportkilled: the cases pass before, fail onBUDGET_HOST_ABORTS_ACTUAL_ADAPTERwith the abort removed, and pass again once it is restored.Both acceptance criteria hold with no source or test change, as the 2026-11-10 triage note predicted. The batch PR into the epic branch says
Closes #3009.schlessera commentedon Nov 11, 2026
Delivered by #3925, which merged into
epic/3855-test-healthas9c8309639(the push in #3855). It landed in the combined merge without proof of its own; the gate, typecheck andcheck:prpassed on the combined branch. The epic's two exhaustive runs ondc2439551, 42996974186 and 42997012467, then passed. GitHub does not applyClosesfor a pull request into a non-default branch, so I'm closing this by hand. The change reachesmainwith the epic's single landing pull request.