Bug report: VSCode extension failed to revert the changes

Open 💬 47 comments Opened Nov 25, 2025 by kaizhuanren
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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_

View original on GitHub ↗

47 Comments

github-actions[bot] contributor · 7 months ago

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

  • #6794
  • #6550
  • #6074

Powered by Codex Action

imkebe · 7 months ago

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.

lionel-oai contributor · 7 months ago

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:

https://github.com/user-attachments/assets/108be080-515b-4a33-a656-447fc15d141b

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

aemotyka · 7 months ago

Same issue here.

kaizhuanren · 7 months ago

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.

kaizhuanren · 7 months ago
Same issue here.

Maybe you could also describe more details , thanks

lionel-oai contributor · 7 months ago

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?

kaizhuanren · 7 months ago

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.

aemotyka · 7 months ago

@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.

<img width="231" height="47" alt="Image" src="https://github.com/user-attachments/assets/47677ad2-fcb6-4fcf-8956-817cc239c6cf" />

(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)

kaizhuanren · 7 months ago

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.

rockyicer · 7 months ago
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

bastetcheat · 7 months ago

same for me in vscode extension

bastetcheat · 7 months ago

never worked for me

<img width="259" height="89" alt="Image" src="https://github.com/user-attachments/assets/b0b29d77-2b44-48ca-b10f-db017b37f9ed" />

crimpproduction · 7 months ago

yes i experienced this too.

jasonwei1002 · 7 months ago

Still having issues

aemotyka · 7 months ago

Issue #2997 was closed as "resolved" with no actual fix, please leave this one open as this is clearly an ongoing issue.

LumenEurope · 6 months ago

Still got this issue?

aemotyka · 6 months ago
Still got this issue?

No, because they removed the "undo" button. Would be a great feature to have if it actually worked though.

yueyang-yin · 6 months ago

https://github.com/user-attachments/assets/5bc8f909-bdac-4c68-8803-459081ede16a

seems like it still doesn't work and haven't been removed now.

jamesdeluk · 6 months ago

This feels like quite a big bug, as Codex is able to destroy an entire codebase (or at least break the code) - and does semi-regularly. Every other coding agent I've used has this function working.

aemotyka · 6 months ago
This feels like quite a big bug, as Codex is able to destroy an entire codebase (or at least break the code) - and does semi-regularly. Every other coding agent I've used has this function working.

Exactly

C0sm0cats · 6 months ago

same with windsurf and Codex – OpenAI’s coding agent

<img width="227" height="49" alt="Image" src="https://github.com/user-attachments/assets/6e6dbffc-4379-4dde-b973-730b3c494b07" />

Vzz1c · 6 months ago

+1

WeiyiTian · 5 months ago

Same here...

khaled-badenjki · 5 months ago

same here and it's quite frustrating! considering alternatives for codex

jamesdeluk · 5 months ago

Seems to work for me now.

takkbbl · 5 months ago

Same here

william2ai · 5 months ago

same here, it's just so annoying

myskillz · 5 months ago

<img width="424" height="181" alt="Image" src="https://github.com/user-attachments/assets/e41f9fc0-d346-4538-9b5e-f4bf959bf0fb" />

Enferlain · 5 months ago

Same thing, fix please

wlans · 5 months ago

Same issue

Tolkium · 5 months ago

Same issue here

rockyicer · 5 months ago

i figured it out. You need to use the git to record every step(commit), so the codex can help you to revert to any stage.

kalelbot · 4 months ago

same issue

KYKKIS2 · 4 months ago
i figured it out. You need to use the git to record every step(commit), so the codex can help you to revert to any stage.

So i just need to commit everytime codex finishes a prompt? In order to for to go back? But this doesnt solve the revert changes you just go one commit behind using git.

YaJee666 · 4 months ago

<img width="533" height="571" alt="Image" src="https://github.com/user-attachments/assets/8a10ed77-ad80-4a81-95ee-3fcad60cee0a" />
codex vs code extension still have this revert error

Enferlain · 4 months ago

is there really 0 solution to this 3 months after? come on

Boden-C · 3 months ago

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.

LeoArtaza · 3 months ago
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

LeoArtaza · 3 months ago

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.

alanscandrett · 3 months ago

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?

Supramundaner · 2 months ago

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

rmpwork44 · 1 month ago

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:

<img width="445" height="275" alt="Image" src="https://github.com/user-attachments/assets/e7b86a43-0074-4f8f-8326-b9de17c810d0" />

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
JasonSteelmanCoder · 1 month ago

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

dev-to2k · 1 month ago

same issue

dernosmirc · 17 days ago

Still an issue.

thedragonheir · 17 days ago
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.