Skip to content

Codex App environment UI does not refresh after a detached worktree is switched onto a branch #30955

Description

@dpearson2699

What version of the Codex App are you using (From “About Codex” dialog)?

26.623.81905 (4598)

What subscription do you have?

Not available from this agent/tool context; the user can edit this field if needed.

What platform is your computer?

Darwin 25.5.0 arm64 arm

Git version: git version 2.54.0

What issue are you seeing?

In a Codex App worktree session that starts detached, manually switching the worktree onto a branch in the terminal succeeds, and subsequent agent/terminal commands report the correct branch. However, the Codex App Environment UI can remain stale and continue presenting detached-worktree actions/state such as Create branch.

In the tested session, the first branch check reported detached HEAD:

Current branch: detached HEAD (no branch)
Current commit: 75dd6a93b400478703c37e451dddf5de7154d948

Then the terminal workaround was run:

git -C /Users/dpearson/.codex/worktrees/f153/ios-options-wheel-tracker switch codex/full-sync-gate-state

Git then reported the correct named branch:

## codex/full-sync-gate-state...origin/codex/full-sync-gate-state
codex/full-sync-gate-state

A follow-up in the Codex thread also reported:

I'm on codex/full-sync-gate-state, tracking origin/codex/full-sync-gate-state.

Despite that, the Environment UI still appeared to show stale worktree/detached state and offered Create branch instead of reflecting the branch-attached state.

What steps can reproduce the bug?

  1. Create or open a Codex App worktree session that is in detached HEAD.
  2. Verify the detached state:
git status --short --branch
git symbolic-ref --short -q HEAD || echo HEAD

Example output:

## HEAD (no branch)
HEAD
  1. From the terminal inside the same worktree, switch onto a branch that is not checked out by another worktree:
git switch codex/full-sync-gate-state
  1. Verify Git is now branch-attached:
git status --short --branch
git branch --show-current

Example output:

## codex/full-sync-gate-state...origin/codex/full-sync-gate-state
codex/full-sync-gate-state
  1. Ask the Codex thread what branch it is on; it reports the named branch.
  2. Open the Codex App Environment menu / upper-left worktree UI.
  3. Observe that the UI still reflects the earlier detached state or offers actions intended for detached HEAD, such as Create branch.

What is the expected behavior?

The Environment UI should refresh when the active worktree's .git/HEAD changes, or provide a manual refresh action. After git switch <branch> succeeds, the UI should show the named branch and branch-appropriate actions.

Additional information

This is related to #10704 and #30954, but it is a separate UI refresh/staleness problem. #30954 covers worktree creation semantics. This issue covers the UI not reflecting a successful branch switch inside an existing Codex worktree.

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appbugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions