Skip to content

Codex App shows phantom branch when remote default branch contains a slash #30940

Description

@makoMakoGo

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?

  1. Create or use a GitHub repository whose default branch contains a slash, for example:
personal/local-clients
  1. Clone the repository locally and ensure origin/HEAD points to that branch:
git symbolic-ref --quiet refs/remotes/origin/HEAD
# refs/remotes/origin/personal/local-clients
  1. Open the repository in Codex App.

  2. Open the branch selector / starting branch selector.

  3. Observe that Codex App lists both the real branch and a phantom basename-only branch:

personal/local-clients
local-clients
  1. Verify that local-clients is 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.

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