feat: make worktree branch prefix configurable
What Changed
- Added a persisted
worktreeBranchPrefixsetting witht3codeas the default. - Added a "Branch prefix" field below "Start from origin" when new threads use worktrees.
- Applied the configured prefix to temporary worktree branches and preserved it during the first-turn branch rename.
- Centralized branch construction and detection in shared git utilities, with focused contract, utility, and reactor tests.
Why
New worktrees currently force every generated branch into the t3code/ namespace. That leaks the tool name into repository state and conflicts with teams that require their own branch naming conventions.
This implements the smallest useful scope requested in #3651: one persisted prefix setting that covers both temporary branch creation and the generated branch rename. It also addresses the configurable-prefix path discussed in #272.
Closes #3651 Related to #272
UI Changes
Before:
Note: taken from the app.
After:
Note: taken from the dev server launched in the Codex browser, so minor other differences from the app screenshot above.
Testing
vp checkvp run typecheckvp test packages/contracts/src/settings.test.ts packages/shared/src/git.test.ts apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts apps/web/src/components/GitActionsControl.logic.test.ts(121 tests)vp run --filter @t3tools/desktop ensure:electronvp run build:desktop
Checklist
- [x] This PR is small and focused
- [x] I explained what changed and why
- [x] I included before/after screenshots for the UI change
- [x] A video is not applicable because the change does not depend on animation or interaction timing
Co-authored-by: Codex [email protected]
[!NOTE]
Make worktree branch prefix configurable across git branch naming and reconciliation
- Adds
worktreeBranchPrefix(defaultt3code) toServerSettingsin settings.ts with validation; exposes it in the settings UI via SettingsPanels.tsx.- Updates
isTemporaryWorktreeBranch,buildTemporaryWorktreeBranchName, andbuildGeneratedWorktreeBranchNamein git.ts to accept a prefix parameter, scoping temporary branch detection to the configured namespace.- Updates
resolveLiveThreadBranchUpdatein both GitActionsControl.logic.ts and gitActions.ts to pass the configured prefix, preventing semantic branches from being overwritten by temporary branches outside that namespace.- Behavioral Change: branches with an eight-hex suffix that fall outside the configured prefix are no longer treated as temporary worktree branches.
Macroscope summarized beabf35.
[!NOTE] Medium Risk Changes git branch naming and metadata sync paths that can rename branches and update thread refs; behavior is covered by tests but mistakes could mis-label branches or skip renames.
Overview Adds a persisted
worktreeBranchPrefixserver setting (defaultt3code, validated in contracts) and a Branch prefix control in settings when new threads default to worktrees.Temporary and generated worktree branches now use the configured prefix via shared git helpers (
normalizeWorktreeBranchPrefix, prefix-awarebuildTemporaryWorktreeBranchName/buildGeneratedWorktreeBranchName, andextractTemporaryWorktreeBranchPrefixwith legacyt3codefallback). ChatView passes the setting when preparing a worktree; ProviderCommandReactor keeps that prefix on the first-turn rename instead of always rewriting undert3code/.Live thread branch sync (
resolveLiveThreadBranchUpdatein web and client-runtime) takesworktreeBranchPrefixso semantic branch names are not overwritten by temporary refs, while still allowing temp → semantic upgrades and reconciling unrelated eight-hex ref names.Reviewed by Cursor Bugbot for commit beabf35dd89e45cd3632dcbca6a97ef855c6eccf. Bugbot is set up for automated code reviews on this repo. Configure here.
[!IMPORTANT]
Review skipped
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
25ef049b-c7a0-4c32-8328-9729c56461cdYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- [ ] 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
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 @coderabbitai help to get the list of available commands.
Approvability
Verdict: Skipped
Macroscope did not run approvability analysis for this PR. Macroscope could not determine whether this PR modifies its approvability configuration, so the PR was not approved automatically. A PR that may change the rules that govern approval is never approved automatically.
Not approved because:
- 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity
please merge this, the name t3code forced everywhere is annoying
Was just looking into this myself, I also hope this gets merged. @jssblck please fix conflicts to get this ready to merge
Nice, someone has already done it, hopefully this gets merged soon
I'm hoping we get this merged or something similar soon. I really want to use t3code for some work stuff but the repos we work in use very specific branch prefixes, so the t3code branches don't work for me right now.
I am also upping this
should be closed in favor of https://github.com/pingdotgg/t3code/pull/8082
closed in favor of #8082