Skip to content

Worktree chats survive a branch named like the prefix - #85

Open
ShriD5 wants to merge 2 commits into
mainfrom
t3-watch/2026-11-01-worktree-branch-parent-ref
Open

ShriD5 wants to merge 2 commits into
mainfrom
t3-watch/2026-11-01-worktree-branch-parent-ref

Conversation

@ShriD5

@ShriD5 ShriD5 commented Nov 1, 2026

Copy link
Copy Markdown
Owner

What T3 added (pingdotgg/t3code@1917c8a33a): worktree threads still get their generated branch when the repo has a plain branch named t3. Git stores branches as paths, so refs/heads/t3 blocks every t3/... branch. T3 flattens such names to a sibling (t3-fix) and treats a branch nested under a candidate name as taken.

Godspeed had the same bug. If a repo has a local branch named godspeed (or whatever the branch prefix is minus its slash), git worktree add -b godspeed/<name> fails with "cannot lock ref", so no worktree chat can start in that repo.

How Godspeed does it now (crates/engine/src/repos.rs):

  • free_branch_name(desired, locals) returns the name to create: flattened (godspeed-quiet-fox) when a parent path is a local branch, or None when the name or a branch nested under it is taken, so the name loop tries another.
  • create_worktree_with_branch reads the local branches once (for-each-ref refs/heads) and picks the name and branch together. It still checks remote-stripped names as before.
  • rename_worktree_branch (title rename) uses the same check. A flattened branch renames to godspeed-<title-slug> because the prefix comes from the branch minus the folder name.

Also updates the T3-WATCH ledger (reviewed through t3code@8760d063e9) and T3-GAPS.

Tests

  • New: branches_blocked_by_a_parent_or_nested_ref_get_a_free_name (unit test) and a_branch_named_like_the_prefix_does_not_block_worktrees (real git: creates a worktree with a godspeed branch present, then renames it after a title).
  • cargo build -p godspeed ✅, cargo check --workspace --tests ✅, cargo test -p zeron-engine lib: 788 passed ✅.
  • Integration failures that also fail on main without this change: git_actions_gh pull_requests_and_publishing_go_through_gh (an extra api graphql gh call) and local_first local_runtime_checks_public_releases_without_starting_edge_links / online_runtime_shutdown_... (loopback/network). device_routing failed once under load and passed when rerun alone.

What to check by eye: in a repo, run git branch godspeed, then start a chat with a new worktree. It should start on godspeed-<adjective>-<noun>, and after the first title it should be renamed to godspeed-<title>. Screenshots not available (engine-only change).

🤖 Generated with Claude Code

Git stores branches as paths, so a plain `godspeed` branch blocks every
`godspeed/<name>` branch and worktree chats failed to start in that repo.
Such names now flatten to a sibling (`godspeed-<name>`), and a branch
nested under a candidate name counts as taken, for both creation and the
title rename.

Inspired by: pingdotgg/t3code@1917c8a33a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant