Skip to content

Bug report: VSCode extension failed to revert the changes #7291

Open

Description

@kaizhuanren

What version of the VS Code extension are you using?

0.4.46

What subscription do you have?

bussiness

Which IDE are you using?

vscode

What platform is your computer?

Darwin 25.1.0 arm64 arm

What issue are you seeing?

Environment: macOS, VSCode extension 0.4.46.

Codex deleted parts of my code unexpectedly. When I clicked the Revert changes button in the VSCode extension, it showed “Failed to revert changes.” The history changes panel did not correctly display the deleted parts, although the conversation’s history of changes did show them. I had to manually copy and paste from the conversation history to avoid losing uncommitted code.

The revert button in the VSCode extension does not work properly and needs to be fixed. I also suggest adding an option or prompt to automatically create a commit before Codex starts editing, so it is easier to restore previous versions.

What steps can reproduce the bug?

I asked Codex to find duplicate parts in the code and delete them, but Codex mistakenly started truncating the file from an incorrect location, causing the file to be cut off and a large amount of code after that point to be lost. When I clicked the revert button (↩️), it showed “failed to revert the changes.”

What is the expected behavior?

No response

Additional information

No response

Activity

  1. added
    extension
    on Nov 25, 2025
  2. added
    bug
    on Nov 25, 2025
  3. github-actions commented on Nov 25, 2025

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  4. imkebe commented on Nov 25, 2025

    @imkebe

    I would say there is a general need to have snapshots. Once we revert there is no apply patch in case we want. Also i'm not sure how the revert works if i revert non recent change. It's so confusing.

  5. lionel-oai commented on Nov 25, 2025

    @lionel-oai
    Contributor

    Hi @kaizhuanren, thanks for filling in this bug. How many files did you need to revert changes on? I've just tried on a dummy example and it seemed to work:

    codex-ide-revert.mov

    Could you describe a bit more what you see in the IDE?

  6. aemotyka commented on Nov 25, 2025

    @aemotyka

    Same issue here.

  7. kaizhuanren commented on Nov 26, 2025

    @kaizhuanren
    Author

    Thanks for looking into this!

    The key problems may be that Codex informed me that it had incorrectly truncated a document (about 3000 lines lost from a single file). After that, the VScode extension showed "Failed to revert the changes"

    I am not fully aware of the internal details of how these Codex tools and vs extensions work, but my guess is that the issue I ran into is related to the tool calls failing to correctly return the corresponding results.

  8. kaizhuanren commented on Nov 26, 2025

    @kaizhuanren
    Author

    Same issue here.

    Maybe you could also describe more details , thanks

  9. lionel-oai commented on Nov 26, 2025

    @lionel-oai
    Contributor

    Oh okay so did Codex by itself tried to Undo its changes @kaizhuanren ?

    @aemotyka could you detail a bit more what is happening on your end?

  10. kaizhuanren commented on Nov 26, 2025

    @kaizhuanren
    Author

    Codex reported the error and asked if I wanted to roll back to a previous version. I agreed, but it tried to restore using the git commit history, which would have caused me to lose some uncommitted code. After that, the ↩️ undo button stopped working properly.

  11. aemotyka commented on Nov 26, 2025

    @aemotyka

    @lionel-oai yes, essentially after codex completed changes, I wanted to revert the most recent change, and attempted to do so by clicking the "undo" button that appears when you expand the diffs of different files shown when codex completes a task. After clicking, I get a red toast that says "failed to revert changes" (image attached here). (and the changes are not reverted). Of course I can still manually revert because I am able to see the diff, but it would be pretty valuable to be able to do this with the click of a button instead. Also, unlike @kaizhuanren, I've experienced this issue on changes spanning only a few lines, so I don't think it's a truncation issue.

    Image

    (I have the same exact setup, ide, platform as the original poster here, but I am on Pro, not business. Also, I have encountered this issue with all models on codex going back to august, and it occurs whether or not my project is on git. My hunch is it has something to do with platform, because I saw a previous issue that had been closed where only specific Mac users were still reporting the issue)

  12. kaizhuanren commented on Nov 27, 2025

    @kaizhuanren
    Author

    I’d like to add a bit more context. In my Mac, Codex extension’s ↩️ button in VS Code doesn’t work properly in other situations either .

    Codex can still revert files correctly by using apply_patch after my instruction, but the issue I first ran into was actually a more troublesome scenario.

  13. rockyicer commented on Dec 1, 2025

    @rockyicer

    I’d like to add a bit more context. In my Mac, Codex extension’s ↩️ button in VS Code doesn’t work properly in other situations either .

    Codex can still revert files correctly by using apply_patch after my instruction, but the issue I first ran into was actually a more troublesome scenario.

    Same for me in Windows vscode ide codex

  14. bastetcheat commented on Dec 1, 2025

    @bastetcheat

    same for me in vscode extension

  15. 24 remaining items

  16. Boden-C commented on Mar 23, 2026

    @Boden-C

    The issue seems to be (at least for me) caused by using the Run Codex In Windows Subsystem For Linux. It is off by default, but the docs recommend enabling it. Turning it off allows undo to work (sometimes), but it then causes a separate bug #9062

    So turning WSL on breaks undo, and turning it off breaks PowerShell. I decided to enable WSL since "I can't undo the changes" is at least better than "The agent can't even run commands."

    I will add that "being able to undo" and "being able to use PowerShell" are very basic things that every paid agent platform should do, and it is shocking that it is STILL not working. Especially considering that VSCode Copilot works fine and is open source.

  17. LeoArtaza commented on Mar 24, 2026

    @LeoArtaza

    The issue seems to be (partly) caused by using the Run Codex In Windows Subsystem For Linux. It is off by default, but the docs recommend enabling it.

    I have that setting off and I still have the issue

  18. LeoArtaza commented on Mar 24, 2026

    @LeoArtaza

    I was able to fix it. My git repository was initialized but had no commits. Once I did an initial commit, it started to work. You don't need to have everything commited up to the point you want to revert like someone else said.

    Hope this fixes it for someone else too.

  19. alanscandrett commented on Apr 8, 2026

    @alanscandrett

    We have an entire development team running into the same issue, even trying with their personal accounts to debug. Tried updating VS Code, updating Codex, using hte codex prerelease, looking through the docs and including hte "undo" feature. No results for any of this.

    Pretty poor form for a paid product, we are switching as a team to Claude as a result of this.
    The most basic attempt at UX would at least allow us to see what the error is behind the scenes rather than a "whoopsie sorry" generic message, this is designed for programmers after all right?

  20. Supramundaner commented on Apr 29, 2026

    @Supramundaner

    Same problem and it is not fixed till now...

  21. rmpwork44 commented on Jun 5, 2026

    @rmpwork44

    I am experiencing an issue with the Codex extension in VS Code where the Revert Changes functionality does not work correctly.

    When I click Revert Changes, the extension displays the following message:

    Image

    The affected files are listed under the “Skipped” section.

    Steps to Reproduce

    • Open a project in VS Code.
    • Use Codex to make changes to one or more files.
    • Click Revert Changes (or Undo/Revert from the Codex UI).
    • Observe that the revert operation fails and the files remain modified.

    Actual Behavior

    • Revert operation fails.
    • A popup appears indicating that no changes were reverted.
    • Some files are listed as skipped.
    • The modified files remain unchanged.

    Expected Behavior

    • All changes made by Codex should be reverted successfully.
    • Files should return to their previous state before the Codex modification.
    • No files should be skipped unless a clear reason is provided.

    Environment

    • VS Code Version: 1.123.0
    • Plan : Free
    • Codex Extension Version: 26.5602.30954
    • Operating System: Windows
  22. JasonSteelmanCoder commented on Jun 8, 2026

    @JasonSteelmanCoder

    Same problem on Windows machine with VS Code and Codex extension.

  23. dev-to2k commented on Jun 18, 2026

    @dev-to2k

    same issue

  24. dernosmirc commented on Jul 3, 2026

    @dernosmirc

    Still an issue.

  25. thedragonheir commented on Jul 3, 2026

    @thedragonheir

    Still an issue.

    Thanks for the update. From what I can see, I would not consider this fully fixed yet.

    There seems to be some backend work around rollback, for example thread/rollback, but that appears to only roll back the agent/thread context. The actual file restore is still left to the IDE/client side. So if the VS Code extension loses the diff/snapshot state or cannot map the previous file contents correctly, users can still end up with “Failed to revert changes” or with uncommitted work at risk.

    For me the important part is not only “rollback conversation history”, but a reliable, atomic restore of the exact Codex-applied file changes.

    A safe fix would probably need something like:

    • create a local snapshot before every Codex edit
    • keep that snapshot independent from the user’s normal Git staging/unstaged state
    • restore only the files/regions touched by Codex
    • never overwrite unrelated user changes without confirmation
    • show a clear error and recovery path if the snapshot cannot be applied cleanly

    Until that exists, I think the practical workaround is still to commit/stash manually before using Codex on important code, or use a separate worktree/branch. But that is a workaround, not a fix for the extension’s Revert button.

  26. wundeeh commented on Jul 21, 2026

    @wundeeh

    Still an issue

  27. InsightToolDev commented on Jul 29, 2026

    @InsightToolDev

    Still an issue

  28. Ahmed-Hossam-Aldeen commented on Aug 5, 2026

    @Ahmed-Hossam-Aldeen

    Still an issue

  29. why459097630 commented on Aug 7, 2026

    @why459097630

    This is exactly the failure mode I built ChangeLatch around. I send a project ZIP + prompt to web AI, get exact before/after patches, review them first, then apply locally with automatic backup/build checks. The AI never gets direct write access to the working files.

  30. fugikzl commented on Sep 21, 2026

    @fugikzl

    still an issue

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

    bugextension

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions