fix(web): worktree setup progress clears after reconnecting once setup has ended #47540
main fromrefs/pull/47540/head·merged by juliusmarminge View on GitHubIf 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.
- Start a Replay (dev) thread in a new worktree in a demo repository with a slow Git post-checkout hook.
- Disconnect the browser from the host while the checkout is running.
- Leave the browser tab open while the checkout and the first turn finish on the host.
- Wait at least 30 seconds after setup finishes.
- 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.
| Before | After | |
|---|---|---|
| Commit | 0f5e2dc5f5 | 71b46eacae |
| Result | failed with "to deeply equal { snapshot: null" | passed |
| after reconnecting to completed worktree | ![]() The completed turn appears, but the checkout still shows as running. | ![]() The completed turn appears and the checkout progress clears. |
| failure | ![]() | |
| Recording | Before: recording | After: recording |
Tests#
- 0f5e2dc5f5 adds the failing test, alone, before the fix.
pnpm exec vp run check:changed 0353e276be35d8ab1a84d0d009db8c5bb7388cddpassed 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
- 2
- 3
- 4
Pushed60c7215
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
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 ab091dfedd Head 60c7215671 Result ❌ failed
ASSERTION_FAILED: expect.toBeHidden failed
locator: getByText("50%")
expected: hidden or absent
observed: visible (match count 1)✅ passed 1 running checkout 

2 silent connection reconnecting 

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 query Terminal snapshot after expiry Retry restarted Retry completed 



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 offline Head: after reconnect, timeline top 

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.
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.
juliusmarminge added labelstakeover:ready
juliusmarminge removed labelstakeover:in-progress
juliusmarminge merged this3723eda
juliusmarminge closed this
juliusmarminge removed labelstakeover:ready
Sign in to join this conversation.





macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes