Repository navigation
Windows desktop app repeatedly restarts after corrupted local state; chat_processes.json can become all NUL bytes #29593
Description
Environment
- OS: Windows
- Codex Desktop package: OpenAI.Codex 26.616.9593.0
- App path:
C:\Program Files\WindowsApps\OpenAI.Codex_26.616.9593.0_x64__2p2nqsd0c76g0\app\Codex.exe - Local Codex state path:
C:\Users\PC\.codex\process_manager\chat_processes.json
Problem
Codex Desktop restarted/crashed several times.
One confirmed failure mode was a corrupted local state file:
C:\Users\PC\.codex\process_manager\chat_processes.json
The file was 4600 bytes, and every byte was 0x00. Codex repeatedly logged JSON parse errors when trying to load it.
Relevant log message:
Failed to register chat process notification
Unexpected token '\u0000', "\u0000\u0000..." is not valid JSON
at JSON.parse
After deleting chat_processes.json, Codex recreated it as valid JSON and the Unexpected token '\u0000' error stopped.
Additional restart after deleting corrupted file
After the file was recreated successfully, Codex Desktop restarted again.
Observed timeline:
- 2026-06-23 16:19:49: Codex AppX process created, PID 29740
- 2026-06-23 16:22:32: last log line from that instance
- 2026-06-23 16:22:38: Windows AppModel logged Codex AppX container destroyed
- 2026-06-23 16:23:00: Codex AppX process recreated, PID 24884
The last Codex log line before the restart was:
warning [electron-sampler] Failed to collect child process snapshot
errorMessage="Unexpected end of input"
errorName=SyntaxError
There was no new codex.exe.*.dmp in:
C:\Users\PC\AppData\Local\CrashDumps
Windows Application logs did not show a normal Application Error for Codex at that time.
Expected behavior
Codex should not repeatedly restart or fail when a local state JSON file is corrupted.
Ideally:
- Local JSON state writes should be atomic.
- On startup, corrupted JSON state should be detected.
- The corrupted file should be quarantined or rebuilt automatically.
- The app should continue running instead of repeatedly logging parse errors or restarting.
Suspected root cause
The corrupted chat_processes.json appears to have been caused by an interrupted write.
The file's last write time was close to a Windows Kernel-Power 41 / BlueScreen event on the same machine. This suggests the machine may have crashed or restarted while Codex was writing the JSON state file.
Even if the original interruption was caused by the OS, Codex should handle corrupted local state defensively on the next launch.
Workaround
Deleting:
C:\Users\PC\.codex\process_manager\chat_processes.json
allowed Codex to regenerate the file as valid JSON and stopped the Unexpected token '\u0000' log spam.
However, the app still restarted once afterward, with the final log line:
Failed to collect child process snapshot
Unexpected end of input
Logs / evidence available
I can provide the relevant Codex Desktop logs from:
C:\Users\PC\AppData\Local\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Local\Codex\Logs\2026\06\23
Key files include:
codex-desktop-01ee51bf-c616-45d7-a6a4-9a3159d79768-11080-t0-i1-061445-0.log
codex-desktop-37579744-5983-44e3-95d1-f563c735cc39-36280-t0-i1-080201-0.log
codex-desktop-3d207933-0368-4bf6-81f7-baa41015ffa7-29740-t0-i1-081950-0.log
codex-desktop-369818eb-461c-4cbc-8b41-fa2c6d6cb05c-24884-t0-i1-082300-0.log
Activity
HyperSpAceBoy commentedon Jul 13, 2026
Current-build source still lacks atomic writes and malformed-file recovery
I hit the same Windows corruption shape on recent 26.707 Desktop builds:
process_manager/chat_processes.json: 84,599 bytesDuring the affected day, sanitized Desktop-log counts included:
Conversation state not founderrorsipc-connection-resetbroadcastsresponse_orphanedrecordsI am not claiming every adjacent state error was caused solely by this registry, and Windows WER did not provide enough evidence to label every disappearance a native crash. The proven defect is that one malformed local registry remained on a hot notification path and generated thousands of failures without self-recovery.
After updating/restarting into Desktop 26.707.8479.0, the registry on this machine was recreated as valid JSON and the NUL parse spam stopped. That is a recovery event, but it is not evidence of a durable fix.
Read-only inspection of the current
26.707.8479.0production bundle still shows:ENOENTJSON.parsefailure is rethrownwriteFile(finalPath, JSON.stringify(...))directlyThe current session also continues to log hundreds of
Conversation state not found/unknown conversationmessages, although I am treating that as adjacent state churn rather than attributing all of it to this file.Please do not close this based only on one update/restart recreating the file. Required fix:
A desktop app must survive corrupt cache/registry state without repeated restarts, log storms, or unsupported manual surgery.
faekz0r commentedon Jul 18, 2026
Corroborating this on a newer Windows Desktop build, with a 0-byte variant and a less severe user-visible symptom.
Environment
OpenAI.Codex 26.715.2305.0Observed state
%USERPROFILE%\.codex\process_manager\chat_processes.jsonexisted but was exactly 0 bytes. Its last-write timestamp preceded the next Windows reboot; I cannot confirm what originally truncated it.During the following Codex session, the Desktop log recorded 154 failures of this form:
The same error also occurred for
method=item/completed, effectively twice around many command/tool events.The user-visible symptom was intermittent, very short pauses in Codex's text composer while a long-running task was actively doing work: typed characters would briefly stop appearing and then catch up. There was no renderer crash, GPU-process crash, OOM event, paging pressure, CPU run queue, or disk-latency spike in concurrent checks. The parse/retry/log path is therefore a plausible contributor to the composer stalls, although that timing relationship is an inference rather than a captured UI trace.
Workaround and verification
I backed up the empty file, then initialized it to valid empty JSON:
Codex remained open. It subsequently populated the file with valid process records. After the repair:
item/startedanditem/completedevents were handled;Unexpected end of JSON inputwarnings appeared across multiple subsequent tool events.This supports the same defensive fixes proposed in the original report:
Raw logs and the process-record contents are not attached because they can contain local paths and command strings, but additional sanitized timestamps/counters can be provided if useful.
abiodunonanuga commentedon Jul 22, 2026
Corroborating this again on a newer Windows Desktop build, with direct conversation-recovery impact.
Environment
OpenAI.Codex 26.715.10079.0Malformed state and log evidence
%USERPROFILE%\.codex\process_manager\chat_processes.jsonexists but is exactly 0 bytes (last write: 2026-07-20 12:18 local time).On 2026-07-22, the Desktop log recorded 137 failures between 18:00:07Z and 18:16:21Z:
The same failure also occurred for
method=item/completed.The process then logged:
A new Desktop/app-server process started immediately afterward. A second
ipc-connection-resetand disconnect occurred at 18:20:59Z, followed by another process start.User-visible impact
This was not limited to log spam or brief composer pauses:
systemError.I have not modified or deleted the empty registry, so this report describes the failure state as observed. I am not claiming the 0-byte registry proves every adjacent connection reset was caused by it, but the repeated
JSON.parsefailures on the chat-process notification path and the same-session thread failure make the recovery/isolation requirement materially stronger.Expected behavior: an empty or malformed process registry should be quarantined/rebuilt automatically and must not cause an existing thread to enter an unrecoverable
systemErrorstate or silently accept turns without agent responses.Raw logs are not attached because they include local paths, conversation content, and tool outputs. Sanitized excerpts or counts can be provided if maintainers need them.
abiodunonanuga commentedon Jul 22, 2026
Follow-up: I found and verified a second, newly created local thread that later failed in the same session.
This matters because the second thread was created specifically to recover from the first failed thread; it was not the original 1.2 GB conversation.
Second-thread evidence
OpenAI.Codex 26.715.10079.00.145.0-alpha.30systemError%USERPROFILE%\.codex\process_manager\chat_processes.jsonremained 0 bytesThe recovery thread initially operated normally: it read the failed thread's history, recovered artifacts, ran tools, coordinated subagents, generated images, and modified local project files.
Then six separate turns ended with:
Failure window:
Some turns emitted partial agent commentary or completed tool/file operations before the stream disconnected, but every affected turn ended with the backend-stream error. After the final failure, the new recovery thread itself became
systemErrorand another new chat had to be created.Updated interpretation
The original thread's 1.2 GB history may have made that specific thread difficult to load, but it cannot by itself explain this second failure: a new recovery thread also failed repeatedly and became unusable after about 50 minutes.
The 0-byte
chat_processes.jsonwas global state shared across both failures and was not automatically rebuilt. This recurrence is consistent with malformed process-registry state destabilizing more than one conversation, although it still does not prove that the registry caused every backend disconnect.The required recovery behavior should therefore include both:
systemError.Raw rollout and Desktop logs are not attached because they contain local paths, conversation content, generated-image payloads, and tool outputs. Sanitized per-turn timestamps and IDs can be provided if needed.
dimasyankauskas commentedon Jul 25, 2026
macOS truncated-file variant on current Desktop build
Corroborating this on macOS with ChatGPT Desktop 26.721.41059 (build 5848).
Read-only inspection found
~/.codex/process_manager/chat_processes.jsonin a different malformed state from the previously reported zero-byte/all-NUL variants:0x280000)commandstringIn one fixed post-restart log window, the same file produced 1,169
Failed to register chat process notificationwarnings, approximately evenly divided betweenitem/startedanditem/completed.Read-only inspection of the installed bundle shows that the loader retries the file whenever the in-memory record cache remains unset, while malformed JSON is rethrown rather than quarantined or rebuilt. The writer serializes directly to the final path with
writeFile(...); I did not find a same-directory temporary write plus atomic replacement. The registry is limited by record count, but I did not observe a bound on an individual command string.The exact 2.5 MiB boundary is consistent with an interrupted chunked write, but I do not have contemporaneous crash evidence proving what interrupted it.
I am not claiming that this registry caused every adjacent conversation-state warning. The confirmed cross-platform defect is that a truncated registry remains permanently active on a hot notification path with no automatic recovery.
Raw logs and the registry are intentionally not attached because they contain command strings, local paths, and conversation identifiers.