Skip to content

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

Merged
juliusmarminge merged 7 commits into
pingdotgg:mainfrom
StiensWout:wf/find-07b23dce4b777da5a50d6edc
Dec 2, 2026
Merged

juliusmarminge merged 7 commits into
pingdotgg:mainfrom
StiensWout:wf/find-07b23dce4b777da5a50d6edc

Conversation

@StiensWout

Copy link
Copy Markdown
Contributor

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.

Before After
Commit 0f5e2dc5f5 71b46eacae
Result failed with "to deeply equal { snapshot: null" passed
after reconnecting to completed worktree Before: 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.
failure Before: failure
Recording Before: recording After: 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

StiensWout and others added 3 commits December 2, 2026 15:26
Distinguish a pending setup query from the server reporting no setup, and
forget the held running snapshot on the latter so a retried setup shows.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Dec 2, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Dec 2, 2026
@macroscopeapp

macroscopeapp Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 60c7215

Macroscope's review found this PR approvable — Web and mobile clear stale running setup progress after reconnecting when the server reports that setup has ended. The change is confined to client-side state handling and preserves completed setup snapshots.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The hooks now distinguish an unsuccessful snapshot query from a successful query with no snapshot. The shared snapshot holder discards a held running setup when the latest snapshot is null, while preserving or releasing held non-running snapshots. A test covers clearing a running setup and accepting a new snapshot.

Changes: Worktree setup snapshot handling

Layer / File(s) Summary
Resolve absent and running snapshots
packages/client-runtime/src/worktreeSetup.ts, apps/web/src/components/ChatView.logic.test.ts
When the latest snapshot is null, the holder discards a held running snapshot and preserves or releases a held non-running snapshot. A test covers clearing a running snapshot and accepting a new snapshot.
Apply query results in hooks
apps/web/src/components/chat/useWorktreeSetup.ts, apps/mobile/src/features/threads/use-worktree-setup.ts
The web and mobile hooks pass query data only after success. The mobile hook updates held state when the resolved snapshot changes, including when it becomes null.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to 60c72

This change clears a stale worktree setup indicator after a reconnect once the server confirms there is no setup. Finished and failed setups stay visible. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the actual change: worktree setup progress no longer stays visible after a reconnect once setup has ended. It follows the conventional commit form and matches the raw summary and objec…
Description check Passed The description follows the template. It has a Problem section with expected behavior and reproduction steps, a Change section that explains the fix, a Scope section that links related issues, and a V…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the actual change: worktree setup progress no longer stays visible after a reconnect once setup has ended. It follows the conventional commit form and matches the raw summary and objectives, which describe clearing a stale held running snapshot after the server confirms no setup. The title is specific to the main fix and does not need the file-level detail.

Full details: Description check

Explanation

The description follows the template. It has a Problem section with expected behavior and reproduction steps, a Change section that explains the fix, a Scope section that links related issues, and a Verification section with a failing-then-passing test and screenshots. It also has the required agent attribution at the end. The Scope section does not clearly say why the change is a bug fix rather than a feature, and it does not link a specific primary issue. The section also lists several related issues without saying which one shows the bug. These are minor gaps, so the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between cdf438a and 60c7215.

Files selected for processing: 4

  • apps/mobile/src/features/threads/use-worktree-setup.ts
  • apps/web/src/components/ChatView.logic.test.ts
  • apps/web/src/components/chat/useWorktreeSetup.ts
  • packages/client-runtime/src/worktreeSetup.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Dec 2, 2026
juliusmarminge and others added 2 commits December 2, 2026 15:31
The held snapshot is already reconciled during render, so filtering it again
in resolveWorktreeSetupProgress was redundant; drop that and its test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@macroscopeapp
macroscopeapp Bot dismissed their stale review December 2, 2026 15:39

Dismissing prior approval to re-evaluate a3b4867

@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Dec 2, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Dec 2, 2026
Mobile kept its own copy of the held-snapshot resolver, which treated a
confirmed-empty server answer like no answer and so kept a stale running
setup forever after a reconnect. Move resolveHeldWorktreeSetup to
client-runtime and use it from both hooks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@macroscopeapp
macroscopeapp Bot dismissed their stale review December 2, 2026 15:47

Dismissing prior approval to re-evaluate cdf438a

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Dec 2, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Dec 2, 2026
Main replaced the held-snapshot resolvers with holdWorktreeSetupSnapshot in
client-runtime. Take main's shape and apply the fix there: a confirmed-empty
answer drops a held running snapshot, and both hooks pass undefined until
their query has succeeded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Dec 2, 2026
@macroscopeapp
macroscopeapp Bot dismissed their stale review December 2, 2026 18:29

Dismissing prior approval to re-evaluate 60c7215

@juliusmarminge

Copy link
Copy Markdown
Member

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 Base ab091dfedd: 1 running checkout Head 60c7215671: 1 running checkout
2 silent connection reconnecting Base ab091dfedd: 2 silent connection reconnecting Head 60c7215671: 2 silent connection reconnecting
3 after reconnect setup expired top Base ab091dfedd: 3 after reconnect setup expired top Head 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 query Terminal snapshot after expiry Retry restarted Retry completed
Pending query retains 50% Terminal failure retained Retry 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 offline Head: after reconnect, timeline top
iOS head retains pending progress while offline iOS 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.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Dec 2, 2026
@juliusmarminge
juliusmarminge merged commit 3723eda into pingdotgg:main Dec 2, 2026
61 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Dec 2, 2026
@StiensWout
StiensWout deleted the wf/find-07b23dce4b777da5a50d6edc branch December 3, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants