Repository navigation
Description
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 [email protected]
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 [email protected]
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/mainBefore 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/mainAfter 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.
Activity
thisislvca commentedon Jul 8, 2026
Small clarification / update after more testing: Codex Desktop already has a Review -> Refresh action, but that action does not appear to refresh the remote/base ref used by the diff counter.
Current behavior I’m seeing:
main -> origin/main.refs/remotes/origin/mainis stale.git fetch origin mainmanually updates localorigin/main, after which the counter updates correctly.So I think the issue is narrower than my original wording: this is not just a missing refresh affordance. The existing Refresh action appears to refresh local app/git query state, but not the remote-tracking ref that the counter depends on.
From a user perspective, the counter reads like “diff against current
origin/main”, but in practice it is “diff against whatever localorigin/mainhappened to be the last time something fetched it.” That distinction is surprising in the Review UI because the base label is remote-looking and there is already a Refresh action nearby.A reasonable expected behavior would be one of:
git.autofetchplusgit.autofetchPeriodand, when enabled, periodically runsgit fetchwhile the repo is idle/focused.The smallest product fix might be: when the user explicitly clicks Review -> Refresh, run a bounded fetch of only the selected/current base ref, then recompute the remote diff counter. That avoids surprising background network behavior while making the visible Refresh action do what users likely expect in this Review context.
CJavierSaldana commentedon Nov 3, 2026
We encountered a closely matching stale-
origin/maincounter incident in a new Codex Cloud task.Observed in a newly created Codex Cloud task, viewed through the desktop app. Repository identifiers, commit hashes, source files, screenshots, task IDs, and session links are intentionally omitted.
Timeline and read-only findings (all timestamps UTC):
mainon GitHub, verified separately through the GitHub API. That main commit was dated 2026-10-31 13:28:46 UTC.origin/mainstill pointed to an older commit; its reflog entry was dated 2026-10-21 09:16:56 UTC.origin/mainwith HEAD yielded 773 files, +67,167 / -11,756, across 64 existing commits. Those commits were already present on the live GitHub main. This accounts for almost the entire displayed counter.Relevant official documentation:
Using Codex Cloud, says a new task gets a separate workspace and “does not recover another task’s uncommitted changes”.
Cloud environments, under “Reuse and update saved state,” explains that new tasks start from the published environment's prepared filesystem, while existing tasks continue with their own saved files. This describes isolated workspaces based on reusable setup; it does not promise a completely fresh Git clone for every task.
To be precise, we have not established that uncommitted files leaked between independent tasks. The verified finding is stale Git comparison metadata in a fresh cloud task. The resulting counter makes already-published history look like a large set of changes associated with the new task.
Expected behavior: initialize or refresh the relevant remote-tracking comparison reference when preparing a new cloud task, or clearly identify an outdated comparison base and separate that historical diff from actual working-tree changes.
This also relates to the misleading Changes-counter experience reported in #42775. We have not run a fetch as part of this investigation, so we are not claiming that workaround has been verified in our environment.