Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- In any repository, create a leftover config lock:
touch .git/config.lock. In practice this comes from Claude Code's Linux sandbox, which leaves an empty, read-only<main>/.git/config.lockbehind (anthropics/claude-code#78818). - Start a new thread in a new worktree so T3 renames the temporary
t3/<id>branch.
Plain git reproduction (git 2.53.0):
$ git branch a && touch .git/config.lock
$ git branch -m -- a b
error: could not lock config file .git/config
fatal: branch is renamed, but update of config-file failed
$ echo $?
128 # refs/heads/b exists, refs/heads/a is gone
Expected behavior
- The failure is classified as
config_locked, so the rename gets the same retry and wording as other config writes. - When git prints
branch is renamed, but update of config-file failed, T3 treats the rename as done (the ref has moved) and warns only that the branch's config entries weren't moved.
Actual behavior
- T3 says:
Could not rename the worktree branch, so it stays t3/79b8b4f0. … git branch rename failed. The reflog shows the rename happened in the same second:Branch: renamed refs/heads/t3/79b8b4f0 to refs/heads/t3/default-macros. - The failure gets no
reason.classifyGitFailurematches/could not lock config file .+: File exists/i, but this git path prints the message without: File exists. The 135 bytes of stderr in the trace match the two lines above exactly. So no retry happens, and git's error text never reaches the user. - Any
branch.<old>.*entries (upstream,t3-merge-base,gh-merge-base) stay under the old branch name.
Impact
Every new worktree thread shows a false error for as long as the lock exists. In this case that was two weeks, because the sandbox's leftover file never got removed. Even when the lock is only briefly held by another process, the renamed branch loses its upstream and base records without any warning. #25700 found this half-done rename but only made T3's own git commands wait for each other, so locks held by other processes still hit it.
Version or commit
0.1.11
Environment
Linux, git 2.53.0, Claude Code agents with the bubblewrap sandbox
Logs or stack traces
GitCommandError { operation: "GitVcsDriver.renameBranch", exitCode: 128,
stderrLength: 135, detail: "git branch rename failed" } // no reason
Workaround
Delete the leftover .git/config.lock.
Related: #11735 / #11773 (same lock, but at worktree creation), #25700, #40251 (classifier falls back to a fixed message), anthropics/claude-code#78818
Made with Claude Opus 5.5 in Claude Code (T3 Code).
Activity
fix(server): a worktree branch rename no longer reports failure after…