openai / openai/codex

VS Code extension underreports diff line counts when files are edited through exec_command

Open
#46,296 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug extension
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What version of the IDE extension are you using?

Codex version 26.908.40401

What subscription do you have?

Plus

Which IDE are you using?

VS Code

What platform is your computer?

Darwin 25.6.0 arm64 arm

What issue are you seeing?

When Codex modifies a tracked file through a Python command executed with exec_command, the Codex diff summary can substantially underreport the number of changed lines.
In my case, Codex replaced a large section of a Markdown file using Python’s Path.write_text(). The Codex interface reported only 11 lines removed, while Git reported 542 deletions and 244 additions in that file.
The resulting file and Git diff were correct. The problem was specifically the change count presented by Codex.
This is concerning because the displayed summary can make a large rewrite appear to be a small edit, potentially leading users to review or approve a much larger change than expected.

What steps can reproduce the bug?
  1. Open a Git repository in VS Code with the Codex extension.
  2. Start with a tracked text or Markdown file containing several hundred lines.
  3. Ask Codex to replace a large section of that file.
  4. Have the agent perform the edit through exec_command, using a command similar to:
    from pathlib import Path

path = Path("example.md")
content = path.read_text()
path.write_text(modified_content)
5. Review the line-change count displayed by the Codex interface
6. Compare it with Git:
git diff --numstat -- example.md
git diff --shortstat -- example.md

What is the expected behavior?

Expected behaviour for my example in Codex diff:
1 file changed, 244 insertions(+), 542 deletions(-)
Behaviour I saw:
1 file changed, 42 insertions(+), 11 deletions(-1)

Additional information

I found a potentially similar report involving the Windows Codex app, but this reproduction occurred in the macOS VS Code extension. I am filing it separately because the affected client and operating system differ, though the underlying change-tracking issue may be shared.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the VS Code extension's exec_command and diff-summary change-tracking entry points, then reproduce the report with Path.write_text() on a large tracked Markdown file. Compare the displayed counts with git diff --numstat and git diff --shortstat; done means the extension reports the full insertions and deletions for the rewrite.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.