fix(worktrees): remove t3code branch prefix - #9275
meik1998dev wants to merge 1 commit into
Conversation
| .replace(/[^0-9a-f]/g, "") | ||
| .slice(0, 8); | ||
| return `${WORKTREE_BRANCH_PREFIX}/${token}`; | ||
| return token; |
There was a problem hiding this comment.
🟠 High src/git.ts:104
buildTemporaryWorktreeBranchName returns an unnamespaced eight-hex branch name, so a token matching an existing user branch makes the bootstrap worktree creation fail: createWorktree passes it to git worktree add -b, which refuses the existing ref instead of retrying. Restore the t3code/ namespace to keep generated names separate from ordinary user branches.
| return token; | |
| return `${WORKTREE_BRANCH_PREFIX}/${token}`; |
🤖 Copy this AI Prompt to have your agent fix this:
In file @packages/shared/src/git.ts around line 104:
`buildTemporaryWorktreeBranchName` returns an unnamespaced eight-hex branch name, so a token matching an existing user branch makes the bootstrap worktree creation fail: `createWorktree` passes it to `git worktree add -b`, which refuses the existing ref instead of retrying. Restore the `t3code/` namespace to keep generated names separate from ordinary user branches.
| // eligible for branch regeneration. | ||
| const TEMP_WORKTREE_BRANCH_PATTERN = new RegExp( | ||
| `^${WORKTREE_BRANCH_PREFIX}\\/(?:[0-9a-f]{8}|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$`, | ||
| `^(?:[0-9a-f]{8}|${WORKTREE_BRANCH_PREFIX}\\/(?:[0-9a-f]{8}|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}))$`, |
There was a problem hiding this comment.
🟡 Medium src/git.ts:19
isTemporaryWorktreeBranch classifies any local branch named exactly eight hexadecimal characters as temporary, so a normal branch such as deadbeef is renamed by maybeGenerateAndRenameWorktreeBranchForFirstTurn on the first user message. Restrict the matcher to the generated branch prefix so user-owned branches are not changed.
| `^(?:[0-9a-f]{8}|${WORKTREE_BRANCH_PREFIX}\\/(?:[0-9a-f]{8}|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}))$`, | |
| `^${WORKTREE_BRANCH_PREFIX}\\/(?:[0-9a-f]{8}|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$`, |
🤖 Copy this AI Prompt to have your agent fix this:
In file @packages/shared/src/git.ts around line 19:
`isTemporaryWorktreeBranch` classifies any local branch named exactly eight hexadecimal characters as temporary, so a normal branch such as `deadbeef` is renamed by `maybeGenerateAndRenameWorktreeBranchForFirstTurn` on the first user message. Restrict the matcher to the generated branch prefix so user-owned branches are not changed.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This changes the default branch names created for worktree threads and broadens temporary-branch detection across server and client consumers. Removing the namespace can collide with user branches or cause ordinary branches to be treated as temporary during automatic renaming, so the behavioral impact warrants human review. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
|
Note 🤖 GPT-6 Astra (preview) responding on behalf of Theo This was closed as part of an automated cleanup pass. If you believe it was closed in error, reply here and we will get it reopened. Closing this alternative in favor of #8082, which allows an empty final branch prefix without changing temporary-branch detection. This patch also treats every eight-character hexadecimal branch as temporary, so a user branch such as |
New worktrees start on branches such as
t3code/aa34ff6b, and generated names keep the same product prefix. This exposes an unnecessary T3 Code namespace in user repositories.Generate temporary branches as bare eight-character hashes and keep generated semantic names unprefixed. Legacy
t3code/<hash>and UUID branch names remain recognized so existing threads can still rename their branches.Tests:
vp test run packages/shared/src/git.test.ts apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts(65 passed)vp run --filter @t3tools/shared --filter t3 typecheckImplemented with gpt-5.6-sol in the Codex harness.
Note
Remove
t3codeprefix from temporary worktree branch namesbuildTemporaryWorktreeBranchNamein git.ts andbuildGeneratedWorktreeBranchNamein ProviderCommandReactor.ts now return the bare sanitized eight-hex token instead of prepending the legacy worktree branch prefixTEMP_WORKTREE_BRANCH_PATTERNexpanded to match bare eight-hex refs as the canonical form while still accepting legacy prefixed eight-hex and prefixed UUID formsisTemporaryWorktreeBranchnow classifies bare eight-hex branch refs as temporary; normalization and legacy matching behavior are otherwise unchangedt3code-prefixed branch names are still recognized byisTemporaryWorktreeBranch, but all newly generated branches use the unprefixed form📊 Macroscope summarized 8a6b6e6. 2 files reviewed, 2 issues evaluated, 0 issues filtered, 2 comments posted
🗂️ Filtered Issues
Note
Medium Risk
Changes how new git branches appear in customer repositories and relies on legacy regex matching for migration; misclassification could skip or mishandle branch rename on first turn.
Overview
New worktree and generated branch names no longer use the
t3code/prefix in user repos. Temporary branches are created as bare 8-character hex refs (e.g.1234abcd), and LLM-driven renames keep only the sanitized fragment (e.g.feature/gpt-5-6-luna) instead of nesting undert3code/.Shared git helpers (
buildTemporaryWorktreeBranchName,isTemporaryWorktreeBranch) treat unprefixed 8-hex as canonical while still recognizing legacyt3code/<8-hex>andt3code/<uuid>so existing threads can be detected and renamed on first turn. Tests were updated for unprefixed temps and explicitrenameBranchexpectations.Reviewed by Cursor Bugbot for commit 8a6b6e6. Bugbot is set up for automated code reviews on this repo. Configure here.