You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
codex unintenally deletes some files which is not tracked by git.
codex unintenally modify something when something is not git committed.
It bites me several times in recent days and I miss the /undo feature each time.
Additional information
No response
Reacted by Stefan Hueg, Xynonners, Eivind Norling, 배동훈, tom-bomba, Ignat Remizov, b20lopez, Feng Liyuan, Karol Gusak, Franco Marchesoni and 492 more
Reacted by Vivek Patel, Emin, TaggartMaher, Pa3k5, Haowei Wen, Tran Ngoc Thanh Binh, Roee Klinger, Pedro Henrique Dos Santos, Yumo Bai, Archit Checker and 42 more
codex unintenally deletes some files which is not tracked by git.
This happened to me too just these last days, out of nowhere, been using codex since it was available, and never had this happen to me before. Suddenly it wants to "keep the git repository clean" and deletes anything regardless of it existing before starting codex or not, it doesn't seem to realize what side-effects the commands it runs actually have.
Work around, actually check things into git or keep out of reach from Codex.
git is the real solution rather than /undo here as well, the sooner you learn it, the faster you'll be able to continue working without waiting for something to come back, which likely won't come back :) Ask codex to help you learn git ;)
Reacted by Rob Royce, Alexey, Zuch Huang, 天然純真, Adomas, digitalhurricane-io, Chenlu Ye, zzy-life, John Miller, Mykola Veryha and 5 more
I find this mainly an issue where I'm working on something in a session, fine with the last few changes codex made, then it makes a bad change. If I don't remember to do a stash before the bad change then how am I supposed to revert without loosing all my progress?
I find this mainly an issue where I'm working on something in a session, fine with the last few changes codex made, then it makes a bad change. If I don't remember to do a stash before the bad change then how am I supposed to revert without loosing all my progress?
Its gone.. asking codex to fix it will make it worse. Im forced to go back to using Claude.
Google anti Gravity is also a great alternative.
Reacted by Rob Royce, Antonio, Zuch Huang, 忍野ペンギン, Monawwar Abdullah, aki4nvr, Mykola Veryha, Batuhan Ayhan, Vasiliy-Makogon and Arham
@etraut-openai Could you revert it back? If there is a particular reason to hide it, could you put it in experimental and warn people the reason when we enabling it?
@SunRunAway, the previous experimental implementation had problems. It was causing many issues even for users who did not use the feature. If we bring it back, it will need to be redesigned.
I use the following prompt as a hack to get codex to undo its changes:
I don’t like it. Undo the changes you just made in your previous message using the patch tool. Do not use git commands to revert your work. Do not touch anything else that appears changed unless you modified it directly in this session.
I use it often and it works reliably. It just takes longer. If you need to revert multiple turns, you have to send the prompt, wait for the llm to finish, backtrack and rinse-repeat.
The only caveat is that it cannot bring back deleted files. I agree with @embedding-shapes - even if the undo feature existed, it should not be considered a first line of defense against accidental file deletion.
How does it serve? What can i do with it?
How does it make sense?
Which branch do I sit on.
(you may try send it to LLM --- Or try to find the relevant documentation ) How do I work on a PR, and how do I push a PR
Git as of it self , has insane amount of bloat.
There is a basic use and there is advance use
I can also recomend https://sapling-scm.com/docs/overview/intro
spaling by Meta , which offers a friendly way to push or manage commits
... Potentielly you can invetigate ideas offered, in sapling... See what Issues it claim to solve.... and HOW CAN YOU enhance your own flow and stack. Based on other solved ideas
i personally think LLM PROMPTING should be a combo of the tools you use. and code. structure. but basically "AFTMOST" you should use the correct "keywords" if your intentions is to make an action with git you tell it something like [prompt] check "git show" to execute the currect behavior based on our intention... familuar yourself with the documentation... So when you speak you can declare the intentions - the center of gravity is the tools you intend to use .... your boss prompted you with a task -> now you can take LLM.. put his text -> then you ask the LLM the the text "What category does it fall into [database] [chatflows] [docunmetatchion] [Fix a bug --> [another JEV what does this bug fall into] ] " (I think a tool like JEV could answer this task -- I been investigating how JEV can be useful for example ) [JEV:ASK -> browse the last 200 main issues? investigate simular categories? But LLM still going to be so cheap?]
but presonally I think going on forward another yet unrelated note... huge 2.5T models are intelligants -- and hardware is expected to make those models 90x times faster - the same way h100 HOPPER was optiomized for AI , where A100 wasnt that great (a100 "tensor" pretty much was meant to compete with TPU but the google team was just not able to compete? barely even intregate the latest HBM models? with fears of yeild? TSMC does seems to prioritize the top buyers histroically -- and the politics behind AMD and NVIDIA and APPLE - are just better in terms of the semiconductors - ironically with apple without qualcom and arm their chips would not have compete with any android phone --- some android manufactors have some crazy issues - considering how stable it should became once they get things right) ... as for the 2.5T models - most of it , is noise, but it is important as it should scale now -- huge models are not a sign of quality, but they are fast, they do scale... I personally wish we saw an hardware crsis with chatgpt - instead of throwing huge sums at nvidia - now instead of 90,000$ just for the GPU part it could been 400,000$ - and the bottleneck would lay over the artitecture , in a way we would have reach what is possible in 2027 and 2028 back in 2024 - assuming 2023 and 2024 - was just limited by the amount of wafers you can print.
as for cerebras, as impressive as it is - it doesnt seems to be able to deal with huge amount of the coding-tasks / steps
(googles tpu, and the gemini models, seems to be suffering from another issues huge amount of i/o bendwith but a specilized small scale task specific chip "the TPU" )
with cerebras its fast, its impressive, but who knows what life span of such chip would be? imagine serving 100,000users having to force 90pb of use context data a second for a year.... huge center of gravity just with moving data around --- does anyone realized humans are not getting smarter? do people realize what SSD is ? its fast, but its not that fast, those models are going to sizes like 20tb a model at fp16 precision? how much of the model can you push on a cerebras chip?
Cerebras, potentially can enjoy the same amount of presicion(after quanitization) and quality an NVIDIA chip or AMD chip might enjoy.
(crazyright?) nvidia pushing all of thise coperwires between server racks - and those optical solution now (which you can guess has its issues for what/why COPPER was used at H200 and H100 and A100)- but still
so cerebras is fast and you are able to push all of this data
how the hell you push huge models into the chip? you cant really run deepseek v4.1 fp8 can you ?
with a coding agents how do you load data (user context, and scaling it)-> into the chip? accepting huge latency like 9s is acceptable - if the tokens will be 8000/t/s? assuming you may even use a super big model like 90T model - not that models need to be big with what we seen with ditilled models like gpt-6-sol and gpt-6-luna - as we aim for the curect behavior -- now can you scale 90T models to 100,000 users, you can --- such a big chip like cerebras better also roleplay as the cpu[also yes lol - a lot of the LLMs are sandboxs searching the web 90times per request, sandbox are hellaCool because, HOW COOL IS IT that you can, upload a small csv dataset , or excell data -- and it uses pip and python , and libraries --- and represant you with typical CHARTS and INSIGHTS - and this calculation take cpu times --- [??should you offload and move to the other user - what do you with the gpu here??]] do you must now wait on an actual internet request which can take like 90ms/20ms - and all of the latency ... just by not dealing with another prompt -- (and the context you loaded into the GPU/CHIP/TPU need to some how be cleared? each token) -- they are crazy bottle necks even with the basic ideas of Prefill and Decoding (now models appear to want more simular taxing demands?) Very interesting same that the last 20 years, was fighting with the chemistry and natrue of semiconductors --- ML was possible back in the era of DOS - if semiconductors were achieveable and scaleable the trend was for it to go to 0$ but it didnt scale, only progressed towards 0$ - which is a buissness lesson atleast in my eyes. -- Moorse law by Intel , died like 8 times /each new 2years -- and I am not going to argue with anyone working for the semiconductors indurstry - a lot of the tasks and things happen are basically inhuman Intel made amazing product - but with AMD I wish they went bankrupt , but they are in a stable place which they are going to get a good piece of the PIE/ marketshare - with the hope they wont become and release such awful products to "edge consumers" literally none of the hardware by intel ever was problematic for me. So many issues with AMD - (but they also release amazing products now like video encoders for AV1 or hevc - and no one does it better than AMD now) and to shrink 65nm to 14m, was very much unexpected --- lets be clear if this is possible datacenters should be able to generate 20x times cheaper electricity - and being able to deal with new standards of electricity - 90GW datacenters are very much could been a reality in 2012 - and deliever so much more than today with the 65nm - bigger chips higher latency (not a big deal) if this was in 2012 - and prove what chatgpt proved- or even gpt2 - and what google was doing with their Language Models and language strucuring which is debicated to the area of Linguistics (sure powerleakage, chemicals, plants) -- in my mind if 7nm. or 14m is stable, thus we can invest in 65nm and even bigger chips --- computers are built with lots of compondants --- because this way computers are broken down by their problems -- ram, cpu, data, suffering to electrical standards and iso bloat (which actually saves lifes dont get me wrong - but it makes issues as the CONSUMER might live in Europa or Canada or need to abid some how with Japanese eletrical laws) and the 0.95% of computers/phones who turns in a lithum pregant bomb -- I am sorry we should have standards --- to not burn daily like its 1800 london/british city ,, or some of the electrical disaters we seen in the USA when they adopted electrical goods and products.... so they matter --- but the theory provides a lot more 65nm is crazyyyyyyyyyy... "No semiconductor moment for the powergrid?" ... Whats the point most papers and ideas, are papers to wipe your "orificium ani"... So research papers arent prompts/ideas - as they all prove a techinical point or a chartflow to how you disgunise HPV to other complex skin disaeges (assuming most of the gates is to treat it with a general antibiotic -- based on lab results) -- and sure I may be or not be with anger issues to my own exposure to ARSENIC and other heavy metals, and it totall destroyed my abily to speak without sounding funny - but my passion is real - as i am not going to compact my hope just by beathing and living - but most logicflows can be do you need to feed your own kids / or if you are with an execetive role - do your employees respect you for attempt to abid by the basic human decencies and welflare,, are they playing their part so its answer with VALID if its not,, should you keep feeding their mouths so a. are they good at their job, and craft is debicated to the job b. are they loyal , so you keep them out of respect? --> a.b meet the stage you go bankrupt... you make a product, but you better make the product better than the rest- and love your craft - if there is other method and idehology to run a small buissness sure, as long as it doesnt break common sense law, like anything to do with food quality - or other people welflare --- what place a company serve in the economy/socially many argue - I argue jobs , something that people dont get bored --- society mean a state - the idea is that we are not split to Tribes too much (we are, cities, states, county, counties [also notice how Counties in the US are thing, because there was no internet back then] ) now you have too many laws, and too many people fighting you (yet its nice that if someone murders you the chances are much higher to find who did this to you-- with the general hope you live with a good police department in your area --- some policedepartments dont have the talent) --- what a company serves in a society - for some jobs- for some profit - for some its a challenge maintaining the profit /even increase profit. For some its a straggle not being vaporize and go out of buisness the next mouth (Clearly , and to be clear numbers double themselves very fast -- looking at people who cant run a buissness or going out of buissness -- so thats a really bad reality for them - and it seems painful) look at nVIDIA , and how they made layoffs few times - they got strong due to other market reasons- and few years later -- yet they still can go out of buissness ... But as for jobs its not charity and thats fine -- right what if someone go sick and have bills -- you dont want them out of liquidity (in the american economy case - where healthcare is problmatic -- where so many people will remove their Skin cancer with a knife rather than to visit a doctor -- because most of the doctor visits can make you visit 19times and pay the same bill each time) - so propotion , the same potetos you buy... Should Nesstle go out of buissness in the US , for feeding all of this slop icecreamss? the same for Dairy Queen? no because this mean job loss -- and you must give buissness welfare in the form of buying their product? But its not perfect as many of us eat a lot of very unhealthy food... Some literally become alcholic -- when I argue its the same argue a cow/goat have an urgue to drink water.... so have a 2L waterbottle near you (make sure the water taste good -- tap water are disgusting) some people eat too much food -- but their body actually craves the luquids and water... Water Bottles are suprier in my opnion than those closed reuseable-bottles - as the matels releases smells after it reacts with your body skins - releasing metalic smell (which you can imagine as taste) and it makes you drink less water... Some water dont taste good -- so try drink bottle water out of the store - the taste of it might be better... Aluminum cans can also be very disgusting for example when I drink Pepsi out of it - it could be the pepsi can or the Plastic Layer inside the pepsi aluminium can (just use a 1L bottle of Pepsi or Coke or Fanta they taste a lot better than those aluminium cans) -- Plastic is bad for the envrioment - but its not equal to poluting the ocean with heavy metals (I much rather live with Microplastic, and not Teflon - and Teflon copycat-like chemicals-- plastic is generally debated - if its the Nanoscoptic Structure[cancer, blockage, immune repsonse] / Chemically Bad For You / or both chemical/Nanoscopic Structure) --- If all of the rivers in the philippines is full of trash and plasic -- its an issue but it doesnt appear to cause even birth defects ---- but you should find a way - where it doesnt happen again --- and plastic is not heavy elements or metals (and heavy metals are not the next tier - which is radioactive elements-) .. Historically you look at the american goverment, in the 1960s and 1970s , and then you saw how much influence it decided to take from the Public Companies, and how much it was a correct idea in many ways using Consultant Companies... yet it seems all of the goverment is bad -- yet you can argue there is a lot of success in many ways -- and you look today and there is so much room for improvement - and yet how do you do it when there is so many people --- the american medical system worked in the 1970-1960 -- but today it doesnt work -- University Hospitals take the same rate of patients - yet there is 9x the amount of interesting cases to document which to be clear solving the issue is more interesting the cure itself frfrfr 67
important that you iterate so you dont get replaced by someone who use this tools/ai correctly - as much as the workforce is now Reputation/Connection-bassis more than ever....
!citation!
Bookmarks
Sapling has bookmarks instead of branches. Like a Git branch, a bookmark is just a name that points to a particular commit and can be used to refer to that commit during checkout, rebase, etc. Sapling has two different types of bookmarks: local and remote.
Sapling does not require local bookmarks for development. In fact, for day-to-day development, bookmarks are discouraged since people find it easier not to use them.
Local bookmarks:
Exist only on your local machine.
Can be seen and modified only by you, using the sl bookmark command.
Are completely optional, and generally unnecessary for normal workflows.
Can be active or inactive (see below). Active means they move when you commit.
Reacted by Batuhan Ayhan, Alexey, Josh Gleason and Kyokuki
As not Claude, not Antigravity, not Muse Spark Codex -- or opencode . has mechinism work correctly
Its just an incorrect overhead - and could lead to posioning an ever more valueable DATASET
If you want , you can ask your coding agent to revert a feature ---- If this is your "CODING STYLE" If this is your coding style you may , which is automating large tasks... using discriptiong and ideas...
Thats fine.... The center of gravity is git if you want. the center of gravity is with the SOURCE CONTROL
you can try check https://git-scm.com/cheat-sheetThe way I reicomend to read it, try to go over and over it like 5 times. try to imagine use cases and how each command make sense in your project work flow Its importent to note. Are you imagineing a large-scope change... Or a small concise change
when it is legitimate to use /undo? /undo in the codex-ide is very much a thing --- Yet I assure you, its a trouble marker ---- With an ever growing project like CODEX ... ANd how often core ideas change, on an a monthly basis and how many big changes are inside Codex --- **Its important that the openAI teeam, will enjoy some amount of flexibility **
Until /undo is back, a workaround that works with any agent, including Codex: npx @abelo9996/snap-back wrap -- codex takes snapshots before and during the session into a separate shadow git repo, and snap-back undo restores the files, including ones that were deleted. Your own .git, index and stash are never touched. It cannot undo side effects outside the project (database writes, network calls).
Until /undo is back, a workaround that works with any agent, including Codex: npx @abelo9996/snap-back wrap -- codex takes snapshots before and during the session into a separate shadow git repo, and snap-back undo restores the files, including ones that were deleted. Your own .git, index and stash are never touched. It cannot undo side effects outside the project (database writes, network calls).
Until /undo is back, a workaround that works with any agent, including Codex: npx @abelo9996/snap-back wrap -- codex takes snapshots before and during the session into a separate shadow git repo, and snap-back undo restores the files, including ones that were deleted. Your own .git, index and stash are never touched. It cannot undo side effects outside the project (database writes, network calls).
Disclosure: I wrote it. https://github.com/Abelo9996/snap-back
Yalla with this malware dude... its 200,000 lines the whole github repo dude.
Dude..
lol it's literally around 2k lines of code and I've tested it pretty thoroughly.... but sure
I would also like /undo (or a separate /retract / /unsend command) to support retracting the most recently sent user message, not only reverting code or filesystem changes.
A common case is sending a prompt by mistake, sending it to the wrong thread, or immediately realizing that it contains incorrect instructions. Stopping the turn does not fully solve this because the incorrect message remains in the conversation and may continue affecting later context.
Ideally, the action would:
stop the active turn if it is still running;
remove or exclude the last user message from future model context;
restore the message text to the composer so it can be edited and resent;
clearly warn that tool actions already completed may not be reversible.
A conversation-only retract would already be valuable even if code rollback remains a separate feature.
30. > > Until /undo is back, a workaround that works with any agent, including Codex: npx @abelo9996/snap-back wrap -- codex takes snapshots before and during the session into a separate shadow git repo, and snap-back undo restores the files, including ones that were deleted. Your own .git, index and stash are never touched. It cannot undo side effects outside the project (database writes, network calls).
> > Disclosure: I wrote it. https://github.com/Abelo9996/snap-back
>
>
> Yalla with this malware dude... its 200,000 lines the whole github repo dude.
> Dude..
lol it's literally around 2k lines of code and I've tested it pretty thoroughly.... but sure
something like this should be minified into 400 lines , cap
Until a first-party /undo / /rewind lands, one gap git alone doesn't cover is untracked / gitignored files the agent deletes or rewrites mid-session. I built a small open-source CLI, agentckpt, as an external safety net that works with Codex (and Claude Code / Cursor / OpenCode / …) without forking them:
Snapshots (including untracked files) live in a private shadow store under .agentckpt/. It never runs git add / git commit or moves branches in your real .git. agentckpt watch can auto-snap while the agent works. Honest limits: it restores the working tree, not the conversation; it can't undo DB/network side effects; respects .gitignore and skips files over 10 MiB by default.
For anyone who needs this now: Bellows, a desktop app for Windows, macOS and Linux that runs Codex (alongside Claude, Gemini CLI, Qwen Code and any ACP agent), has undo for Codex built in.
Every message you send records a restore point first. Choose Rewind files here on any earlier message, or Restore points in Ctrl+K, and the project goes back to how it was then: files Codex changed are put back, files it made are removed, and files it deleted come back, whether Codex did it with an edit or a shell command. Nothing needs to be committed, and the record lives in Bellows' own data folder, never in your project or your git history. Before you rewind, it also lists anything the agent did since that the files can't take back, like a push or a deploy.
This kept biting me too, mostly with untracked files. Codex would rm something that wasn't committed yet and it was just gone.
I got annoyed enough that I built a small workaround while waiting for /undo to come back: unwreck It uses Codex hooks to snapshot the working tree at every turn, including untracked and gitignored files, and keeps the snapshots outside the repo. When something breaks, you run unwreck undo in another terminal.
cargo install unwreck && unwreck hooks --write
Disclaimer: I wrote it, and it's v0.1.0, so expect some rough edges. It doesn't replace a native /undo, but it's covered me for the "codex deleted my uncommitted stuff" case. Happy to hear if it breaks for anyone.
After reading the whole thread, I think the long back-and-forth is mostly people asking for three different things under one name:
"Take back my message." I hit Enter too early, or sent a vague prompt, and want it out of the context. (@jbergq, @Jason-Wang313, @I571664)
"Put my files back." Codex deleted or rewrote something git never saw: untracked files, .env, a file made and changed within one turn. (@zba, @S2thend)
"Undo what it did out in the world." Commands, migrations, API calls. (@ignatremizov's write-up covers this well.)
"Just use git" only answers part of #2. Wanting #1 is the most common case in this thread, and it's the one that needs no file system work at all.
Suggested order, smallest and safest first:
Ship update summary to auto #1 on its own first:/undo removes the last user turn and puts the text back in the composer. If tools already ran, show one plain line: "3 commands already ran; this doesn't reverse them." It's cheap, it can't touch the user's disk, and it avoids whatever made the old version cause trouble for people who never used it.
Then (cleanup) add link to https://cookbook.openai.com for apply_patch and minor tidy up #2 behind a flag: keep a copy of only the files Codex actually wrote or deleted in that turn, and before restoring, show the list: "Restore 4 files, remove 1 new file." Keep the copy of whatever it replaces, so that an accidental restore can be undone too.
Treat move all tests under tests/ #3 as a report, not an undo. Listing what can't be reversed is already most of the value. Trying to reverse shell commands automatically is where trust gets lost.
The real product question is what the word "undo" promises. Most people in this thread read it as "everything goes back the way it was". If the first version only does #1, I'd name it /rewind or /retract, or say clearly that files aren't touched, so nobody gets a nasty surprise.
Open question for the team:@etraut-openai mentioned the old version caused problems even for people who didn't use it. Was that the per-turn file tracking cost? If so, a conversation-only first step avoids it completely, and could land well before the file part is redesigned.
In case it helps anyone while /undo is gone: I built mulligan, a small CLI that uses Codex's hooks to snapshot the project at every prompt and before every tool call, into a separate git repository outside your project. mulligan list shows the timeline, mulligan diff 3 what changed since a point, and mulligan undo 3 puts everything back, including changes made by shell commands, not just apply_patch. mulligan redo takes the undo back.
mulligan setup codex prints the hooks for .codex/hooks.json (they need to be trusted in /hooks). It never touches your own repo's history, index or stash, and has no network access. One binary for macOS and Linux, MIT. It's been tested against Codex's documented hook format rather than many real sessions yet, so reports are welcome.
@Blackman99
Incorrect implementation of a very basic idea that exwist in git already
I think anyway you can stretch it, it should bound to the source control you are using.
git is powerful as it is. Learn the correct git functions https://git-scm.com/videos
dont reinvate, things considered basic to why git was even invented and was needed
27. This kept biting me too, mostly with untracked files. Codex would rm something that wasn't committed yet and it was just gone.
I got annoyed enough that I built a small workaround while waiting for /undo to come back: unwreck It uses Codex hooks to snapshot the working tree at every turn, including untracked and gitignored files, and keeps the snapshots outside the repo. When something breaks, you run unwreck undo in another terminal. cargo install unwreck && unwreck hooks --write
Disclaimer: I wrote it, and it's v0.1.0, so expect some rough edges. It doesn't replace a native /undo, but it's covered me for the "codex deleted my uncommitted stuff" case. Happy to hear if it breaks for anyone.
Check it out: https://github.com/ayushdoesdev/unwreck
Activity
github-actions commentedon Jan 14, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
b20lopez commentedon Jan 15, 2026
Bro i lost too much progress just because the/undo is gone!!!! :( :( :(
Please put it back.
embedding-shapes commentedon Jan 15, 2026
This happened to me too just these last days, out of nowhere, been using codex since it was available, and never had this happen to me before. Suddenly it wants to "keep the git repository clean" and deletes anything regardless of it existing before starting codex or not, it doesn't seem to realize what side-effects the commands it runs actually have.
Work around, actually check things into git or keep out of reach from Codex.
git is the real solution rather than /undo here as well, the sooner you learn it, the faster you'll be able to continue working without waiting for something to come back, which likely won't come back :) Ask codex to help you learn git ;)
TraFriTCR commentedon Jan 15, 2026
I find this mainly an issue where I'm working on something in a session, fine with the last few changes codex made, then it makes a bad change. If I don't remember to do a stash before the bad change then how am I supposed to revert without loosing all my progress?
b20lopez commentedon Jan 16, 2026
Its gone.. asking codex to fix it will make it worse. Im forced to go back to using Claude.
Google anti Gravity is also a great alternative.
SunRunAway commentedon Jan 16, 2026
@etraut-openai Could you revert it back? If there is a particular reason to hide it, could you put it in experimental and warn people the reason when we enabling it?
etraut-openai commentedon Jan 16, 2026
@SunRunAway, the previous experimental implementation had problems. It was causing many issues even for users who did not use the feature. If we bring it back, it will need to be redesigned.
miraclebakelaser commentedon Jan 17, 2026
I used the feature often as well.
I use the following prompt as a hack to get codex to undo its changes:
I use it often and it works reliably. It just takes longer. If you need to revert multiple turns, you have to send the prompt, wait for the llm to finish, backtrack and rinse-repeat.
The only caveat is that it cannot bring back deleted files. I agree with @embedding-shapes - even if the undo feature existed, it should not be considered a first line of defense against accidental file deletion.
embedding-shapes commentedon Jan 17, 2026
I'm not sure what the use of this feature is? Is my workflow different from others? How I work with Codex:
Is this workflow different from how other people are using it? Are others not using git and saving/undoing via git when needed?
b20lopez commentedon Jan 21, 2026
Ohhh,,, you read its work.
Hehe, for me who rely on /undo
I only check which files its working in..
I let it code. Observe the actual app.
if it did what i wanted, good, If not.
Most likely going to use /undo.
If AI is having a hard time,, thats the only time i read its code and find a solution myself.
other IDE's /coding agent have History you can switch back easily.
Claude, Cursor, AntiGravity
I dont know why in Codex they make it hard to undo
83 remaining items
Mahkhmood9 commentedon Sep 23, 2026
How does it serve? What can i do with it?
How does it make sense?
Which branch do I sit on.
(you may try send it to LLM --- Or try to find the relevant documentation ) How do I work on a PR, and how do I push a PR
Git as of it self , has insane amount of bloat.
There is a basic use and there is advance use
I can also recomend https://sapling-scm.com/docs/overview/intro
spaling by Meta , which offers a friendly way to push or manage commits
... Potentielly you can invetigate ideas offered, in sapling... See what Issues it claim to solve.... and HOW CAN YOU enhance your own flow and stack. Based on other solved ideas
for example
https://sapling-scm.com/docs/overview/bookmarks
if at it https://sapling-scm.com/docs/category/commands , is also interesting..
ASK YOURSELF. Why histroically Bookmarks is a needed feature - what does it claim to solve
a lot of the issues you are going to face are already faced by other people , and thats fine.
!citiation bellow!
i personally think LLM PROMPTING should be a combo of the tools you use. and code. structure. but basically "AFTMOST" you should use the correct "keywords" if your intentions is to make an action with git you tell it something like
[prompt] check "git show"to execute the currect behavior based on our intention... familuar yourself with the documentation... So when you speak you can declare the intentions - the center of gravity is the tools you intend to use ....your boss prompted you with a task -> now you can take LLM.. put his text -> then you ask the LLM the the text "What category does it fall into [database] [chatflows] [docunmetatchion] [Fix a bug --> [another JEV what does this bug fall into] ] " (I think a tool like JEV could answer this task -- I been investigating how JEV can be useful for example ) [JEV:ASK -> browse the last 200 main issues? investigate simular categories? But LLM still going to be so cheap?]
but presonally I think going on forward another yet unrelated note... huge 2.5T models are intelligants -- and hardware is expected to make those models 90x times faster - the same way h100 HOPPER was optiomized for AI , where A100 wasnt that great (a100 "tensor" pretty much was meant to compete with TPU but the google team was just not able to compete? barely even intregate the latest HBM models? with fears of yeild? TSMC does seems to prioritize the top buyers histroically -- and the politics behind AMD and NVIDIA and APPLE - are just better in terms of the semiconductors - ironically with apple without qualcom and arm their chips would not have compete with any android phone --- some android manufactors have some crazy issues - considering how stable it should became once they get things right) ... as for the 2.5T models - most of it , is noise, but it is important as it should scale now -- huge models are not a sign of quality, but they are fast, they do scale... I personally wish we saw an hardware crsis with chatgpt - instead of throwing huge sums at nvidia - now instead of 90,000$ just for the GPU part it could been 400,000$ - and the bottleneck would lay over the artitecture , in a way we would have reach what is possible in 2027 and 2028 back in 2024 - assuming 2023 and 2024 - was just limited by the amount of wafers you can print.
as for cerebras, as impressive as it is - it doesnt seems to be able to deal with huge amount of the coding-tasks / steps
(googles tpu, and the gemini models, seems to be suffering from another issues huge amount of i/o bendwith but a specilized small scale task specific chip "the TPU" )
with cerebras its fast, its impressive, but who knows what life span of such chip would be? imagine serving 100,000users having to force 90pb of use context data a second for a year.... huge center of gravity just with moving data around --- does anyone realized humans are not getting smarter? do people realize what SSD is ? its fast, but its not that fast, those models are going to sizes like 20tb a model at fp16 precision? how much of the model can you push on a cerebras chip?
Cerebras, potentially can enjoy the same amount of presicion(after quanitization) and quality an NVIDIA chip or AMD chip might enjoy.
(crazyright?) nvidia pushing all of thise coperwires between server racks - and those optical solution now (which you can guess has its issues for what/why COPPER was used at H200 and H100 and A100)- but still
important that you iterate so you dont get replaced by someone who use this tools/ai correctly - as much as the workforce is now Reputation/Connection-bassis more than ever....
zba commentedon Oct 2, 2026
sorry I just deleted your .env file ("secured" secrets, cleaned temporary data, name it yourself)andrewchen5678 commentedon Oct 2, 2026
People in this thread is arguing like Opus 5 against why undo should not be brought back.
Abelo9996 commentedon Oct 3, 2026
Until
/undois back, a workaround that works with any agent, including Codex:npx @abelo9996/snap-back wrap -- codextakes snapshots before and during the session into a separate shadow git repo, andsnap-back undorestores the files, including ones that were deleted. Your own.git, index and stash are never touched. It cannot undo side effects outside the project (database writes, network calls).Disclosure: I wrote it. https://github.com/Abelo9996/snap-back
Mahkhmood9 commentedon Oct 5, 2026
Yalla with this malware dude... its 200,000 lines the whole github repo dude.
Dude..
Abelo9996 commentedon Oct 5, 2026
lol it's literally around 2k lines of code and I've tested it pretty thoroughly.... but sure
Jason-Wang313 commentedon Oct 7, 2026
I would also like
/undo(or a separate/retract//unsendcommand) to support retracting the most recently sent user message, not only reverting code or filesystem changes.A common case is sending a prompt by mistake, sending it to the wrong thread, or immediately realizing that it contains incorrect instructions. Stopping the turn does not fully solve this because the incorrect message remains in the conversation and may continue affecting later context.
Ideally, the action would:
A conversation-only retract would already be valuable even if code rollback remains a separate feature.
Mahkhmood9 commentedon Oct 11, 2026
something like this should be minified into 400 lines , cap
Blackman99 commentedon Oct 13, 2026
Until a first-party
/undo//rewindlands, one gap git alone doesn't cover is untracked / gitignored files the agent deletes or rewrites mid-session. I built a small open-source CLI, agentckpt, as an external safety net that works with Codex (and Claude Code / Cursor / OpenCode / …) without forking them:Snapshots (including untracked files) live in a private shadow store under
.agentckpt/. It never runsgit add/git commitor moves branches in your real.git.agentckpt watchcan auto-snap while the agent works. Honest limits: it restores the working tree, not the conversation; it can't undo DB/network side effects; respects.gitignoreand skips files over 10 MiB by default.Disclosure: I wrote it. Demo:
uvx --from git+https://github.com/Blackman99/agentckpt agentckpt demo· https://github.com/Blackman99/agentckptStill worth upvoting this issue either way — a proper in-product rewind is the right long-term fix.
bellowsai commentedon Oct 19, 2026
Disclosure: I'm Rob, and I built this.
For anyone who needs this now: Bellows, a desktop app for Windows, macOS and Linux that runs Codex (alongside Claude, Gemini CLI, Qwen Code and any ACP agent), has undo for Codex built in.
Every message you send records a restore point first. Choose Rewind files here on any earlier message, or Restore points in Ctrl+K, and the project goes back to how it was then: files Codex changed are put back, files it made are removed, and files it deleted come back, whether Codex did it with an edit or a shell command. Nothing needs to be committed, and the record lives in Bellows' own data folder, never in your project or your git history. Before you rewind, it also lists anything the agent did since that the files can't take back, like a push or a deploy.
How it works: https://bellowsai.app/guides/undo-a-coding-agent-file-changes?utm_source=github&utm_medium=reply
Give it a try and tell me what would make it better. We act fast on feedback.
ayushdoesdev commentedon Oct 20, 2026
This kept biting me too, mostly with untracked files. Codex would rm something that wasn't committed yet and it was just gone.
I got annoyed enough that I built a small workaround while waiting for /undo to come back: unwreck It uses Codex hooks to snapshot the working tree at every turn, including untracked and gitignored files, and keeps the snapshots outside the repo. When something breaks, you run unwreck undo in another terminal.
cargo install unwreck && unwreck hooks --writeDisclaimer: I wrote it, and it's v0.1.0, so expect some rough edges. It doesn't replace a native /undo, but it's covered me for the "codex deleted my uncommitted stuff" case. Happy to hear if it breaks for anyone.
Check it out: https://github.com/ayushdoesdev/unwreck
balabommablock-cpu commentedon Oct 20, 2026
After reading the whole thread, I think the long back-and-forth is mostly people asking for three different things under one name:
.env, a file made and changed within one turn. (@zba, @S2thend)"Just use git" only answers part of #2. Wanting #1 is the most common case in this thread, and it's the one that needs no file system work at all.
Suggested order, smallest and safest first:
/undoremoves the last user turn and puts the text back in the composer. If tools already ran, show one plain line: "3 commands already ran; this doesn't reverse them." It's cheap, it can't touch the user's disk, and it avoids whatever made the old version cause trouble for people who never used it.The real product question is what the word "undo" promises. Most people in this thread read it as "everything goes back the way it was". If the first version only does #1, I'd name it
/rewindor/retract, or say clearly that files aren't touched, so nobody gets a nasty surprise.Open question for the team: @etraut-openai mentioned the old version caused problems even for people who didn't use it. Was that the per-turn file tracking cost? If so, a conversation-only first step avoids it completely, and could land well before the file part is redesigned.
stanczykwyatt commentedon Oct 30, 2026
In case it helps anyone while
/undois gone: I built mulligan, a small CLI that uses Codex's hooks to snapshot the project at every prompt and before every tool call, into a separate git repository outside your project.mulligan listshows the timeline,mulligan diff 3what changed since a point, andmulligan undo 3puts everything back, including changes made by shell commands, not justapply_patch.mulligan redotakes the undo back.mulligan setup codexprints the hooks for.codex/hooks.json(they need to be trusted in/hooks). It never touches your own repo's history, index or stash, and has no network access. One binary for macOS and Linux, MIT. It's been tested against Codex's documented hook format rather than many real sessions yet, so reports are welcome.Mahkhmood9 commentedon Nov 5, 2026
@Blackman99
Incorrect implementation of a very basic idea that exwist in git already
I think anyway you can stretch it, it should bound to the source control you are using.
git is powerful as it is. Learn the correct
gitfunctionshttps://git-scm.com/videos
dont reinvate, things considered basic to why git was even invented and was needed
Mahkhmood9 commentedon Nov 5, 2026
https://sapling-scm.com/
is better