Issue to undo code with codex extension on visual studio code mac
What version of Codex is running?
0.4.0
Which model were you using?
gpt-5
What platform is your computer?
Darwin 24.6.0 arm64 arm
What steps can reproduce the bug?
Hi, I have issue to undo code, it non stop show error "Failed to revert changes"
Same error here.
Are there specific situations that trigger this? Can you repro with an open source repo (like this one) so we can repro this as well?
Are there specific situations that trigger this? Can you repro with an open source repo (like this one) so we can repro this as well?
I open some PHP project, when I start conversation codex make changes i click instant undo and it show that error. So every time I click undo it show that error.
Why is not possible to apply manually?
i do have the same issue with chatgpt-5 and codex in vscode .
Can you reproduce this on an open source repro? If you can provide repro steps along the lines of:
- Clone X repo
- Run Y prompt
- Do Z
- Click undo
Then we can take a second look here.
Same for me, I work with local repositories but it has never been able to undo any change, so it's not a problem on specific changes. GPT 5 (all default settings), OS: Darwin arm64 24.6.0, codex version 0.4.3
Pre relase 0.5.4 can undo changes
I have the same problem with a local 50 lines python file I don't believe it's the codes fault, I think it has something to do with vscode settings and configuration.
no way this fucking extension ruin my day.
Had problem with reverting changes.
switched to pre-release version.
looking for local tasks. History empty.
how the fuck i should bring back my working code.
from when did we start thinking that buggy sofware is stable releasable software ? when basic settings have problems, i mean, do u guys try ur sofware before releasing it ?
no way this fucking extension ruin my day.
Had problem with reverting changes.
switched to pre-release version.
looking for local tasks. History empty.
how the fuck i should bring back my working code.
when we start thinking that buggy sofware is stable releasable software ? when basic settings have problems, i mean, do u guys try ur sofware before releasing it ?
History never worker for me, even in stable release. As soon you close the window all history is gone. Local history, never used cloud.
Pre relase 0.5.4 can undo changes
For me it is same like in before version "Failed to revert changes"
For me even Pre relase 0.5.4 cant undo changes
Could somebody provide a repro in an open source repo? If so, I can take a look.
@mqhamdam https://github.com/openai/codex/issues/1991 for resuming a conversation. It was added to the CLI last week (codex --resume) and will be added to the extension in the next couple of days.
Steps to reproduce:
- Open Visual Studio Code -> Open folder -> new folder "Test"
- Create new file "test.py"
- Ask codex extension "write a function to return hello world in test.py" -> it works and update the file
- Press "Undo" in codex conversation -> "Failed to revert changes"
Is there a log we can check to give you more info?
Steps to reproduce:
- Open Visual Studio Code -> Open folder -> new folder "Test"
- Create new file "test.py"
- Ask codex extension "write a function to return hello world in test.py" -> it works and update the file
- Press "Undo" in codex conversation -> "Failed to revert changes"
Is there a log we can check to give you more info?
I think that after saving a file, the code formatter makes some changes (usually spacing or tabs, but some formatters also add semicolons). From the extension’s perspective, this always “file has been changed, cannot undo.” It seems like this extension might be using the history stack to handle undo operations (like Ctrl+Z), which is not a good approach. Developers frequently use Ctrl+S or auto-save to save edits and re-render results or restart the server (some tools rely on file-save events to re-run).
If that’s the case, my suggestion would be to adopt an approach similar to Copilot. They have a very useful feature like a mini Git: before processing each prompt, it creates a checkpoint/snapshot.
- Open Visual Studio Code -> Open folder -> new folder "Test"
- Create new file "test.py"
- Ask codex extension "write a function to return hello world in test.py" -> it works and update the file
- Press "Undo" in codex conversation -> "Failed to revert changes"
Actually I was able to successfully undo a change in the example by going to the "Source control" tab in VSC and click "initialize repository". So I suspect the extension tracks changes on his own and that is enough to show diffs, but it needs a configured git repo in the folder to undo changes. It would be useful if this is the case to have a more explicit error message
Same here
@iamjackharper that's correct. Undo does rely on git. Was your original issue outside of a git repo?
My issue was without a git repo maybe update the error message to something like "revert changes failed: it's not a git repo" for other people to know how to fix it. Even thought it would be a nice feature to revert changes without a git repo.
@Alexar77 definitely. I think there are two action items:
- Improve the error message here
- Make undo work outside of a git repo
@iamjackharper that's correct. Undo does rely on git. Was your original issue outside of a git repo?
Yes totally possible, my mistake I didn't know. As a suggestion: It would be nice to update the error message but maybe that point is too late, think about having a check before doing changes, like a flag or something that says "Ehi you are not in a git repo, some functionalities may not work"
@iamjackharper that's correct. Undo does rely on git. Was your original issue outside of a git repo?
Yes totally possible, my mistake I didn't know. As a suggestion: It would be nice to update the error message but maybe that point is too late, think about having a check before doing changes, like a flag or something that says "Ehi you are not in a git repo, some functionalities may not work"
better codex to have it's own version controlling system, for just snapshot/save points, sometimes i dont need git repo. Saying again feature in copilot for savepoints is the best.
Any updates for this issue?
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 displaying the changes;
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 displaying the changes;
![]()
Are you in a git repo?
Duplicate of #3567
Duplicate of #3567
@gpeal This is original first issue submitted, not duplicate. It is created 3 weeks ago.
same error here
same error in cursor with azure gpt-5
same error at latest linux vscode