Repository navigation
fix(server): resume threads after merged worktree branches are removed - #23132
juliusmarminge wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… next turn Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This focused bug fix adds a tested fallback for recreating a managed worktree when its merged branch no longer exists, while leaving normal worktree restoration unchanged. The companion test-only changes have no production impact. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
Closing: main already fixes this via #18359. |
Problem
After an agent fast-forwards its work into the project checkout and removes its managed worktree and branch, later messages in the same thread fail: checkout recovery tries the deleted branch, logs
ref_not_found, and the provider cannot open the missing workspace. Reproduced in the Linux web dev app with Codex 0.163.0.Change
Keep the existing branch checkout attempt. When Git reports
ref_not_found, retry once by creating the original branch from the project checkout's currentHEADat the original managed path. The thread binding and provider conversation remain intact. Other Git errors retain the existing handling.Scope and approval
Fixes #19124
GitCafe: https://git.cafe/pingdotgg/t3code/issues/19124
Triaged bug via the automated issue flow; GitCafe issue #19124. This completes existing managed-worktree recovery for the deleted-branch case. Recovery uses root
HEAD, one of the fallback sources proposed in the report.Verification
node_modules/.bin/vp test run apps/server/src/orchestration-v2/ProviderTurnStartService.test.ts: 23/23 passed, including after merging current main.vp run typecheckinapps/server(tsc-rs --noEmit): passed. Targeted lint and formatting passed; lint emitted three pre-existing unused-variable warnings.MERGE; proof audit returnedSUFFICIENT.AFTER_FIX; original path and branch are restored at the merged root commit, with the same persisted provider-thread ID. Runtime transcriptSupplemental captures use Linux Chromium at 1280×800 with a desktop user agent, no device emulation; DPR was not recorded. These are runtime evidence, not a matched pixel comparison. Visible differences include timestamps, added turns, and a provider update toast; no client rendering code changed. After recording: recording starts 22:47:18 UTC; submit at 22:47:31; response at 22:47:36; recording ends 22:47:48.
Implementation was runtime-tested at
13f0f0a1d4; merging main produced32b8ca0b38without changing either affected file, and the focused tests passed again.Unverified: Electron, native iOS/Android, other provider runtimes and operating systems, remote/relay/tunnel connections, and MCP/scheduled entry points. They share this server path, but were not exercised here. Dev servers started for verification have been stopped.
Models: Claude Opus 5.5 (tests and implementation), GPT-6.1-Sol (triage and proof); T3 Code with Claude Code and Codex harnesses.