Skip to content

Undo does not work #3567

Closed
Closed

Description

@Polinarium

What version of the VS Code extension are you using?

0.4.6

Which IDE are you using?

VS Code

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What steps can reproduce the bug?

  1. Ask codex in full agent mode to make a change to file
  2. It makes a change a shows a diff window in chat
  3. Click Undo at the top of the diff window
  4. Green notification comes up showing changes reverted message but changes are not reverted in the file

What is the expected behavior?

The changes shown in the diff window that were applied to file should be undone/reverted.

What do you see instead?

The green message box with "Changes reverted" but the file still shows the updated content that was not reverted. Opening closing file does not make a difference.

Image

Additional information

Tried several times between software restarts - the same issue persists.
Agent does not offer any insight or report any issue, says its a bug in the UI and offered to revert the changes himself.

Activity

  1. added
    extension
    on Sep 14, 2025
  2. setyanzxc123 commented on Sep 15, 2025

    @setyanzxc123

    +1 even on pre-released version 0.58 still doesn't work

  3. gpeal commented on Sep 15, 2025

    @gpeal
    Contributor

    The diff view you're on won't update if you click revert but should check the underlying file. Can you confirm if that works?

    @setyanzxc123 are you seeing the green toast or is it red?

    For both of you, is your code in a git repo?

  4. josh000111 commented on Sep 17, 2025

    @josh000111

    Im having a similar issue on version 0.4.10 of the vscode extension using gpt-5 codex. But when i click 'undo' i get a red pop-up messages that says "Failed to revert changes". And the diff window remains open with the changes in it;

    Image
  5. gpeal commented on Sep 17, 2025

    @gpeal
    Contributor

    @josh000111 Is your code in a git repo?

  6. setyanzxc123 commented on Sep 17, 2025

    @setyanzxc123

    The diff view you're on won't update if you click revert but should check the underlying file. Can you confirm if that works?

    @setyanzxc123 are you seeing the green toast or is it red?

    For both of you, is your code in a git repo?

    Currently I'm on 0.5.11 pre-release version, the behavior is different here, on git repo it shows green toast and if I check on file it worked, but on non git repo it shows red toast

  7. setyanzxc123 commented on Sep 17, 2025

    @setyanzxc123

    The diff view you're on won't update if you click revert but should check the underlying file. Can you confirm if that works?

    @setyanzxc123 are you seeing the green toast or is it red?

    For both of you, is your code in a git repo?

    Currently I'm on 0.5.11 pre-release version, the behavior is different here, on git repo it shows green toast and if I check on file it worked, but on non git repo it shows red toast

    Thats happen on gpt-5 model, but now I use model gpt-5-codex and it seems undo and changes feature not implement yet

  8. josh000111 commented on Sep 18, 2025

    @josh000111

    @josh000111 Is your code in a git repo?

    Yes. (by the way im using gpt-5 codex).

  9. Polinarium commented on Sep 18, 2025

    @Polinarium
    Author

    The diff view you're on won't update if you click revert but should check the underlying file. Can you confirm if that works?

    @setyanzxc123 are you seeing the green toast or is it red?

    For both of you, is your code in a git repo?

    Locally hosted code. Opened the file itself to check not just diff and no changes are not reverted. The toast is green.

  10. maxiedaniels commented on Sep 18, 2025

    @maxiedaniels

    This happened to me too, except something even more bizarre happened where I tried to undo, first time it didn't work, and then later I noticed at some point it had staged a change. Also one of the files I was working with wasn't saving and I couldn't figure wait why, and suddenly VSCode showed an error that a file has been changed since I opened it.

    All very bizarre because usually any LLM coding agent I've used (including codex CLI, at least as of a few weeks ago) just makes changes to the local source which shows up instantly in all open files AND in source control.

  11. gpeal commented on Sep 18, 2025

    @gpeal
    Contributor

    I'm hearing two separate things here:

    1. Undo not working outside of a git repo. We're working on improvements to that so stay tuned.
    2. Apply and undo behaving in unexpected ways when you have an open editor for that file, especially if it has unsaved changes of its own. The underlying issue here is that the extension uses the Codex CLI (this repo) to make changes rather than going through the editor. We'll also explore some options here. I think we can do better than we are today. For now, if the x on your tab is a circle and you think Codex may have touched that file, close the tab and discard your changes so it can pick up the filesystem changes.
  12. maxiedaniels commented on Sep 18, 2025

    @maxiedaniels

    @gpeal I was working within my git repo on Vscode, plugin was in local mode, and undo wasn't working.

    Regarding your second point, i was using the Codex CLI for a few weeks before this latest new model and plugin setup, and I never had this issue... I always saw my files updated in realtime as Codex worked on them, and I never had the CLI try to stage anything.

  13. gpeal commented on Sep 18, 2025

    @gpeal
    Contributor

    @maxiedaniels At the moment, undo works by:

    1. Staging the files it needs to revert
    2. Using git to revert the files

    We're going to be exploring some changes to revert that will hopefully remove this though. Fingers crossed.

  14. TakiGuan commented on Sep 30, 2025

    @TakiGuan

    Same issue here +1

  15. SijaanX commented on Oct 8, 2025

    @SijaanX

    Same issue here.

    My code is from a github repo.

  16. 36 remaining items

  17. zba commented on Feb 7, 2026

    @zba

    It seems degraded today, all my undo stopped worked after update

  18. iamhectorlopez commented on Feb 19, 2026

    @iamhectorlopez

    after a looong time... this issues seems to be fixed on my end.

  19. adampieroni commented on Feb 20, 2026

    @adampieroni

    Codex fixed this for me! :)

    Root cause identified and fixed.

    • In Codex.log, Codex was failing git calls with: git --no-optional-locks ... and Unknown option: --no-optional-locks.
    • Your VS Code session was resolving git to old /usr/local/bin/git (2.13.1), which breaks Codex revert/undo.
    • I fixed resolution by creating: /opt/homebrew/bin/git -> /usr/bin/git (2.50.1), which supports that flag.

    I also added a fresh test change in notes.md:

    • Undo test after git fix.

    Please click Undo/Revert on that change now.
    If it still fails, run Developer: Reload Window once and retry, then I’ll inspect the newest log entries immediately.

  20. Enferlain commented on Mar 16, 2026

    @Enferlain

    in my case it was vscode not launching in wsl mode when running wsl code . in powershell. works after switching vscode to wsl or launching with wsl then code . from the project folder

  21. alanscandrett commented on Apr 8, 2026

    @alanscandrett

    Encountered this in our team, 3 different developers with the same issue.
    No resolution, none of the above advice worked.

  22. drawenadmin commented on Apr 15, 2026

    @drawenadmin

    Possible FIX:

    I updated codex and ran into this issue myself. Previously it worked with older version, new codex version broke it.

    If you are using it inside VS Code my fix was that even though codex was configured in its settings to run in WSL mode it ran in windows directly.

    I had to install the WSL extension inside VS Code (Ctrl+shift+X), then i reopened the folder in WSL (F1 - > Type: WSL: Reopen Folder in WSL) and then i had to install the codex extension (even though i had it outside the WSL mode).

    After this i tested and the undo button worked again at the shown diffs. Hope this helps those who encounter it.

  23. ForteDexe commented on May 13, 2026

    @ForteDexe

    almost half a year, still can't undo

  24. hitem commented on May 18, 2026

    @hitem

    same issue here. none of the above things resolved it. (windows)

  25. walkthroughspace commented on Jun 8, 2026

    @walkthroughspace

    this is still broken lmao, claude's undo works perfectly. how has this still not been fixed a year later? seems like such an easy feature to fix..

  26. lywy233 commented on Jun 12, 2026

    @lywy233

    same issue here.

  27. justingoldentrulioo commented on Jun 12, 2026

    @justingoldentrulioo

    Now it still not only doesn't work, but doesn't even show an error message. The button just does nothing. 30+ people reporting this, mentioned nearly every day somewhere or another, feature works fine for competitors, feature is crucial to workflow, and ticket is closed with no answers from developers. It's a shame since codex is one of the best coding agents/services out there.

  28. boiboif commented on Jul 10, 2026

    @boiboif

    Undo still not work!

  29. drawenadmin commented on Jul 10, 2026

    @drawenadmin

    Have you guys tried my solution? Since then it works without issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugextensionwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions