Codex App shows phantom branch when remote default branch contains a slash
What version of the Codex App are you using (From "About Codex" dialog)?
26.623.81905 (4598)
What subscription do you have?
Pro
What platform is your computer?
Darwin 24.6.0 arm64 arm
What issue are you seeing?
Codex App shows a phantom branch in the branch selector when the repository's remote default branch contains a slash.
In this repo, the real default/current branch is:
personal/local-clients
But Codex App shows both:
personal/local-clients
local-clients
local-clients is not a real local or remote branch. It appears to be derived incorrectly from the remote HEAD ref by taking only the last path segment.
Git evidence from the affected repo:
git rev-parse --abbrev-ref HEAD
# personal/local-clients
git symbolic-ref --quiet refs/remotes/origin/HEAD
# refs/remotes/origin/personal/local-clients
git remote show origin
# HEAD branch: personal/local-clients
git for-each-ref refs/heads '--format=%(refname:short)'
# personal/local-clients
These refs do not exist:
git rev-parse --verify refs/heads/local-clients
# fatal: Needed a single revision
git rev-parse --verify refs/remotes/origin/local-clients
# fatal: Needed a single revision
So the local-clients entry is a Codex App UI/generated branch entry, not a Git branch.
I also inspected the packaged Codex App source for the installed app. In the packaged worker bundle, the locally-known default branch resolver appears to run:
git symbolic-ref --quiet refs/remotes/${remote}/HEAD
and then parse stdout like this:
let r = stdout.split("/");
return r[r.length - 1] ?? null;
For this repository, stdout is:
refs/remotes/origin/personal/local-clients
That parsing returns:
local-clients
but the correct remote default branch is:
personal/local-clients
The parser should remove the refs/remotes/${remote}/ prefix, or use git symbolic-ref --short refs/remotes/${remote}/HEAD and then remove the ${remote}/ prefix. Taking only the final slash-delimited segment loses valid branch path components.
What steps can reproduce the bug?
- Create or use a GitHub repository whose default branch contains a slash, for example:
personal/local-clients
- Clone the repository locally and ensure
origin/HEADpoints to that branch:
git symbolic-ref --quiet refs/remotes/origin/HEAD
# refs/remotes/origin/personal/local-clients
- Open the repository in Codex App.
- Open the branch selector / starting branch selector.
- Observe that Codex App lists both the real branch and a phantom basename-only branch:
personal/local-clients
local-clients
- Verify that
local-clientsis not a real branch:
git show-ref | grep local-clients
# only refs/heads/personal/local-clients
# only refs/remotes/origin/personal/local-clients
What is the expected behavior?
Codex App should show only the real branch:
personal/local-clients
It should not synthesize or display:
local-clients
Branch names containing / are valid Git branch names and should be preserved when resolving the remote default branch.
Additional information
This looks related to default branch resolution, not general Git state. The current branch, recent branches, and Git refs are correct. The incorrect entry appears to come from parsing refs/remotes/origin/HEAD by splitting on / and taking the final segment.
This only reproduces when the remote default branch name itself contains /, so repos using simple default branch names like main or master would not expose the bug.