codex - 💡(How to fix) Fix [BUG] Undo/redo often fails in native Windows environment when apply_patch edits are tracked as full-file rewrites [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19943Fetched 2026-04-29 06:25:00
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×4

Fix Action

Fix / Workaround

On the Codex Windows app running in the native Windows environment, undo / redo is unreliable and often fails after file edits made via apply_patch.

Example of an append patch: (reported by gpt after apply_patch)

*** Begin Patch
*** Update File: hellohello.txt
@@
 hello
 line2
 line3
+line4
+line5
*** End Patch

Code Example

*** Begin Patch
*** Update File: hellohello.txt
@@
 hello
 line2
 line3
+line4
+line5
*** End Patch

---

*** Begin Patch
*** Update File: hellohello.txt
@@
 hello
+line2
+line3
*** End Patch

---

hello

---

*** Begin Patch
*** Update File: hellohello.txt
@@
 hello
 line2
 line3
+line4
+line5
*** End Patch
RAW_BUFFERClick to expand / collapse

What version of the Codex App are you using (From “About Codex” dialog)?

codex 26.422.30944

What subscription do you have?

GPT pro (with GPT 5.4)

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What issue are you seeing?

On the Codex Windows app running in the native Windows environment, undo / redo is unreliable and often fails after file edits made via apply_patch.

The problem appears related to how the app records file changes. In some cases, an edit that should be tracked as a simple append is instead recorded as a full-file replacement.

Example of an append patch: (reported by gpt after apply_patch)

*** Begin Patch
*** Update File: hellohello.txt
@@
 hello
 line2
 line3
+line4
+line5
*** End Patch

Expected diff shape after this patch is -0 +2, but Codex sometimes shows it as -3 +5, as if the entire previous file was deleted and rewritten. When this happens, undo / redo fails at a very high rate.

There is a similar inconsistency with smaller edits such as( reported by gpt after apply_patch):

*** Begin Patch
*** Update File: hellohello.txt
@@
 hello
+line2
+line3
*** End Patch

After this patch, Codex sometimes shows -1 +3, and sometimes -0 +2. In the -0 +2 case, undo / redo usually works normally. In the -1 +3 case, it is much more likely to fail.

The same workflows behave much more normally in WSL. Since Codex appears to rely on system Git for file change tracking, this may be related to differences in Git behavior on native Windows versus WSL.

What steps can reproduce the bug?

  1. Run Codex in the native Windows environment, not WSL.
  2. Tell Codex to create a file such as hello.txt with initial content:
    hello
  3. Tell Codex to append several lines to the file.
  4. Check how Codex displays the resulting diff for the file.
  5. Try using undo and redo.

Observed behavior:

  • Sometimes the diff is shown as a normal append like -0 +2.
  • Sometimes the same kind of change is shown as delete-and-rewrite, such as -3 +5 or -1 +3.
  • When the change is recorded as delete-and-rewrite, undo / redo frequently fails.

Control comparison:

  1. Repeat the same workflow in WSL.
  2. The diff and undo / redo behavior are much more stable there.

What is the expected behavior?

apply_patch appends should be tracked as minimal line additions when the surrounding file content is unchanged.

For example, this patch:

*** Begin Patch
*** Update File: hellohello.txt
@@
 hello
 line2
 line3
+line4
+line5
*** End Patch

should be represented as -0 +2, not as a full-file rewrite like -3 +5.

Undo and redo should work reliably after these edits in the native Windows environment, with behavior matching WSL.

Additional information

No response

extent analysis

TL;DR

The issue with unreliable undo and redo functionality in the Codex App on native Windows may be related to inconsistent file change tracking, potentially due to differences in Git behavior between Windows and WSL.

Guidance

  • Investigate the Git configuration and version used by Codex on native Windows to identify potential differences with WSL.
  • Verify that the apply_patch functionality is correctly generating patches and that the issue is not with the patch application itself.
  • Compare the file system and line ending settings between native Windows and WSL to ensure consistency.
  • Test the undo and redo functionality with different types of edits (e.g., insertions, deletions, modifications) to see if the issue is specific to certain types of changes.

Example

No code snippet is provided as the issue seems to be related to the underlying Git behavior and file system interactions.

Notes

The issue may be specific to the combination of Codex App version (26.422.30944), GPT version (5.4), and Windows version (10.0.19045.0 x64). Further investigation is needed to determine the root cause.

Recommendation

Apply a workaround by using WSL for critical editing tasks until the issue is resolved, as the behavior is reported to be more stable in that environment. This is due to the observed consistency in WSL, which may indicate a platform-specific issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix [BUG] Undo/redo often fails in native Windows environment when apply_patch edits are tracked as full-file rewrites [1 participants]