Windows Undo still fails with "patch with only garbage at line 4" even after enabling undo=true

Resolved 💬 1 comment Opened Jun 25, 2026 by zkl904 Closed Jun 25, 2026

Summary

On Windows, Codex Desktop's Undo/Revert action still fails for a simple one-line edit to an existing tracked text file. The dialog reports:

无法还原更改
Git 应用错误: error: patch with only garbage at line 4

This happens even after explicitly enabling the undo feature in both user and project Codex config files and restarting Codex.

Environment

  • OS: Windows
  • Shell: PowerShell
  • Repo: private Git repository
  • Codex app: current Windows desktop build
  • Git: core.autocrlf=true from global Git config
  • Project has no .gitattributes
  • .codex/config.toml contains:

``toml
[features]
undo = true
``

  • C:\Users\23233\.codex\config.toml also contains:

``toml
[features]
undo = true
``

Repro steps

  1. Open a trusted local Codex thread in a Windows Git repo.
  2. Ask Codex to add a single ASCII line to an existing tracked file, for example:

``js
console.log('test-data')
``

  1. Confirm the file shows only a one-line diff.
  2. Click the Undo/Revert button in the Codex UI.

Actual result

The undo flow fails with:

error: patch with only garbage at line 4

The file remains modified.

Expected result

Codex should revert the single-line change cleanly, or show a concrete actionable conflict state.

Notes

  • I first reproduced the issue with a Chinese log line, but then repeated it with pure ASCII to rule out encoding problems.
  • The failure persisted after restarting Codex, so this does not appear to be a stale-session-only issue.
  • The repository itself is clean except for the one Codex edit.
  • This looks related to, but is not identical to, existing reports:
  • #28506
  • #25048
  • #15367

If needed, I can provide a minimal diff, screenshots, and the exact local config values from the machine.

View original on GitHub ↗

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