git-branch statusline does not refresh after external git checkout

Open 💬 1 comment Opened Jul 2, 2026 by PuWenyin

What version of Codex CLI is running?

codex-cli 0.142.5

What platform is your computer?

macOS 26.5.1 (Build 25F80), Ghostty terminal

What issue are you seeing?

The git-branch item in the Codex CLI statusline can become stale after the branch is changed outside of Codex, for example from another terminal with git switch <branch>.

The footer continues to show the previous branch until another Codex lifecycle event happens. This makes the statusline unreliable as a live indicator of the current repository branch.

Steps to reproduce

  1. Configure the statusline to include git-branch, for example:

``toml
[tui]
status_line = ["model-with-reasoning", "project-name", "git-branch", "status"]
``

  1. Start codex inside a Git repository on branch main.
  2. In another terminal, run:

``bash
git switch some-other-branch
``

  1. Return to the Codex TUI and observe the statusline.

Expected behavior

The git-branch statusline item should refresh when the current Git branch changes, or at least refresh on a predictable interval / focus / turn boundary so it does not keep showing stale branch information.

Actual behavior

The statusline can continue showing the old branch after an external checkout.

Additional context

From a quick look at the current implementation, git-branch appears to be looked up through git branch --show-current and cached by cwd. Refresh seems to happen mainly when the status surface is initialized, cwd changes, or certain turn lifecycle events call request_status_line_branch_refresh().

There does not appear to be a filesystem/ref watcher or periodic refresh for .git/HEAD changes. This means branch changes made outside Codex are not reflected immediately.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗