Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): worktree setup progress clears after reconnecting once setup has ended #47540

MergedStiensWout(GitHub profile, opens in a new tab)merged 7 commits intomain fromrefs/pull/47540/headmerged by juliusmarminge View on GitHub

If the browser lost its connection during a worktree checkout and reconnected after the server had dropped the finished setup, the chat kept showing the checkout as running even though the agent had already replied. The client now tells a pending setup query apart from the server confirming there is no setup. On confirmation it forgets the held running snapshot, so the progress clears and a later retry, whose sequence starts over, shows its own progress. Finished and failed setups stay visible as before.

Related: #46341, #32591, #41059, #46321, #44460, #30897

Reproduction on main

Commit 7dda56fd5f (main). The completed turn appears, but the checkout still shows as running. Expected: The completed turn appears and the checkout progress clears.

  1. Start a Replay (dev) thread in a new worktree in a demo repository with a slow Git post-checkout hook.
  2. Disconnect the browser from the host while the checkout is running.
  3. Leave the browser tab open while the checkout and the first turn finish on the host.
  4. Wait at least 30 seconds after setup finishes.
  5. Reconnect the same browser tab.

The cause is at apps/web/src/components/ChatView.logic.ts:322. Ran pnpm scenarios:prove scripts/scenarios/expired-worktree-setup-after-reconnect.e2e.ts --target web with the repro scenario added: it failed in 2 of 2 runs on a clean boat.dev VM, with expect.toBeHidden failed in the output.

Evidence

Environment: Linux x64 on a boat.dev VM reset before each run, the repository's own tests.

Proven: the replacement test apps/web/src/components/ChatView.logic.test.ts fails at the test commit 0f5e2dc5f5 and passes on the head 71b46eacae, both on main 0353e276be.

BeforeAfter
Commit0f5e2dc5f571b46eacae
Resultfailed with "to deeply equal { snapshot: null"passed
after reconnecting to completed worktreeBefore: after reconnecting to completed worktree Before: after reconnecting to completed worktree (changed region)
The completed turn appears, but the checkout still shows as running.
After: after reconnecting to completed worktree After: after reconnecting to completed worktree (changed region)
The completed turn appears and the checkout progress clears.
failureBefore: failure
RecordingBefore: recordingAfter: recording

Tests

  • 0f5e2dc5f5 adds the failing test, alone, before the fix.
  • pnpm exec vp run check:changed 0353e276be35d8ab1a84d0d009db8c5bb7388cdd passed on head.

Not in this change

  • The server still drops finished setup snapshots after a fixed 30-second retention; a client that misses the final 'done' snapshot sees no setup card instead of the completed one.
  • Mobile reads worktree setup through its own code path, which this change does not touch.

Who did the work

  • Repro written by GPT 6.2 Sol, in Codex
  • Duplicate check judged by Claude Opus 5.5, in Claude Code
  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex
  • Reproduction, checks and proof run by a program on base and head, not by an agent

Made in T3 Code by GPT 6.2 Sol and Claude Opus 5.5

    1. Pushed60c7215

    2. Evidence

      Real web app, Chromium on Linux, dark theme, 1440×1080, fresh synthetic project/database on each commit. Start Replay in a worktree with checkout held at 50%; make only T3's socket silent; release checkout while offline; wait 65 seconds and confirm the host returns no setup snapshot; reconnect the same tab without reload. Scroll to the beginning and verify scrollTop=0 and the first user message is inside the viewport before capturing.

      Scenario: Expired setup clears after a silent socket reconnect

      Proven: the scenario fails on base ab091dfedd and passes on head 60c7215671.

      Base ab091dfeddHead 60c7215671
      Result❌ failed
      ASSERTION_FAILED: expect.toBeHidden failed
      locator: getByText("50%")
      expected: hidden or absent
      observed: visible (match count 1)
      ✅ passed
      1 running checkoutBase ab091dfedd: 1 running checkoutHead 60c7215671: 1 running checkout
      2 silent connection reconnectingBase ab091dfedd: 2 silent connection reconnectingHead 60c7215671: 2 silent connection reconnecting
      3 after reconnect setup expired topBase ab091dfedd: 3 after reconnect setup expired topHead 60c7215671: 3 after reconnect setup expired top

      Before recording · After recording · Scenario source

      Both recordings end with the first “hello” message visible. Base still shows running checkout at 50% alongside “Done”; head shows the completed conversation with the setup card cleared.

      Supplemental real-app checks passed on both commits. Head captures below show a pending query retaining progress (one real setup reply held), a terminal failure retained after the host snapshot expired, and a retry restarting at 25% and completing. Incidental local paths in the failure text are redacted.

      Pending queryTerminal snapshot after expiryRetry restartedRetry completed
      Pending query retains 50%Terminal failure retainedRetry restarted at 25%Retry completed

      Supplemental scenario

      Native iOS supplemental check on head: the host returned no setup snapshot while the offline client retained 50%; after reconnect, the first user message and completed reply are visible and the setup card is gone. These are head-state captures, not a matched native before/after proof.

      Head: host finished, client offlineHead: after reconnect, timeline top
      iOS head retains pending progress while offlineiOS head clears setup after reconnect

      Native scenario · Pairing helper

      Native limitation: the base post-reconnect still clips the first message and checkout percentage, and stopping native recording timed out. The complete matched before/after proof is the web pair above.

      Sanitized runner logs

      Not shown:

      • A matched native iOS before/after visual proof remains incomplete: the base run retained setup stages beside Done and failed the stale-50% assertion, but its post-reconnect still clips the first message/checkout percentage; native recording cleanup also timed out. Head's offline retention and successful reconnect were visually verified and uploaded.
      • Android was not separately exercised; native verification used iOS. The terminal-retention and retry variations were exercised in the real web app.
    3. juliusmarminge added labelstakeover:ready

    4. juliusmarminge removed labelstakeover:in-progress

    5. juliusmarminge merged this3723eda

    6. juliusmarminge closed this

    7. juliusmarminge removed labelstakeover:ready

Sign in to join this conversation.