t3code icon indicating copy to clipboard operation
t3code copied to clipboard

feat: make worktree branch prefix configurable

Open jssblck opened this issue 4 months ago • 6 comments

What Changed

  • Added a persisted worktreeBranchPrefix setting with t3code as 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.

image

After:

Note: taken from the dev server launched in the Codex browser, so minor other differences from the app screenshot above.

image image

Testing

  • vp check
  • vp run typecheck
  • vp 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:electron
  • vp 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 (default t3code) to ServerSettings in settings.ts with validation; exposes it in the settings UI via SettingsPanels.tsx.
  • Updates isTemporaryWorktreeBranch, buildTemporaryWorktreeBranchName, and buildGeneratedWorktreeBranchName in git.ts to accept a prefix parameter, scoping temporary branch detection to the configured namespace.
  • Updates resolveLiveThreadBranchUpdate in 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 worktreeBranchPrefix server setting (default t3code, 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-aware buildTemporaryWorktreeBranchName / buildGeneratedWorktreeBranchName, and extractTemporaryWorktreeBranchPrefix with legacy t3code fallback). ChatView passes the setting when preparing a worktree; ProviderCommandReactor keeps that prefix on the first-turn rename instead of always rewriting under t3code/.

Live thread branch sync (resolveLiveThreadBranchUpdate in web and client-runtime) takes worktreeBranchPrefix so 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.

jssblck avatar Jul 14 '26 00:07 jssblck

[!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: 25ef049b-c7a0-4c32-8328-9729c56461cd

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.

coderabbitai[bot] avatar Jul 14 '26 00:07 coderabbitai[bot]

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

macroscopeapp[bot] avatar Jul 14 '26 01:07 macroscopeapp[bot]

please merge this, the name t3code forced everywhere is annoying

a3ylf avatar Jul 18 '26 00:07 a3ylf

Was just looking into this myself, I also hope this gets merged. @jssblck please fix conflicts to get this ready to merge

jetpham avatar Jul 22 '26 06:07 jetpham

Nice, someone has already done it, hopefully this gets merged soon

gabeburnett avatar Jul 29 '26 07:07 gabeburnett

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.

kevhardy avatar Aug 04 '26 07:08 kevhardy

I am also upping this

jetpham avatar Aug 14 '26 20:08 jetpham

should be closed in favor of https://github.com/pingdotgg/t3code/pull/8082

jetpham avatar Aug 25 '26 03:08 jetpham

closed in favor of #8082

jssblck avatar Aug 27 '26 03:08 jssblck