Skip to content

fix: preserve configurable worktree branch prefixes#1498

Open
nassimna wants to merge 6 commits intopingdotgg:mainfrom
nassimna:fix/worktree-branch-prefix
Open

fix: preserve configurable worktree branch prefixes#1498
nassimna wants to merge 6 commits intopingdotgg:mainfrom
nassimna:fix/worktree-branch-prefix

Conversation

@nassimna
Copy link
Copy Markdown
Contributor

@nassimna nassimna commented Mar 28, 2026

What Changed

  • Added a configurable worktreeBranchPrefix setting.
  • Used that prefix when creating temporary worktree branches.
  • Preserved the prefix during server-side generated branch renames.
  • Added schema, migration, and test coverage for the new setting.

Why

  • Users with a non-t3code branch namespace should not have generated worktree renames rewritten back to t3code/....
  • This keeps branch naming predictable across settings, worktree creation, retries, and rename handling.

UI Changes

  • This adds a visible settings control for the worktree branch prefix.
    WhatsApp Image 2026-03-28 at 6 27 06 AM
    WhatsApp Image 2026-03-28 at 8 52 05 PM

Verification

  • bun fmt
  • bun lint
  • bun typecheck

Note

Medium Risk
Touches branch-name generation/detection and server-side git rename behavior; a regex or prefix-handling mistake could rename the wrong branch or break worktree flows for some users, but changes are localized and covered by tests.

Overview
Ensures worktree branch naming is prefix-configurable end-to-end: a new worktreeBranchPrefix client setting (validated/normalized via WorktreeBranchPrefix, defaulting to t3code) is introduced and migrated from legacy local settings.

Temporary worktree branches are now created as ${prefix}/worktree-<8hex> instead of a hardcoded t3code/<8hex>, and server-side first-turn rename logic now detects only these marked temp branches (case-insensitive) and preserves the existing prefix when generating the final branch name. Adds UI control + validation for editing the prefix and expands test coverage for temp-branch detection and rename behavior.

Written by Cursor Bugbot for commit a9fed1c. This will update automatically on new commits. Configure here.

Note

Preserve configurable worktree branch prefixes when renaming and creating branches

  • Adds a worktreeBranchPrefix field to ClientSettingsSchema (default t3code) with a WorktreeBranchPrefix schema for validation and normalization in settings.ts.
  • Exposes a UI control in SettingsPanels.tsx so users can view, edit, and reset their worktree branch prefix.
  • Updates ChatView.logic.ts and ChatView.tsx to pass the configured prefix into buildTemporaryWorktreeBranchName, producing branches in the form <prefix>/worktree-<8hex>.
  • Updates ProviderCommandReactor.ts to extract the prefix from the existing branch and pass it to buildGeneratedWorktreeBranchName on rename, so the namespace is preserved across the rename.
  • Behavioral Change: temporary and renamed worktree branches now include a /worktree- marker segment; existing branches without this marker will not match the new TEMP_WORKTREE_BRANCH_PATTERN and won't be renamed.

Macroscope summarized a9fed1c.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

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

Run ID: edbcf335-09ca-4e26-bb46-f5d2b123b090

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

❤️ Share

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

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 28, 2026
@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Mar 28, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

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

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant