Issue to undo code with codex extension on visual studio code mac

Resolved 💬 37 comments Opened Aug 31, 2025 by Pengi123 Closed Sep 18, 2025
💡 Likely answer: A maintainer (gpeal, contributor) responded on this thread — see the highlighted reply below.

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"

View original on GitHub ↗

36 Comments

rewinksi · 10 months ago

Same error here.

gpeal contributor · 10 months ago

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?

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

prabhuAI · 10 months ago

i do have the same issue with chatgpt-5 and codex in vscode .

gpeal contributor · 10 months ago

Can you reproduce this on an open source repro? If you can provide repro steps along the lines of:

  1. Clone X repo
  2. Run Y prompt
  3. Do Z
  4. Click undo

Then we can take a second look here.

iamjackharper · 10 months ago

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

mattiapv · 10 months ago

Pre relase 0.5.4 can undo changes

Alexar77 · 10 months ago

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.

mqhamdam · 10 months ago

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 ?

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

Pengi123 · 10 months ago
Pre relase 0.5.4 can undo changes

For me it is same like in before version "Failed to revert changes"

Alexar77 · 10 months ago

For me even Pre relase 0.5.4 cant undo changes

gpeal contributor · 10 months ago

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.

iamjackharper · 10 months ago

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?

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

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

aemotyka · 10 months ago

Same here

gpeal contributor · 10 months ago

@iamjackharper that's correct. Undo does rely on git. Was your original issue outside of a git repo?

Alexar77 · 10 months ago

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.

gpeal contributor · 10 months ago

@Alexar77 definitely. I think there are two action items:

  1. Improve the error message here
  2. Make undo work outside of a git repo
iamjackharper · 10 months ago
@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"

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

Pengi123 · 10 months ago

Any updates for this issue?

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 displaying the changes;

<img width="496" height="210" alt="Image" src="https://github.com/user-attachments/assets/e8b8ff93-4875-437d-b466-53bfc53674fa" />

gpeal contributor · 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 displaying the changes; <img alt="Image" width="496" height="210" src="https://private-user-images.githubusercontent.com/16798009/491035895-e8b8ff93-4875-437d-b466-53bfc53674fa.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTgyMTUyNTgsIm5iZiI6MTc1ODIxNDk1OCwicGF0aCI6Ii8xNjc5ODAwOS80OTEwMzU4OTUtZThiOGZmOTMtNDg3NS00MzdkLWI0NjYtNTNiZmM1MzY3NGZhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA5MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwOTE4VDE3MDIzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdiNTg4MTYwN2VhODAzZGM3MjkyOWNiNmMyZmVmNGFjZDE1ZmI4NjQ0MzQzNDQwMGYzMDY2YmMxNGEyYzQ3NjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.NhM2HmQ623tZnDcdMcLixvaerwsfS-WGasYURLDcfoI">

Are you in a git repo?

gpeal contributor · 10 months ago

Duplicate of #3567

Pengi123 · 10 months ago
Duplicate of #3567

@gpeal This is original first issue submitted, not duplicate.
It is created 3 weeks ago.

mconti80 · 9 months ago

same error here

qianlnk · 9 months ago

same error in cursor with azure gpt-5

tces1 · 8 months ago

same error at latest linux vscode

SvenBudak · 8 months ago

Same error

testifier · 8 months ago

Same error on mac vscode

aemotyka · 8 months ago

Why did this get closed? It's clearly still a problem and is the original thread on the issue

etraut-openai contributor · 8 months ago

@aemotyka, the original issue described here was fixed. If you are seeing a similar problem with the latest version of the Codex IDE Extension, please open a new issue and describe the behavior you're seeing.

csjohne · 7 months ago

same issue

snehitvaddi · 7 months ago

I am on windows Cursor and using Codex through it. The issue still persists.

Showing cached comments. Read the full discussion on GitHub ↗