Codex Desktop remote diff counter stays stale until manual git fetch updates origin/main
What version of the Codex App are you using?
Codex Desktop 26.623.141536 (build 4753)
CLI also installed: codex-cli 0.142.5
What subscription do you have?
ChatGPT Pro
What platform is your computer?
macOS 15.7.7 (24G720), arm64
What issue are you seeing?
Codex Desktop's remote/base diff counter appears to be computed from the local remote-tracking ref, for example origin/main.
If the upstream branch moves on GitHub but the local refs/remotes/origin/main ref has not been refreshed yet, the counter can stay stale. Running git fetch origin main manually updates the local origin/main ref, and then the Codex UI counter updates.
The confusing part is that the UI reads like it is comparing the current branch against the current remote branch, but the observed behavior matches a comparison against the locally cached origin/main ref.
What steps can reproduce the bug?
A minimal Git-level repro of the stale ref state:
rm -rf /tmp/codex-origin-counter-repro
mkdir -p /tmp/codex-origin-counter-repro
cd /tmp/codex-origin-counter-repro
git init --bare remote.git
git clone remote.git clone-a
cd clone-a
git config user.email repro@example.com
git config user.name Repro
printf 'one\n' > file.txt
git add file.txt
git commit -m 'initial'
git branch -M main
git push -u origin main
cd ..
git clone remote.git clone-b
cd clone-b
git checkout main
git config user.email repro@example.com
git config user.name Repro
printf 'two\n' >> file.txt
git commit -am 'advance remote'
git push origin main
cd ../clone-a
git rev-parse --short HEAD
git rev-parse --short origin/main
git ls-remote origin refs/heads/main | cut -f1 | cut -c1-7
git rev-list --left-right --count HEAD...origin/main
Before fetching, clone-a reports HEAD == origin/main and rev-list reports 0 0, even though git ls-remote shows that the live remote branch has advanced.
Then:
git fetch --quiet origin main
git rev-parse --short origin/main
git rev-list --left-right --count HEAD...origin/main
After the fetch, the local origin/main ref updates and the ahead/behind/diff state changes.
In Codex Desktop, this same stale-ref state shows up as the line/diff counter not updating until a manual git fetch is run in the repository.
What is the expected behavior?
For UI that represents a comparison against the remote branch, Codex should either:
- Refresh the relevant upstream remote-tracking ref before computing the counter, or
- Clearly label the value as based on the locally cached
origin/mainref and provide a refresh/fetch action.
A conservative implementation could check the configured upstream branch and fetch just that ref before computing the remote diff.
What actually happened?
The counter stayed stale until I manually ran git fetch. Once the local origin/main ref changed, the counter updated.
Additional information
I checked the packaged Codex Desktop binary and found strings pointing at the app-server git processor path and local git commands used for this area:
app-server/src/request_processors/git_processor.rs
failed to compute git diff to remote for cwd:
rev-list
merge-base
for-each-ref
symbolic-ref
branch --show-current
I did not find evidence in that packaged binary inspection that this git processor path runs git fetch before computing the remote diff.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗