Skip to content

fix: preserve configurable worktree branch prefixes#1498

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

fix: preserve configurable worktree branch prefixes#1498
nassimna wants to merge 7 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 worktree branch naming and server-side rename detection; mistakes could cause missed renames or incorrect git branch names for new threads.

Overview
Adds a new client setting worktreeBranchPrefix (default t3code) with validation (WorktreeBranchPrefix) and migration support, plus a Settings UI control to edit/reset it.

Changes temporary worktree branches from <prefix>/<8hex> to <prefix>/worktree-<8hex> and updates the server rename logic to only target this marked pattern, preserving the existing branch prefix (including mixed case and digit-prefixed namespaces) when renaming to an LLM-generated branch name.

Extends test coverage in ProviderCommandReactor.test.ts and contracts/settings.test.ts to lock in prefix preservation and ensure ordinary user branches aren’t mistakenly renamed.

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

Note

Preserve configurable worktree branch prefixes when creating and renaming branches

  • Adds a worktreeBranchPrefix setting to ClientSettingsSchema (default t3code) with validation via WorktreeBranchPrefix schema; invalid values are corrected on decode and rejected on encode.
  • Temporary worktree branches are now named <prefix>/worktree-<8hex> using the configured prefix instead of a fixed t3code/<8hex>.
  • When renaming a temporary branch, buildGeneratedWorktreeBranchName now extracts and preserves the original prefix (including case) rather than forcing a hard-coded value.
  • Detection of temporary worktree branches uses a case-insensitive regex requiring the explicit worktree- marker, so ordinary user branches (e.g. feature/deadbeef) are no longer mistakenly renamed.
  • Adds a UI input in the General Settings panel to view, validate, and persist the prefix; empty input resets to default.
  • Legacy persisted settings with a worktreeBranchPrefix string are migrated into the new validated structure.

Macroscope summarized 2c6133f.

@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: 94786626-4f89-4271-9fd5-064c33ab991c

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.

# Conflicts:
#	apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts
#	apps/server/src/orchestration/Layers/ProviderCommandReactor.ts
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