Crash caused by missing pointer in underlying C++ code
What version of the Codex App are you using (From “About Codex” dialog)?
2026.3.10,on micosoft store
What subscription do you have?
plus
What platform is your computer?
Microsoft Windows NT 10.0.26100.0 x64
What issue are you seeing?
我在使用codex app的时候,遇到一个问题,就是任务会话进行中的时候,一旦强行关闭codex app或者被意外关闭,那么再次进入到时候,它的会话就会卡死,被无限挂起,用户在GUI上不能停止这个会话,也不能继续会话。这非常影响工作效率和用户体验。
What steps can reproduce the bug?
在电脑上下载codex app,开启一个gpt5.4的高强度推理模式,然后随便发一个比较长时间的任务,比如阅读这个框架项目。然后在执行过程中,直接关闭codex app。再次进入,打开刚才的对话,就发现卡死了
What is the expected behavior?
我期望是,关闭codex app后,没有终止的会话直接终止,类似antigravity和cursor 一样,或者是,会话后台继续,但是至少用户可以点击终止按钮终止或者是补充继续对话,而不是卡死。
Additional information
这是我用antigravity分析和尝试解决的结果,希望能帮助到你们!
故障原因分析:
这个报错(remove_pty_baton(baton->id))是 node-pty 模块的一个底层 Bug:当 Codex 内部开启的后台交互终端(比如它正在读取项目文件或运行命令时)被不正常地强制中断,它的底层 C++ 代码会抛出指针缺失的强退报错。
导致应用“继续卡死转圈”的罪魁祸首是:应用闪退前,当前聊天的记录日志(~/.codex/sessions/**/*.jsonl)刚写下了 "开始了某个任务..."(task_started 事件),由于没有机会写下对应的 "任务结束"(task_complete)标签就崩溃了。
此时,每次 Codex 重启并读取你的历史聊天记录时,都会发现最后有一条一直“未完结”的任务,所以界面就会误以为它还在执行,并永远转圈,而你在 UI 上点停止按钮也无法打断一个其实已经死掉的进程。
我执行的操作: 完全不必删掉重装或清空你的历史记录。我直接编写并执行了一个微型 Python“修复脚本”。 该脚本扫描了你本地存储的 Codex 所有会话日记流(JSONL 文件),自动锁定了那条在崩溃中被卡住的特定“幽灵任务”,并人工在文件末尾向它注入了一条伪造的 turn_aborted (任务已强制中止) 事件指令。
2 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
English translation:
When using the Codex App, I encountered a problem where if a task session is running and the Codex app is forcibly closed or unexpectedly crashes, the conversation becomes permanently stuck when reopening the app.
After restarting Codex and opening that conversation again, the session remains frozen and endlessly pending. The user cannot stop the session in the GUI and cannot continue the conversation. This seriously impacts productivity and user experience.
What steps can reproduce the bug?
Download and install the Codex app on a computer.
Start a task using GPT-5.4 high-intensity reasoning mode.
Submit a long-running task (for example, asking it to read a framework project).
While the task is executing, force-close the Codex app.
Reopen Codex and open the same conversation.
At that point the session will be stuck.
Root cause analysis
The error (remove_pty_baton(baton->id)) is caused by a low-level bug in the node-pty module.
When Codex’s internal background interactive terminal (for example while reading project files or executing commands) is forcibly interrupted, the underlying C++ code throws a missing pointer crash.
The real reason the application stays stuck in an infinite loading state is:
Before the crash, the chat session log (~/.codex/sessions/**/*.jsonl) recorded a "task_started" event.
However, because the app crashed, it never wrote the corresponding "task_complete" event.
When Codex restarts and reads the session history, it sees a task that appears unfinished, so the UI assumes the task is still running and keeps spinning indefinitely. The “Stop” button in the UI cannot terminate it because the process is already dead.
My workaround
There is no need to reinstall the app or delete history.
I wrote and executed a small Python repair script that:
Scans all local Codex session logs (JSONL files).
Locates the specific “ghost task” that got stuck due to the crash.
Injects a fake turn_aborted event at the end of the file to mark the task as forcibly terminated.
This restores the conversation and prevents the infinite loading state.
If you'd like, I can also help you
produce a shorter “maintainer summary” version of this issue (the kind that’s easier to triage internally). That’s often useful when you're reviewing a lot of international bug reports in the Codex repo.