-
Notifications
You must be signed in to change notification settings - Fork 682
Description
Summary
New worktree branches are currently created under a hardcoded t3code/... namespace, even when the active repository is not named t3code.
Problem
This makes branch names and derived worktree paths misleading in multi-repo usage. For example, creating a new worktree in another repository can still produce a branch like t3code/1a2b3c4d, which looks like it belongs to this app rather than the actual repository the user is working in.
Current behavior
- The initial temporary worktree branch is created with a hardcoded
t3code/<8-hex>prefix. - After the first turn, generated human-readable branch names are also forced back under the
t3code/...namespace. - This leaks the app name into repository-specific git state and worktree folder names.
Expected behavior
- New worktree branch names should be based on the actual repository name, or use no prefix at all.
- Temporary branch detection should continue to work reliably for the first-turn rename flow.
- Generated branch names should stay consistent with whatever namespace rule we choose.
Why this matters
- Reduces confusing branch names across different repositories.
- Keeps git state aligned with the repo the user is actually editing.
- Avoids app-specific naming leaking into worktree management and downstream tooling.
Likely code areas
apps/web/src/components/ChatView.tsxapps/server/src/orchestration/Layers/ProviderCommandReactor.tspackages/shared/src/git.ts
Acceptance criteria
- No hardcoded
t3codeworktree branch prefix remains in the worktree creation / rename flow. - The temporary branch created for a new worktree uses a repository-derived namespace, or no namespace if that is the chosen design.
- The server-side first-turn rename flow uses the same naming rule as the initial branch creation flow.
- Temporary-branch detection still works for the rename path.
- Relevant tests cover the naming and detection behavior.
Prompt to solve
Refactor worktree branch naming so it is derived from the active repository instead of a hardcoded t3code prefix. Centralize the naming logic in shared git utilities, update the web-side worktree creation flow and the server-side first-turn branch rename flow to use the same helper, preserve reliable temporary branch detection, and add focused tests for namespace derivation, temporary branch generation, and generated branch renaming.