feat(git): allow custom worktree branch prefixes - #6037
filipgutica wants to merge 4 commits into
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:
Comment |
b76b537 to
7ec07a7
Compare
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a cross-cutting worktree branch-prefix capability spanning settings, web/mobile creation flows, shared Git logic, and server-side rename and drift handling. An unresolved comment also identifies a settings-failure path that can leave branch metadata stale and affect PR attribution. You can add or adjust custom eligibility rules. Learn more. |
There was a problem hiding this comment.
One finding on the new worktree branch prefix settings row: the validation message renders in the row's default muted status tone, so it reads like ordinary help text even though the input is flagged aria-invalid.
Posted via Macroscope — UI Consistency
ba43d16 to
cec345a
Compare
There was a problem hiding this comment.
UI consistency review of the web changes. One finding on the new General settings row placement; the earlier validation-status color note is resolved in this revision.
Posted via Macroscope — UI Consistency
| } | ||
| /> | ||
|
|
||
| <SettingsRow |
There was a problem hiding this comment.
This row is inserted between the new-threads row and the row that is visually nested under it. start-from-origin is rendered as a dependent sub-row of New threads (className="bg-muted/20 sm:pl-9", and SETTINGS_SEARCH_ITEMS points it back with targetId: "new-threads"), so when the default mode is worktree the indented, muted row now sits directly under Worktree branch prefix and reads as its child instead of a child of New threads.
Consider moving this row below the conditional start-from-origin block (and the matching SETTINGS_SEARCH_ITEMS entry after start-from-origin) so the parent/child indentation keeps pointing at the setting it modifies.
Posted via Macroscope — UI Consistency
There 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.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cec345a. Configure here.
| ); | ||
| if (settings === null) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Settings failure skips branch drift
Medium Severity
A failed getSettings read now returns from followWorktreeBranchDrift before any checkout adoption. That path previously followed non-temporary branch changes without settings. Transient settings errors can leave thread branch metadata stale and orphan PR attribution, including when the checkout is a normal branch that does not need the prefix.
Reviewed by Cursor Bugbot for commit cec345a. Configure here.
|
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. This adds configurable worktree branch prefixes through contracts, server behavior, web settings, and mobile settings. We are not adding this new worktree naming option through the current backlog. If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed. |


Summary
I've been using t3code a lot, I love it, great work! I found this one limitation I keep running into. I love having new threads spawn a new worktree, however, I'd love it if we could specify the branch prefix so I don't have to manually change it (or have the agent to do it) every time.
Allow users to choose the branch prefix for new worktrees instead of always using
t3code/.Changes
worktreeBranchPrefixsetting to General Settings.t3codebranches.Note
Add configurable
worktreeBranchPrefixtoServerSettingsand thread it through worktree branch generationWorktreeBranchPrefixschema in settings.ts with defaultt3code, enforcing trim, lowercase, max length 64, and regex^[a-z0-9][a-z0-9_-]*$buildTemporaryWorktreeBranchNameandisTemporaryWorktreeBranchin git.ts to accept an optional prefix;isTemporaryWorktreeBranchmatches both configured and legacy UUID-shaped temporary branchesisTemporaryWorktreeBranchin git.ts now matches both the configured prefix and legacyt3code/UUID patterns; callers that previously assumed only the default prefix must pass the configured prefix or detection may misclassify branchesMacroscope summarized cec345a.
Note
Medium Risk
Changes thread worktree branch naming and server-side rename/drift logic across web, mobile, and orchestration; misconfiguration or prefix changes can leave older custom-prefix temporaries unmatched.
Overview
Adds a per-server
worktreeBranchPrefixsetting (defaultt3code) so new worktree threads can use a custom branch namespace instead of hard-codedt3code/.Settings & contracts:
WorktreeBranchPrefixis validated in server settings; General Settings gets an editable field with reset/search support, and user docs describe behavior (including that changing the prefix does not rename existing branches).Clients: Web
ChatView, mobile new-task creation, and the mobile outbox drain pass the environment’s prefix into thread bootstrap. Mobile centralizes temporary branch naming inbuildProjectThreadStartTurnInput(replacing pre-builtworktreeBranchName).Git helpers:
buildTemporaryWorktreeBranchNameandisTemporaryWorktreeBranchtake an optional prefix; matching still treats legacyt3codeplaceholders as temporary when a custom prefix is configured.Server:
ProviderCommandReactorbuilds semantic rename targets under the configured prefix and strips duplicate prefixes from generated names.CheckpointReactorand clientresolveLiveThreadBranchUpdateuse the prefix so drift/reconciliation does not adopt or regress onto temporary placeholder checkouts.Reviewed by Cursor Bugbot for commit cec345a. Bugbot is set up for automated code reviews on this repo. Configure here.