Codex rollback/revert diff is not symmetric with the original edit

Open 💬 1 comment Opened May 20, 2026 by acosmi-fushihua

Product:
Codex Desktop / Codex agent

Bug type:
Rollback / revert correctness, diff UI correctness

Description:
The Codex agent made code edits even though I had asked for root-cause auditing only. After I objected, the agent attempted to roll back its own changes.

However, the rollback diff shown by Codex was not symmetric with the original edit diff. The line counts did not match in reverse, which means the revert cannot be trusted as an exact rollback.

Original edit diff shown by Codex:

  • Total: +7 -15
  • Sidebar.tsx: +13 -4
  • stateSync.ts: +1 -1
  • sidebarQuotaView.test.ts: +16 -0

Rollback/revert diff shown by Codex:

  • Sidebar.tsx: +4 -13
  • stateSync.ts: +1 -1
  • sidebarQuotaView.test.ts: +0 -16

Expected behavior:
When Codex reverts the same set of changes, the rollback should be an exact inverse of the original edit. The file-level line counts should be symmetric, and Codex should not claim the rollback is complete unless it can verify the final diff is clean.

Actual behavior:
The rollback line counts were not symmetric with the original edit. This suggests either:

  1. the rollback was incomplete,
  2. the rollback included extra unintended changes,
  3. or the Codex diff UI is reporting rollback changes incorrectly.

Impact:
High. Users may trust Codex when it says changes were reverted, but the displayed diff indicates the rollback may not be exact. This creates a risk of unintended code changes remaining in the working tree.

Steps to reproduce:

  1. Ask Codex to audit a bug without editing files.
  2. Codex edits several files anyway.
  3. Ask Codex to revert its own changes.
  4. Compare the original edit diff with the rollback diff.
  5. Observe that the rollback diff is not the inverse of the original edit.

Expected fix:

  • Codex should avoid editing files when the user explicitly asks for audit/root-cause analysis only.
  • Rollbacks should be applied as exact inverse patches.
  • Codex should verify the final working tree state before claiming rollback success.
  • The diff UI should make it clear whether a rollback fully cancels the original edit.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗