Undo does not work

Resolved 💬 61 comments Opened Sep 14, 2025 by Polinarium Closed Feb 21, 2026
💡 Likely answer: A maintainer (gpeal, contributor) responded on this thread — see the highlighted reply below.

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.

<img width="1527" height="823" alt="Image" src="https://github.com/user-attachments/assets/a6dabe95-8380-4d16-b245-f83f3eedcc21" />

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.

View original on GitHub ↗

61 Comments

setyanzxc123 · 10 months ago

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

gpeal contributor · 10 months ago

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?

josh000111 · 10 months ago

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;

<img width="496" height="210" alt="Image" src="https://github.com/user-attachments/assets/e51293a2-a6ab-4ef9-b3fa-e66a9d5831bd" />

gpeal contributor · 10 months ago

@josh000111 Is your code in a git repo?

setyanzxc123 · 10 months ago
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

setyanzxc123 · 10 months ago
> 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

josh000111 · 10 months ago
@josh000111 Is your code in a git repo?

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

Polinarium · 10 months ago
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.

maxiedaniels · 10 months ago

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.

gpeal contributor · 10 months ago

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.
maxiedaniels · 10 months ago

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

gpeal contributor · 10 months ago

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

TakiGuan · 9 months ago

Same issue here +1

SijaanX · 9 months ago

Same issue here.

My code is from a github repo.

V0ightt · 9 months ago

Asking it to undo the changes will do the same thing @gpeal said.

<img width="638" height="479" alt="Image" src="https://github.com/user-attachments/assets/485911cc-29c6-4735-8de4-a15530a0f12a" />

iamhectorlopez · 9 months ago

i’m experiencing the same issue with codex extension 0.4.21 - when clicking undo, i get a confirmation, but the changes aren’t actually reverted.

it would be extremely helpful to: 1) fix this issue and 2) add an option like “revert to this point in conversation” or “discard all changes up to this checkpoint,” with the ability to reapply changes if needed.

other ai code editors include this feature, and it’s made a huge difference in usability.

@tibo-openai sorry for the ping, but i think this would really improve ux and productivity in general

<img width="165" height="38" alt="Image" src="https://github.com/user-attachments/assets/e92d3c1b-26ce-4120-a3ea-445f13d8d886" />

kacisse · 8 months ago

Still not working here, should we use the pre release version for that ?

huangwb8 · 8 months ago

Still not working here. Very bad!

huangwb8 · 8 months ago
Still not working here. Very bad!

I noticed that if I use github to do version control for the project, it works. I think that's great, but openai seemed not clearly tell their users that the Undo function depends on Git.

huangwb8 · 8 months ago

Here are suggestions to the developers of OpenAI Codex Plugins in VSCode:

  • Remove Undo, and give annother choice: change between different version. Add 2 buttons, one for the past version, one for the future version. Believe me, this makes Codex cooler!
  • Support all official commands, especially /compact!
kacisse · 8 months ago
> Still not working here. Very bad! I noticed that if I use github to do version control for the project, it works. I think that's great, but openai seemed not clearly tell their users that the Undo function depends on Git.

What do you mean ? We need to work directly on the github version (remotely) ?
Or can it simply be the local branch i'm.working on on my laptop ?

huangwb8 · 8 months ago
> > Still not working here. Very bad! > > > I noticed that if I use github to do version control for the project, it works. I think that's great, but openai seemed not clearly tell their users that the Undo function depends on Git. What do you mean ? We need to work directly on the github version (remotely) ? Or can it simply be the local branch i'm.working on on my laptop ?

Just use github desktop to do version control for a Codex project. Everything is local. That would make Undo works. However, I think the version control function of the plugin is primary. It's more recommended to use tools like git to do version control.

kacisse · 8 months ago

Ok thanks for sharing I'll try git locally

> > > Still not working here. Very bad! > > > > > > I noticed that if I use github to do version control for the project, it works. I think that's great, but openai seemed not clearly tell their users that the Undo function depends on Git. > > What do you mean ? We need to work directly on the github version (remotely) ? Or can it simply be the local branch i'm.working on on my laptop ? Just use github desktop to do version control for a Codex project. Everything is local. That would make Undo works. However, I think the version control function of the plugin is primary. It's more recommended to use tools like git to do version control.
1usmus · 8 months ago

+1, undo not working

p81sunshine · 7 months ago

same problem. codex is so fucking hard to use

kacisse · 7 months ago

Ask codex tu create a local git, it works just nice with git

EDIT: its tricky, now it shows that it reverted back successfully : BUT IT NEVER DOES actually. Its impossible to use Codex as is. it's not reliable until the revert feature works. I also added an exception in my antivirus to allow the git commands but it doesn't change anything unfortunatelly.

parkertomp55513-cloud · 7 months ago

hi, it may depends on your antivirus who block the access from %userprofile%\Documents\x\.git\

kacisse · 7 months ago
hi, it may depends on your antivirus who block the access from %userprofile%\Documents\x.git\

I also tried that, but doesn't change a thing :(

SijaanX · 7 months ago

Started working for me all of the sudden.

cloned the project locally with git.

kacisse · 7 months ago

Are tou sure ? Because for me it turns green but it actually never revert anything

Started working for me all of the sudden. cloned the project locally with git.
SijaanX · 7 months ago
Are tou sure ? Because for me it turns green but it actually never revert anything > Started working for me all of the sudden. > cloned the project locally with git.

Yes, turned green and reverts.

Did you update it to the latest version?

kacisse · 7 months ago

No I was so fed up lol I just use it single one shot prompt that would 't matter without a revert. I'm too scared. But I'll give it a try again then !

Watcher3056 · 7 months ago

+1, this option is never worked for me. It's just does nothing.

kacisse · 7 months ago

I just got it to work for the first time... And never worked again. I don't understand what the hell is going on. Are they not reading all those poeple complaints?!

kacisse · 6 months ago

OK I understand the issue: every single change must be added and comitted right away to your local git to be able to undo.
If you click undo with a success message but nothing happens, it means it was not committed before the change was made by Codex.
I don't understand why Codex doesnt behave the same as any other AI Agent (Roo, Cline, or even Cursor) ??

anxieuse · 6 months ago

What a terrible UX. Please, fix that ASAP 🤲

tucomel · 6 months ago

they remove undo function in version 0.78+ ??
I refuse to use codex without undo function.. this is innaceptable

etraut-openai contributor · 6 months ago

@tucomel, this issue pertains to the IDE extension. I think your comment is about the CLI. If you'd like to see an undo feature in the CLI, please feel free to file a feature request. We removed it because it saw relatively little usage and its implementation was causing problems for many users (including those who never used the feature).

kacisse · 6 months ago

Little usage of the Undo ? It's really hard ro believe, that's an absolute must have > @tucomel, this issue pertains to the IDE extension. I think your comment is about the CLI. If you'd like to see an undo feature in the CLI, please feel free to file a feature request. We removed it because it saw relatively little usage and its implementation was causing problems for many users (including those who never used the feature).

Watcher3056 · 6 months ago

As for me I did not used it as I knew it does not work after a couple of attempts.
But this is definitely some kind of supreme artificial intelligence move to remove this feature.

But still not much of required feature as I always can use git or just ask the agent to revert some specific changes and he will do it nicely.

But in the same time I believe some other users can disagree.

justingoldentrulioo · 6 months ago

<img width="411" height="135" alt="Image" src="https://github.com/user-attachments/assets/11ed7023-17c4-41d0-81f8-3b93bdd47f45" />

<img width="345" height="954" alt="Image" src="https://github.com/user-attachments/assets/2699bef8-5cdf-4892-bdff-30fc1103d6b6" />

Codex deleted my thousand line file and then could not revert changes. Most bugs I find with this software get closed and don't allow comments. Increasingly frustrating. Obviously if it was a real project, I would have backed it up, but still lost an hour of prompting work. Huge waste of my human time. My file was permanently deleted. It also took allowing it to edit over ten times for it to finally finish, and most edits were deleting a tab and replacing it with spaces or deleting spaces and replacing it with tabs.

rladbtls1998 · 5 months ago

Still does not work. I just use ctrl-z if file is not deleted.
While model itself is good, extension is terrible to the point that makes me prefer other services like claude, cursor, or vscode copilot

hyuwowo · 5 months ago

good job codex i cant reverts

MauPos04 · 5 months ago

+1, undo not working

xiaotang-12-ops · 5 months ago

It's surprising that this highly practical feature was brought up months ago, yet no fixes have been made to it...

U7ama · 5 months ago

It shows the following error in the VS Code Extension Output logs:
2026-02-02 14:17:16.914 [error] Error fetching vscode://codex/apply-patch: Error: /home/usama/Work/qcs/frontend is not a git repository
When using a multi-root workspace, Codex is only able to revert changes in the first folder of the workspace, if that folder has a Git repository.
Undo/Revert does not work for other folders in the same workspace, even when those folders are also valid Git repositories.

CHENGHAO-WANG · 5 months ago

So surprised that this issue was found a few months ago but still doesn't get fixed. Have to manually undo by ctrl+Z. But I'm afraid this isn't gonna work when I want to keep part of the changes.

iamhectorlopez · 5 months ago

@CHENGHAO-WANG you gotta use git buddy. my workflow is uninterrupted because i can revert in git if needed, but it's definitely annoying to not be able to simply undo stuff with a click, especially for quick testing of stuff.

zba · 5 months ago

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

iamhectorlopez · 5 months ago

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

adampieroni · 5 months ago

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.
Enferlain · 4 months ago

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

alanscandrett · 3 months ago

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

drawenadmin · 3 months ago

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.

ForteDexe · 2 months ago

almost half a year, still can't undo

hitem · 2 months ago

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

nice2mexd · 1 month ago

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

lywy233 · 1 month ago

same issue here.

justingoldentrulioo · 1 month ago

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.

boiboif · 10 days ago

Undo still not work!

drawenadmin · 10 days ago

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