Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix: recover threads after worktree deletion #9852

Closedmkaradeniz(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/9852/headopened View on GitHub

What Changed

  • Stop a turn before provider startup when T3 cannot recreate its missing worktree.
  • Show an actionable error that tells the user to restore the worktree or select another branch.
  • Keep the branch selector available and load refs from the project checkout when the saved worktree is gone.
  • Rebind the thread to the selected checkout so later turns keep the existing history and resume normally.

Why

T3 already tries to recreate a missing worktree. That recovery fails when the worktree branch was also deleted. T3 then started the provider in the deleted directory and showed a provider spawn error on every new turn.

This change completes the branch-deleted case discussed in #6197. It builds on the automatic recreation from #7839 and the missing-folder error from #5040.

UI Changes

Before rebinding

A thread with a deleted worktree shows the recovery branch selector

After rebinding

The same thread continues after rebinding to main

Verification

  • pnpm exec vp test run apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts apps/web/src/components/BranchToolbar.logic.test.ts --maxWorkers=2 (139 tests)
  • pnpm exec vp run --filter @t3tools/web typecheck
  • pnpm exec vp run --filter t3 typecheck
  • Targeted lint and format checks for all changed files
  • Isolated browser test with a disposable T3 home: create a thread worktree, delete its worktree and branch, restart T3, rebind the thread to main, and continue the same thread

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • This change does not add animation
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at aa9b7a9

      Macroscope's review found this PR approvable — This is a focused worktree-recovery bug fix: healthy worktree paths retain their behavior, while deleted worktrees now produce an actionable error and expose a tested path to rebind the existing thread to the project checkout. The change adds no schema, deployment, security, billing, or configuration-default modifications.

      Notes:

      • Diff unchanged. Approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. juliusmarminge added labelsmacroscope-review

    4. Thanks for working on this. We merged the orchestrator V2 rewrite in #2829, and we are closing this PR as part of that transition.

      This change touches ProviderCommandReactor.ts, which the V2 merge removed. V2 executes provider work through orchestrator services and the effect worker.

      Sorry for the extra work this creates. If the change is still needed on V2, please rebuild it on current main, verify it there, and open a new PR linking back here. We're closing the current implementation without assuming the underlying request is resolved.

    5. juliusmarminge closed this

Sign in to join this conversation.