Skip to content

feat(git): let users choose the worktree branch prefix - #8082

Open
t3dotgg wants to merge 2 commits into
mainfrom
t3code/custom-worktree-prefix
Open

feat(git): let users choose the worktree branch prefix#8082
t3dotgg wants to merge 2 commits into
mainfrom
t3code/custom-worktree-prefix

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Aug 24, 2026

Copy link
Copy Markdown
Member

Generated worktree branches always start with t3code/, which conflicts with personal and team branch conventions.

Add a server-owned Worktree branch prefix setting under Settings > General. It defaults to t3code, accepts validated custom prefixes, and can be cleared to create branches without a prefix. Temporary branches stay unchanged, and the server applies the prefix when it generates the final branch name for web, desktop, mobile, and remote clients.

Inspired by and with thanks to:

Verified with 116 focused tests, targeted lint, and scoped typechecks for contracts, shared, client runtime, server, web, and mobile.

Model: GPT-5.6 Sol
Harness: Codex in T3 Code


Note

Medium Risk
Touches git branch naming and persisted server settings. Invalid prefixes are schema-validated, but misconfigured prefixes still change how worktrees are renamed for all clients.

Overview
Users can now set a Worktree branch prefix in Settings > General. Generated worktree names still default to t3code/…, but a custom prefix (including nested paths like teams/platform) is applied server-side, and clearing the field creates unprefixed branches.

buildGeneratedWorktreeBranchName strips a leftover t3code/ from the model output when it is not the configured prefix, then sanitizes the remainder. Temporary worktree branches are unchanged.

The new worktreeBranchPrefix setting is validated (lowercase, max 64, no // or leading/trailing separators) and wired through dirty/reset/search plus user docs.

Reviewed by Cursor Bugbot for commit 5e5ed3f. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add configurable worktreeBranchPrefix setting defaulting to t3code

  • Adds a worktreeBranchPrefix field to ServerSettings, defaulting to t3code and validated by the new WorktreeBranchPrefix schema (max 64 chars, lowercase alphanumerics, no adjacent slashes).
  • Updates buildGeneratedWorktreeBranchName in ProviderCommandReactor.ts to accept a prefix argument and sanitize it via sanitizeBranchFragment.
  • Adds a UI control in the General Settings panel to edit the prefix, with settings search indexing and restore-defaults support.
  • Behavioral Change: buildGeneratedWorktreeBranchName now requires a prefix parameter; existing callers must be updated.

Macroscope summarized 5e5ed3f.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bd599c0a-8952-4a17-8434-437982ab0bd6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 24, 2026
@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.4 KiB 13.4 KiB +6 B (+0.0%) 15.1 KiB
Codex Thread snapshot wire 6.9 KiB 6.9 KiB +2 B (+0.0%) 7.3 KiB
Codex Live turn WebSocket wire 6.5 KiB 6.5 KiB +4 B (+0.1%) 7.8 KiB
Codex Live turn WebSocket decoded 55.0 KiB 55.0 KiB 0 B (0.0%) 66.4 KiB
Codex Live turn messages 16 16 0 (0.0%) 21
Claude Total thread wire 13.5 KiB 13.4 KiB −29 B (−0.2%) 15.1 KiB
Claude Thread snapshot wire 6.9 KiB 6.9 KiB −1 B (−0.0%) 7.3 KiB
Claude Live turn WebSocket wire 6.6 KiB 6.5 KiB −28 B (−0.4%) 7.8 KiB
Claude Live turn WebSocket decoded 55.8 KiB 55.8 KiB 0 B (0.0%) 66.4 KiB
Claude Live turn messages 16 16 0 (0.0%) 21

Baseline: e6a109b · PR result: 5e5ed3f · Source CI: success

Scenario and decoded snapshot size

10 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.

  • Codex decoded thread snapshot: 109.4 KiB
  • Claude decoded thread snapshot: 110.1 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e2c3e50. Configure here.

Comment thread apps/server/src/orchestration/Layers/ProviderCommandReactor.ts
@macroscopeapp

macroscopeapp Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds a new settings workflow and changes how generated worktree branches are renamed, including persisted server configuration and custom Git prefixes. The scope is focused and backwards-compatible, but the user-visible Git behavior warrants human review.

You can add or adjust custom eligibility rules. Learn more.

@MrSimmmons

Copy link
Copy Markdown

For my example of #6428, do you have thoughts on allowing full branch name customization at worktree creation rather than just the prefix instead?
The way that my teams works is we use the prefix of the branch to indicate the type of branch (so bug/..., feat/... etc) and just allowing the customization of it wouldn't really work for that use case.
Otherwise I don't really see the a use for the prefix of a branch?

Where as if you gave people the option to just fully customize the branch name on worktree creation, they can then have whatever they want and everyone wins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants