Worktree session only shows 'Hand off to local' (missing 'Sync to local' / 'Create branch here') when detached HEAD

Open 💬 5 comments Opened Feb 5, 2026 by hwb96

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

  1. Start a Codex desktop app conversation from a repo on main.
  2. Use/enter a local git worktree for the conversation.
  3. Ensure the worktree is in detached HEAD (git branch --show-current returns empty).
  4. 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" />

View original on GitHub ↗

5 Comments

hwb96 · 6 months ago

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.

younes-io · 6 months ago

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" />

MattGibney · 6 months ago
I have also have the same issue.. <img alt="Image" width="815" height="217" src="https://private-user-images.githubusercontent.com/3153107/546716427-c41e9a40-ba7f-4f48-8e6d-fc7321ce507b.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzA3MzEyNjQsIm5iZiI6MTc3MDczMDk2NCwicGF0aCI6Ii8zMTUzMTA3LzU0NjcxNjQyNy1jNDFlOWE0MC1iYTdmLTRmNDgtOGU2ZC1mYzczMjFjZTUwN2IucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDIxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjAyMTBUMTM0MjQ0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9M2RhNWFkZGQyNzliNzM5NWI2NGM2NDViYzFiOTRjMDQyYWY0NmRkZTU5ZWQ5ZjBjYTUyM2VjYmQ1NTVkNzhlOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.yS4WmNRg9M-7hKexA4UjqfoCWOiWBY0e7AdneAixo4U">

Same here, but that work around is valid. So thanks!

dpearson2699 · 1 month ago

I reproduced what looks like the same failure mode with a local branch selected as the Codex App worktree starting point.

Environment:

  • Platform: Darwin 25.5.0 arm64 arm
  • Git: git version 2.54.0
  • Codex App worktree mode
  • Selected starting branch: codex/full-sync-gate-state

Reproduction details:

  1. A Codex-managed worktree already had local branch codex/full-sync-gate-state checked out at commit 75dd6a93.
  2. Creating another Codex worktree from that branch produced a detached worktree at 75dd6a93, which was expected while another worktree still owned the branch.
  3. I then removed the old branch-owning worktree, confirmed no listed worktree had codex/full-sync-gate-state checked out, and created a fresh Codex worktree again with codex/full-sync-gate-state selected as the starting branch.
  4. The new Codex worktree still materialized detached at the branch tip instead of attached to the named branch.

Observed result from the new worktree:

## HEAD (no branch)
HEAD
75dd6a93b400478703c37e451dddf5de7154d948

The git worktree list --porcelain entry for the new Codex worktree was also detached:

worktree <CODEX_WORKTREE>
HEAD 75dd6a93b400478703c37e451dddf5de7154d948
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.

dpearson2699 · 1 month ago

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.

  • New issue for branch selection creating a detached worktree: #30954
  • New issue for the Environment UI not refreshing after git switch <branch> succeeds: #30955

This issue (#10704) still seems relevant for the detached-state action/menu behavior itself.