Skip to content

Codex environment lacks proper git refs, causing large PRs with unchanged files #9952

@dinobitx

Description

@dinobitx

What version of Codex is running?

Codex cloud environment (via ChatGPT UI), no local Codex CLI

What subscription do you have?

ChatGPT Plus (using Codex via ChatGPT UI)

Which model were you using?

Codex default model (via ChatGPT UI)

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What terminal emulator and version are you using (if applicable)?

Codex built-in cloud terminal (Ubuntu-based container)

What issue are you seeing?

When using Codex environments for incremental development on a real, long-lived repository, the environment appears to operate on a snapshot-like git state without proper refs or tracking branches (e.g. missing local main).

Because of this, the agent cannot reliably compute diffs against the existing codebase. As a result, many incremental changes produce pull requests where a large number of files (30–40+) appear as newly created, even though they already exist and were not meaningfully changed.

This makes PRs noisy, increases review cost, and significantly increases credit usage when working iteratively on the same project.

What steps can reproduce the bug?

  1. Create or use an existing long-lived repository with multiple incremental changes.
  2. Open the repository in a Codex cloud environment via the ChatGPT UI.
  3. Ask Codex to implement a small change (e.g. add a button, wire a use case).
  4. Let Codex generate a pull request.
  5. Observe the “Files changed” section showing dozens of files marked as new or fully rewritten, even when they were not modified.

This happens consistently across multiple tasks in the same repository.

What is the expected behavior?

Codex should be able to diff against the existing repository state (e.g. the main branch or other tracked refs) and produce pull requests that include only the actual, intentional changes made for the task.

Additional information

I investigated this further and noticed that the Codex environment seems to lack a full git ref graph (no tracking branches like origin/main). Network access is available during setup/maintenance phases but not during interactive sessions, which prevents proper ref reconciliation (e.g. git fetch).

This suggests the environment may be initialized as a snapshot rather than a full clone, which works for short tasks but breaks incremental development workflows.

Happy to provide a minimal reproduction repository or additional details if helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcodex-webIssues related to Codex Web

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions