Skip to content

ui-react: two 390 px parallel-session cases saw a tracker for a watched session once in a long run #3998

Closed

Description

@schlessera

Context

The 2026-11-16 reproduction comment supplies deterministic fixture-ordering evidence. The original natural failure retained limited diagnostics; that historical limitation remains.

In a whole-repository bun test run on a 4-CPU VM (Ubuntu 24.04, Chrome 151, Bun 1.4.2) at main 631bbae2c on 2026-11-13, two cases of packages/ui-react/tests/parallel-sessions-runtime.test.ts failed with the same message:

  • mounted parallel sessions > 390 phone, light, coarse pointer, reduced motion: A and B stream side by side; trackers follow success, failure and a queued follow-up, and clear only once seen
  • mounted parallel sessions > 390 phone, light, coarse pointer, reduced motion: an approval, all four question forms and running work fold into a summary; …

Both: error: a watched session is not tracked. The first case asserts it right after its own session A starts streaming in view ("a watched session is not tracked", packages/ui-react/tests/parallel-sessions-runtime.test.ts:680): p.views().length should be 0. The run kept only the one-line failure, not the views.

Conditions that were not clean: a foreign process held the default maintenance ledger for the whole run (it was the census for #3019), and the file ran late in one long process.

What was tried

  • The signature does not appear in the failed-step logs of the 84 failed product jobs on main CI from 2026-10-28 to 2026-11-13.
  • 2026-11-14, local host, d64f893b5: the Actor approvals and A and B stream cases at 390 px with every fixture backend turn returning 3,000 ms late after its result. Both pass. That delay is what reproduces ui-react: the answer-delivery fixture counts another session's replayed exchange, so a case can read 2 cards after the host's receipt #3834 and the tracker reload issue filed beside this one, so a previous case's unreleased turn is not the cause here, at least with that predecessor.
  • 2026-11-14, local host (16 CPUs, Bun 1.4.4), main c82e30ae4: 3 runs of the whole file beside 8 busy loops, 49 cases each, 0 failures.

Scope

Capture which session the unexpected tracker belongs to: the views (session ID, state, turn ID) at the failing assertion, and whether that session was started by an earlier case. Then decide whether it is a fixture carry-over or a product state.

Out of scope

Changing the assertion, deadlines or the tracker rules before the session is identified.

Acceptance criteria

  • A failing or controlled run records the unexpected views (session ID, state and turn ID), the watched active session and any predecessor owner at the named assertion.
  • Attribute the tracker to fixture carry-over or product state using that identity evidence; a passing isolated/load control alone is not attribution.
  • Any resulting correction has named failing-first/restored proof and passes the real-browser 390px cases with unchanged tracker rules and deadlines.

The 2026-11-16 controlled browser run meets the identity criterion: the unexpected running tracker belongs to the previous Actor Deny session, while the watched active session correctly has no tracker. Correct fixture lifecycle ownership by draining/cancelling the previous case's host turns before the next case opens a page. Exercise the identified post-result predecessor ordering with an explicit fixture barrier, preserving tracker rules and all deadlines. Host snapshot-on-connect semantics and the separate product recovery behavior in #3994 remain out of scope for this test-fixture repair.

Verification

BRAIN_REQUIRE_CHROME=1 bun run test packages/ui-react/tests/parallel-sessions-runtime.test.ts -t '390 phone'

The until helper in the file already prints the views when a wait fails; this assertion is a plain expect and prints nothing. Retain the captured identity evidence in the issue and make the plain assertion report the actual views for future failures.

Contract impact

None.

Found during the needs: repro triage of 2026-11-13.

Bounded current-source browser control — 2026-11-14

At main faa480e8c864d547cd8b4eb75965b7d609284770, Ubuntu 26.04.1, 16 CPUs, Bun 1.4.4 and Chrome for Testing 153.0.8010.12, the real-browser command below passed all 16 selected 390px cases / zero failures / 752 assertions in 97.00 seconds, with the repository preload and browser guards intact:

BRAIN_REQUIRE_CHROME=1 bun run test packages/ui-react/tests/parallel-sessions-runtime.test.ts -t '390 phone'

PUPPETEER_EXECUTABLE_PATH selected that Chrome binary. Its missing shared libraries were extracted from the host distribution's packages into a temporary library directory; no source or global installation was changed. The initial missing-library launch failed before cases and is excluded from behavioral evidence. This control differs from the original Ubuntu 24.04 / 4-CPU / Bun 1.4.2 / Chrome 151 long-run conditions. It supplies neither a recurrence nor the missing unexpected-view identity; needs: repro remains.

Related browser-fixture work is owned by #2753; this issue's complete tracker/fixture attribution deliverable fits that epic.

2026-11-14 triage at main faa480e8c864d547cd8b4eb75965b7d609284770: Replaced the empty acceptance section with checkable investigation outcomes and retained the bounded browser control. No cause or repair is claimed.

2026-11-16 readiness reconciliation: folded the reproduced fixture attribution and scoped deterministic correction into the body. This explicit work request covers the fixture repair; no new product or contract policy is implied.

Activity

  1. added
    type: test
    area: ui-react
    priority: p3
    needs: repro
    on Nov 14, 2026
  2. schlessera commented on Nov 16, 2026

    @schlessera
    OwnerAuthor

    Reproduction — 2026-11-16 (main 5af689769)

    Three agents on different models worked this independently, then cross-reviewed each other's write-ups. All three converged on the same cause, and two reproduced it deterministically in a real browser. Removing needs: repro. What is left is a decision: harden the fixture, file the host's snapshot-on-connect behaviour as its own issue (next to #3994), or both.

    Deterministic reproduction

    The failure at "a watched session is not tracked"
    (packages/ui-react/tests/parallel-sessions-runtime.test.ts:680) reproduces on the first run when
    the previous case's last turn is the only turn the host still holds while the next case's page
    connects. Tested at 5af68976988140d8d916f74d7342959a4cc4e66d, Bun 1.4.4, Chrome for Testing 153,
    no CPU load.

    1. From a clean clone at that commit, bun install, and have a real Chrome available (set
      PUPPETEER_EXECUTABLE_PATH if it is not at a default location).
    2. Apply this throwaway change. It makes the fixture backend return late after an Actor turn's
      result, and prints the tracker identity before the unchanged assertion:
    --- a/packages/ui-react/tests/parallel-sessions-runtime.test.ts
    +++ b/packages/ui-react/tests/parallel-sessions-runtime.test.ts
    @@ -168,6 +168,7 @@
             answers.set(prompt, decision);
             bridge.emit({ type: "tool_result", sessionId, toolUseId, output: "Actor decision recorded.", isError: decision.behavior !== "allow" });
             finish(`Actor answered: ${title}.`, "success");
    +        if (process.env.LATE === "all" || (process.env.LATE === "deny" && prompt.includes("Deny"))) await Bun.sleep(3000);
             return;
           }
           if (kind === "Approve" || kind === "Subapprove" || kind === "Remember") {
    @@ -677,6 +678,7 @@
             await until(a.page, "p.activeSessionId() !== null && p.streaming(p.activeSessionId())");
             const A = (await probe(a.page, (p) => p.activeSessionId()))!;
             await a.page.getByText("Setting out: Sail past the Sirens").first().waitFor();
    +        console.error("REPRO_3998", JSON.stringify({ ...(await probe(a.page, (p) => ({ views: p.views(), active: p.activeSessionId() }))), started: started.map((s) => [s.sessionId, s.command]), snapshot: a.approvals.filter((f) => f.frame.type === "session_info").map((f) => f.frame) }));
             expect(await probe(a.page, (p) => p.views().length), "a watched session is not tracked").toBe(0);
     
             // A's own unsent words and image, typed while it streams, saved on the host.
    1. Forcing run — only the third Actor turn ("Deny") returns 3,000 ms late:
    LATE=deny BRAIN_REQUIRE_CHROME=1 bun run test packages/ui-react/tests/parallel-sessions-runtime.test.ts \
      -t '390 phone, light, coarse pointer, reduced motion: (Actor approvals|A and B stream)'

    Result: Actor approvals passes; A and B stream fails with
    error: a watched session is not tracked, Expected: 0, Received: 1. The REPRO_3998 line shows:

    • views: one tracker, sessionId: "odysseus-parallel-3", state: "running", cleared: false,
      with that session's turn ID;
    • active: "odysseus-parallel-4", the watched session, which has no tracker;
    • started: odysseus-parallel-3 is Actorapprove: Sea charts Deny, the previous case's last
      turn; odysseus-parallel-4 is this case's Hold: Sail past the Sirens;
    • snapshot: the page's first session_info is { sessionId: "odysseus-parallel-3", isNew: false, turnId },
      the host's snapshot-on-connect for the Deny session.
    1. Control — every Actor turn returns 3,000 ms late (the 2026-11-14 control):
    LATE=all BRAIN_REQUIRE_CHROME=1 bun run test packages/ui-react/tests/parallel-sessions-runtime.test.ts \
      -t '390 phone, light, coarse pointer, reduced motion: (Actor approvals|A and B stream)'

    Result: both cases pass, views: [], and no isNew: false frame. Snapshot-on-connect is sent
    only when exactly one turn is registered (runningTurns.length === 1,
    packages/ui-server/src/ws/connection.ts:146-147), so delaying every turn removes the condition.
    That is why the earlier control passed.

    Each run takes about a minute, most of it the package build.

    What it shows. The tracker is the predecessor's session, not the watched one. A turn stays
    registered after its result until the host's post-turn work ends; a page connecting in that window,
    when it is the only registered turn, receives a turn-scoped session_info for it, which the tracker
    client counts as work in an unwatched session (trackerEventsForFrame,
    packages/ui-react/src/lib/trackers.ts:122-127; frame, packages/ui-react/src/lib/tracker-client.ts:307-312).
    The case after it is exposed the same way: A and B releases its turn in finally without a host
    restart, and the approval/summary case's views().length === 6 wait then sees seven views and
    times out. That case does not contain the quoted assertion, so its reported message was most
    likely the previous case's.

    What it does not show. This is a forced sufficient condition. The original run kept no views,
    so its attribution rests on the same two cases failing in the same order.

  3. added
    agent-ready
    and removed
    needs: repro
    on Nov 16, 2026
  4. self-assigned this
    on Nov 16, 2026
  5. schlessera commented on Nov 16, 2026

    @schlessera
    OwnerAuthor

    Claimed for implementation. Claim token: claim-d6a230ed. Branch: test/4005-nested-runtime-prerequisite.

    Explicitly requested batch with #4005 and #3995. Closure-only overlaps include #3056, #3059, #3622, #4002, #4060, #4068 and #4080; no direct path collision reported.

  6. added this to the 0.45.0 milestone on Nov 16, 2026
  7. schlessera commented on Nov 16, 2026

    @schlessera
    OwnerAuthor

    Implementation and readiness reconciliation — 2026-11-16. The body now incorporates the reproduction and scoped correction previously held in comments. The requested batch is implemented in #4084, head bb23e28df83c3afa1edbb982cbdd1ecbd7d16ca5, based on 3b104890f84e2eeca687d3c4fbdd1dbb02fb3ae9.

    A held post-result Deny turn reproduces the predecessor tracker: active odysseus-parallel-4, unexpected running odysseus-parallel-3 with its actual turn ID. Draining the real host after each case passes all 16 selected 390px browser cases / 752 assertions in real Chrome 153. Removing that drain fails the named tracker assertion again; restoring it passes both paired cases. Tracker rules and deadlines are unchanged.

    Local bun run check:pr --base origin/main passes all gates and 1,208 affected fast tests. Root typecheck passes with an 8 GB V8 heap. PR and issue milestones are verified as 0.45.0. The PR stays draft while existing main incident #4081 blocks ordinary candidate confirmation; merge and closure are not yet claimed.

  8. schlessera commented on Nov 16, 2026

    @schlessera
    OwnerAuthor

    Merged in #4084 as ad3611ae15f3af82eba14ac9aaf4a8727b3920eb, verified as an ancestor of origin/main. Candidate run 43873943931, attempt 1, passes all selected fast jobs and proof; the selected job checkout logs identify 620cbd8eab58f34272ee7f294e4e19d38a82d02c, whose tree exactly matches the squash. The issue is closed and retains milestone 0.45.0, as does the PR.

    Local failing-first and restored-mutation evidence remains in the PR. Required proof on the actual squash is still running in main run 43877725319; full post-merge verification is not yet claimed.

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

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-reactpriority: p3type: test

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions