Uh oh!
There was an error while loading. Please reload this page.
Make worktree placement configurable - #4439
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ApprovabilityVerdict: Needs human review This PR introduces a new user-facing feature (configurable worktree path templates) with new settings UI, path template resolution logic, and validation changes across multiple services. New features that introduce user-facing behavior warrant human review. You can customize Macroscope's approvability policy. Learn more. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
5f92245 to
0ff572eCompareUh oh!
There was an error while loading. Please reload this page.
366d6e0 to
ea5b4d2CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
dce0c11 to
72afbcaCompare…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…l worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
fbee701 to
5985491CompareThere was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5985491. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
301ea5a to
b8aa507Compare…ocal worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
…ocal worktree placement) # Conflicts: # apps/server/src/serverSettings.test.ts
t3dotgg
commented
Aug 28, 2026
Note 🤖 GPT-5.6 Sol responding on behalf of Theo We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together. Configurable worktree placement changes path ownership, cleanup, revival, and collision behavior. That risk is too large for a location preference while #4742 is handling worktree inventory and cleanup. If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed. |

What Changed
worktreePathTemplateserver setting.{worktreesDir},{repoRoot},{repoName}, and{branch}when creating worktrees.{worktreesDir}/{repoName}/{branch}as the default, preserving the existing centralized layout.Why
Some users keep worktrees alongside each repository, while others prefer T3 Code's centralized worktree directory. A configurable template supports both layouts without changing existing behavior.
For example,
{repoRoot}/.worktrees/{branch}creates repository-local worktrees.UI Changes
The General settings panel now exposes the worktree path template and documents its available variables. Browser verification covered the default value, persisting a repository-local template, and resetting to the default.
These current screenshots were recaptured from PR head
366d6e021814242392c778d49fd195397a8cbf11in the combined package0.0.29-patched-main-20260724(integration4dd4cef4039303179929a1dbdbf0c9b358c076f9).Checklist
pnpm exec vp test run packages/contracts/src/settings.test.ts apps/server/src/serverSettings.test.ts apps/server/src/vcs/GitVcsDriverCore.test.ts apps/server/src/server.test.ts -t 'bootstraps first-send worktree turns|ServerSettings worktree path template|ServerSettingsPatch string normalization|server settings|uses the configured repository-local worktree path template|keeps the centralized worktree path as the default'(21 passed)pnpm exec vp test run apps/server/src/review/ReviewService.test.ts apps/server/src/vcs/GitVcsDriverCore.test.ts(40 passed)vp checkfor the final review-fix files (no warnings)pnpm exec vp check(passes with 12 pre-existing warnings in untouched files)pnpm --filter t3 typecheckpnpm --filter @t3tools/contracts typecheckpnpm exec vp run typecheck(workspace baseline fails in untouched web/mobile files: existing implicit-anyandunknown AtomRegistryerrors; the affected server and contracts package checks pass)Note
Medium Risk
Touches worktree creation, review path sandboxing, and persisted settings across Git/VCS/WS layers; default template preserves prior behavior but misconfigured templates or template-matching edge cases could block previews or place worktrees unexpectedly.
Overview
Adds a persisted
worktreePathTemplateserver setting (default{worktreesDir}/{repoName}/{branch}) with a General settings field to edit and reset it.Worktree creation no longer hardcodes the centralized layout:
GitVcsDriverCore.createWorktreeresolves paths via newresolveWorktreePathTemplate/matchesWorktreePathTemplatehelpers, and bootstrap, VCS RPC, and PR-thread flows pass the setting (with fallback on read failure).Review diff preview widens allowed
cwdvalues: besides the workspace and legacy worktrees dir, paths under persisted thread worktrees or paths matching the template against active project repo roots are accepted. The WS handler loadsgetActiveProjectWorkspaceRootsandgetActiveThreadWorktreePathsfrom projection SQL (without shell snapshot hydration) and forwards them toReviewService.Reviewed by Cursor Bugbot for commit b8aa507. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Make worktree placement configurable via a path template setting
worktreePathTemplatefield toServerSettings(default:{worktreesDir}/{repoName}/{branch}) with UI controls in the General settings panel to view, edit, and reset it.GitVcsDriverCore.createWorktreeandGitWorkflowService.createWorktreenow accept an optionalpathTemplateand resolve the worktree path by expanding template placeholders ({worktreesDir},{repoRoot},{repoName},{branch}) instead of using a hardcoded path join.resolveWorktreePathTemplateandmatchesWorktreePathTemplateutilities in worktreePathTemplate.ts handle expansion and pattern matching against candidate paths.ReviewService.getDiffPreviewnow accepts optionalrepositoryRootsandknownWorktreePaths; workspace boundary validation allows cwds inside known worktree paths or matching the configured template against any provided repository root.ProjectionSnapshotQuerygainsgetActiveProjectWorkspaceRootsandgetActiveThreadWorktreePathsmethods, which the WS RPC layer uses to supply these paths to the review service.createWorktreemay now fail earlier with aGitCommandErrorif repository root canonicalization fails when no explicit path is given.Macroscope summarized b8aa507.