Repository navigation
Description
Context
A reload shortly after a turn finishes can announce that turn's completion a second time. The tracker rule is that a tracker restored on load is a baseline and says nothing (createTrackerAnnouncer, packages/ui-react/src/lib/tracker-announcer.ts:36, D52 §3), and mounted trackers > …: drawn in the strip or the pane, announced once, opened and cleared from there asserts it ("a reload announces nothing", packages/ui-react/tests/tracker-runtime.test.ts:284).
Sightings.
- Hosted main, 2026-11-11: run 42995520839,
unit (1)at40dbae0a2, the480 tablet, dark, coarse pointercase.Expected: "",Received: "The voyage home is done."It is recorded as unresolved in the 2026-11-12 daily evidence on Epic: independent changes land on main concurrently, with only overlapping work serialized #2934. - 2026-11-13, a whole-repository run on a 4-CPU VM at main
631bbae2c, the390 phone, light, coarse pointercase, same values.
Cause, reproduced on demand (2026-11-14). Local host, d64f893b5, Bun 1.4.4, Chromium 153. One throwaway line makes the fixture backend return late after it has emitted its result (after bridge.emit({ type: "result", … }), packages/ui-react/tests/tracker-runtime.test.ts:77), which is what a real backend does while its process winds down.
| Backend returns after its result | Cases | Recovery read just before the reload |
|---|---|---|
| at once (unchanged) | 6 of 6 pass | state: "terminal", outcome: "success", endedAt set |
| 3,000 ms later | 6 of 6 fail at a reload announces nothing, Received: "The voyage home is done." |
state: "running", outcome: null, endedAt: null |
The page had already announced the completion from the live result frame, at least 300 ms before that read.
- The recovery read reports every registered turn that has started as
running, whether or not its result is out (liveRequests,packages/ui-server/src/ws/recovery.ts:77-96). - Snapshot-on-connect already makes the distinction: a registered turn with a result is reported
idle(const finishSnapshot,packages/ui-server/src/ws/connection.ts:169-177). - The reloaded page takes
runningas its baseline. When the host releases the turn, the tracker changes todone, which the announcer rightly treats as a change (const changed,packages/ui-react/src/lib/tracker-announcer.ts:55).
So the announcer and the test are right, and the host's answer is stale for as long as the backend takes to return. On an idle host that is a few milliseconds, which is why the case usually passes.
Scope
Make the recovery read report a turn whose result has been published as ended, with that result's outcome, even while the host still holds the turn. Keep the controlled late return as a permanent case in the tracker runtime file.
Out of scope
- The announcer's rules and the reload assertion. A wait in the test for the host to release the turn is not a fix: the reader would still hear the announcement twice.
- The shape of the recovery read. Only which state it reports in this window changes.
- Queued follow-ups and pending interactions in the recovery read, snapshot-on-connect, and how long a backend may take to return.
Acceptance criteria
- A case in
tracker-runtime.test.tshas the fixture backend return late after its result. On main it fails ata reload announces nothingwithReceived: "The voyage home is done.". With the fix it passes. The PR records both runs. - A host-level test reads the recovery for a session whose registered turn has published a result and has not returned. It reports a terminal state with the result's outcome, not
running. Reverting the fix fails that assertion. - A registered turn with no result yet still reads
running, and a queued request still readsqueued. - The existing tracker and parallel-session runtime cases pass with no assertion or wait changed.
Verification
BRAIN_REQUIRE_CHROME=1 bun run test packages/ui-react/tests/tracker-runtime.test.ts
bun run test packages/ui-server/tests
bun run check:pr --base origin/mainNo API key or network is needed.
Contract impact
None expected: no field is added, removed or retyped. Check the recovery read's entry in docs/integration-contract.md before merging; if it states when a turn stops reading running, update it in the same commit with the CONTRACT: prefix.
Found during the needs: repro triage of 2026-11-13. Related: #3834 has the same trigger (a page connecting while the host still holds a finished turn) with a fixture cause.
Activity