Windows desktop: Discard changes fails with "patch with only garbage" for thread diff

Resolved 💬 1 comment Opened May 24, 2026 by Mr-J-Forest Closed May 24, 2026

Summary

In the Codex Windows desktop app, clicking Discard/Revert changes for a local thread fails every time with:

Git application error: error: patch with only garbage at line 4

Environment

  • Codex desktop app: 26.519.3891.0 (Microsoft Store package)
  • Bundled Codex CLI: 0.133.0-alpha.1
  • OS: Windows 11, x64 (10.0.26200)
  • Git: 2.51.0.windows.2

Reproduction

  1. Work in a local repository in a Codex desktop thread.
  2. The repository has a merge commit in its recent history and the thread has reviewable changes.
  3. Click the Codex UI action to discard/revert the thread changes.
  4. A dialog reports error: patch with only garbage at line 4 and no changes are reverted.

Desktop log evidence

The desktop log records the failing operation as a reverse apply of a generated thread-diff patch (paths redacted):

[git] git.command.complete command="git -c core.hooksPath=NUL -c core.fsmonitor=false apply -R --3way '<TEMP>\codex-apply-...\patch.diff'" exitCode=128 failureReason=command_failed requestKind=apply-patch source=thread_diff stderrBytes=41

Diagnosis performed

  • The repository itself is valid and Git operations work normally.
  • Running an equivalent reverse git apply --check -R --3way against a regular unified diff generated by Git succeeds.
  • The failure only occurs through the Codex desktop discard/revert action using its generated thread_diff patch.
  • The working tree contains CRLF files and a small number of mixed-EOL files, but a Git-generated patch still parses and reverse-applies correctly.

This suggests the desktop app is emitting a malformed patch for thread_diff on Windows, possibly in combination with merge history and/or line-ending normalization.

Expected behavior

Discarding thread changes should reverse-apply the displayed diff or provide a recoverable conflict result, rather than producing an invalid patch parse error.

View original on GitHub ↗

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