openai / openai/codex

[Windows] NUL-corrupted state wipes projects and backup

Open
#38,757 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug session windows-os
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

What version of the Codex App are you using (From “About Codex” dialog)?

26.810.4967.0

What subscription do you have?

Pro

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

All existing projects disappeared from the Codex App after startup.

At 07:18:45 on 2026-08-15, Codex loaded a NUL-filled .codex-global-state.json as empty state. It then saved the replacement project registry and copied it to .bak, overwriting the recovery backup without warning.

Existing chat rows and workspace folders remained on disk, but the project list and thread-to-project mappings were gone. Creating one test project produced a registry containing only that project; none of the previous chats were reattached.

This is persistent metadata loss, not a sidebar display or cache problem.

What steps can reproduce the bug?
  1. Start with a Codex profile containing multiple projects and project-linked chats.
  2. Close Codex, leaving the thread database intact.
  3. Make .codex-global-state.json invalid by filling it with NUL bytes.
  4. Launch Codex.
  5. Codex opens without an error and shows an empty Projects list.
  6. Create one test project and restart.
  7. Only the test project remains. Previous mappings are absent, and .bak contains the replacement state instead of the last known-good registry.

Observed result: the registry changed from 8 projects / 65 assignments to 1 project / 0 assignments while the thread database retained approximately 1,070 rows.

What is the expected behavior?

Codex must treat an invalid global-state file as a recovery event, not as a valid empty registry.

It must stop automatic writeback, preserve the last known-good backup, warn the user, and restore or rebuild project mappings from durable records. It must never copy unvalidated replacement state over the recovery backup.

Additional information

Evidence:

  • Codex App: 26.810.4967.0
  • Windows: 10.0.26200.0 x64
  • Last usable snapshot: 8 projects, 65 assignments
  • Current registry: 1 test project, 0 assignments
  • Thread database: approximately 1,070 rows
  • Failure timestamp: 2026-08-15 07:18:45 local time
  • Troubleshooting began afterward at 07:19:35
  • No task, prompt, project-name, or conversation content is included

GitHub flags #37212 as related. This incident additionally records NUL corruption and overwrite of the recovery backup.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Start by locating the code that loads and writes .codex-global-state.json and its .bak file, then trace how the thread database could supply project mappings. Done means invalid or NUL-filled state is detected, automatic writeback is stopped, the backup is preserved, and the user is warned.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, databases
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.