Worktree session only shows 'Hand off to local' (missing 'Sync to local' / 'Create branch here') when detached HEAD
Summary
In a Codex desktop app worktree session, the UI only shows Hand off to local and does not show Sync to local or Create branch here. This happens when the session is already a local git worktree but is in detached HEAD. It’s unclear whether this is expected or a UI bug, but it’s confusing for users who start from main and expect to attach/create a branch.
Steps to Reproduce
- Start a Codex desktop app conversation from a repo on main.
- Use/enter a local git worktree for the conversation.
- Ensure the worktree is in detached HEAD (git branch --show-current returns empty).
- Observe the worktree UI actions.
Expected
Show Create branch here (or an explicit action to attach the worktree to a branch), or indicate why it’s hidden in detached HEAD state.
Actual
Only Hand off to local is shown.
Environment
- Codex Desktop App version: 260204.1342 (CFBundleVersion 531)
- macOS: 26.2 (Build 25C56)
- Repo state: local git worktree, detached HEAD
- git branch --show-current: (empty)
- git rev-parse --short HEAD: 5b637aa
Notes
I will add screenshots in a follow-up comment.
<img width="1083" height="315" alt="Image" src="https://github.com/user-attachments/assets/d206bfdc-fd3a-4ad8-bbf5-a3d448455632" />
<img width="1414" height="1025" alt="Image" src="https://github.com/user-attachments/assets/504648bf-ff78-4f71-85dc-e11613257b61" />
<img width="404" height="92" alt="Image" src="https://github.com/user-attachments/assets/ecf33948-121e-4fb7-b150-3e48089e8249" />
5 Comments
Additional detail: this worktree session was created via the Branches picker (selected main under Branches), i.e. starting from main in the UI. Even in that path, the session ends up in detached HEAD and the UI only shows Hand off to local.
I have also have the same issue..
<img width="815" height="217" alt="Image" src="https://github.com/user-attachments/assets/c41e9a40-ba7f-4f48-8e6d-fc7321ce507b" />
Same here, but that work around is valid. So thanks!
I reproduced what looks like the same failure mode with a local branch selected as the Codex App worktree starting point.
Environment:
Darwin 25.5.0 arm64 armgit version 2.54.0codex/full-sync-gate-stateReproduction details:
codex/full-sync-gate-statechecked out at commit75dd6a93.75dd6a93, which was expected while another worktree still owned the branch.codex/full-sync-gate-statechecked out, and created a fresh Codex worktree again withcodex/full-sync-gate-stateselected as the starting branch.Observed result from the new worktree:
The
git worktree list --porcelainentry for the new Codex worktree was also detached:So this does not appear to be only Git refusing duplicate branch checkout. Even after freeing the branch, Codex still created the worktree as detached HEAD at the selected branch tip.
Expected behavior: when the user selects a local branch as the starting branch and that branch is not checked out by another worktree, Codex should either check out that named branch in the new worktree or clearly label the UI/control as “start from branch commit detached” rather than implying the new worktree will be on the branch.
Follow-up to my earlier comment: I split the branch-starting-worktree behavior into a separate issue because it is better tracked as a creation-semantics bug rather than only this detached-state UI-actions issue.
git switch <branch>succeeds: #30955This issue (#10704) still seems relevant for the detached-state action/menu behavior itself.