Repository navigation
Open
Labels
agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.priority: p3Someday. Needs a driving use case before it starts.type: testCoverage, harness or proof work with no behaviour change.
Description
Context
During a full local run of ./packages/ui-server/tests on a heavily loaded host (load average about 29 on 32 cores), one case failed:
packages/ui-server/tests/hygiene-media-effects.test.ts:735"mixed versions: a keep-copy answer this server does not know as kept is never resolved, and the copy is compensated". It failed after 30816.95 ms, just past the suite's 30 s per-test timeout (bun run testsupplies--timeout 30000).- The error was
brain hygiene media delete media-2026-07-12-harbour-dawn-fffe --expect-fingerprint a1f239224b2f --dry-run exited null:, with empty stderr, thrown by the fixture'srealhelper (packages/ui-server/tests/hygiene-media-effects.test.ts:56-60). The fixture runs the real core CLI throughBun.spawnSync(packages/ui-server/tests/hygiene-media-effects.test.ts:39). The server calls it fromcli(packages/ui-server/src/inbox/hygiene-review.ts:57-70), reached throughmediaPlanandprepareOptionsduringselect. - An exit code of
nullmeans the CLI subprocess was killed by a signal rather than exiting. It was killed as the test crossed its 30 s budget.
Rerun on its own on the same host, still under load (load average about 33), the file passed: 34/34, exit 0, 298 s in total. The case loops over two answers (kept-v2, outcome: kept), each with a fresh fixture and several real CLI spawns, so its runtime scales with host load.
Observed while working on an unrelated PR (#3827), which does not touch hygiene code. This is not part of #3813.
Scope
- Make this case's time budget fit its real work under load. Options include splitting the two answers into separate cases, raising this case's timeout to a stated bound, or reusing one fixture where the property allows it.
- Keep every assertion and the real CLI calls.
Out of scope
- Other
hygiene-media-effectscases, unless they share the same cause and the same fix. - Changing the suite-wide 30 s timeout or
scripts/test.ts. - Replacing the real CLI with a stub.
Acceptance criteria
- The case no longer depends on finishing two fixtures' worth of real CLI spawns inside one 30 s budget. Each answer either has its own budget or is a separate case, and the bound is stated in a comment.
- Every existing assertion in the case is unchanged.
- A failing-first receipt shows the old shape failing under a reproduced slow CLI (for example, a wrapped
realthat delays each spawn), and the new shape passing.
Verification
bun run test packages/ui-server/tests/hygiene-media-effects.test.ts, exit 0.- The slow-CLI reproduction from the acceptance criteria, recorded in the PR.
Contract impact
None.
Metadata
Metadata
Assignees
Labels
agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.priority: p3Someday. Needs a driving use case before it starts.type: testCoverage, harness or proof work with no behaviour change.
Activity