openai / openai/codex

codex resume omits a thread after an ordinal mismatch

Open
#38,341 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI session
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

What version of Codex CLI is running?

codex-cli 0.147.0

What subscription do you have?

Pro Lite

Which model were you using?

gpt-5.6-sol

What platform is your computer?

Linux 7.1.8-arch1-3 x86_64 unknown

What terminal emulator and version are you using (if applicable)?

Ghostty

Codex doctor report
{
  "schemaVersion": 1,
  "generatedAt": "1786614711s since unix epoch",
  "overallStatus": "warning",
  "codexVersion": "0.147.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "/home/jaideep/.codex/app-server-control/app-server-control.sock",
        "daemon state dir": "/home/jaideep/.codex/app-server-daemon",
        "mode": "ephemeral",
        "pid file": "/home/jaideep/.codex/app-server-daemon/app-server.pid (missing)",
        "settings": "/home/jaideep/.codex/app-server-daemon/settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "/home/jaideep/.codex/app-server-daemon/app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "/home/jaideep/.codex/auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "/home/jaideep/.codex",
        "config.toml": "/home/jaideep/.codex/config.toml",
        "config.toml parse": "ok",
        "cwd": "/home/jaideep",
        "enabled feature flags": "shell_tool, view_image, unified_exec, shell_snapshot, code_mode_host, terminal_resize_reflow, sqlite, hooks, enable_request_compression, multi_agent, apps, tool_search_always_defer_mcp_tools, tool_suggest, plugins, in_app_browser, in_app_updates, browser_use, browser_use_full_cdp_access, browser_use_external, computer_use, remote_plugin, plugin_sharing, image_generation, resize_all_images, item_ids, skill_mcp_dependency_install, skill_search, mentions_v2, steer, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, auth_elicitation, personality, fast_mode, tui_app_server, prevent_idle_sleep, remote_compaction_v2, workspace_dependencies",
        "feature flag overrides": "prevent_idle_sleep=true",
        "feature flags enabled": "40",
        "log dir": "/home/jaideep/.codex/log",
        "mcp servers": "2",
        "model": "gpt-5.6-sol",
        "model provider": "openai",
        "sqlite home": "/home/jaideep/.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git version 2.55.0",
      "details": {
        "PATH git #1": "/usr/bin/git",
        "PATH git entries": "1",
        "git build options": "git version 2.55.0; cpu: x86_64; built from commit: e9019fcafe0040228b8631c30f97ae1adb61bcdc; sizeof-long: 8; sizeof-size_t: 8; shell-path: /bin/sh; rust: enabled; feature: fsmonitor--daemon; gettext: enabled; libcurl: 8.21.0; OpenSSL: OpenSSL 3.6.3 9 Jun 2026; zlib-ng: 2.3.3; SHA-1: SHA1_DC; SHA-256: SHA256_BLK; default-ref-format: files; default-hash: sha1",
        "git exec path": "/usr/lib/git-core",
        "git version": "git version 2.55.0",
        "repo detected": "false",
        "selected git": "/usr/bin/git"
      },
      "remediation": null,
      "durationMs": 14
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "/home/jaideep/.local/npm-global/bin/codex",
        "current executable": "/home/jaideep/.local/npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin/codex",
        "install context": "npm (package /home/jaideep/.local/npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl, bin /home/jaideep/.local/npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin, resources /home/jaideep/.local/npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-resources, path /home/jaideep/.local/npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-path)",
        "managed by bun": "false",
        "managed by npm": "true",
        "managed by pnpm": "false",
        "managed package root": "/home/jaideep/.local/npm-global/lib/node_modules/@openai/codex",
        "npm update target": "/home/jaideep/.local/npm-global/lib/node_modules/@openai/codex"
      },
      "remediation": null,
      "durationMs": 106
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",
      "details": {
        "configured servers": "2",
        "disabled servers": "0",
        "stdio servers": "1",
        "streamable_http servers": "1"
      },
      "remediation": null,
      "durationMs": 102
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "proxy env vars": "none"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT base URL": "https://chatgpt.com/backend-api/ reachable (HTTP 404)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 265
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "DNS": "2 IPv4, 1 IPv6, first IPv6",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "handshake result": "HTTP 101 Switching Protocols",
        "model provider": "openai",
        "models etag present": "true",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 985
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running npm on linux-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "/home/jaideep/.local/npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin/codex",
        "install method": "npm (package /home/jaideep/.local/npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl, bin /home/jaideep/.local/npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin, resources /home/jaideep/.local/npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-resources, path /home/jaideep/.local/npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-path)",
        "platform": "linux-x86_64",
        "version": "0.147.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (bundled)",
      "details": {
        "search command": "/home/jaideep/.local/npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-path/rg",
        "search command readiness": "file exists",
        "search provider": "bundled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "Never",
        "codex-linux-sandbox helper": "/home/jaideep/.codex/tmp/arg0/codex-arg0Nh1I9f/codex-linux-sandbox",
        "execve wrapper helper": "/home/jaideep/.codex/tmp/arg0/codex-arg0Nh1I9f/codex-execve-wrapper",
        "filesystem sandbox": "unrestricted",
        "network sandbox": "enabled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "/home/jaideep/.codex (dir)",
        "active rollout files": "1381 files, 3881426399 total bytes, 2810591 average bytes",
        "archived rollout files": "0 files, 0 total bytes, 0 average bytes",
        "goals DB": "/home/jaideep/.codex/goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "/home/jaideep/.codex/logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "/home/jaideep/.codex/log (dir)",
        "memories DB": "/home/jaideep/.codex/memories_1.sqlite (file)",
        "memories DB integrity": "ok",
        "queue DB": "/home/jaideep/.codex/queue_1.sqlite (file)",
        "queue DB integrity": "ok",
        "sqlite home": "/home/jaideep/.codex (dir)",
        "state DB": "/home/jaideep/.codex/state_5.sqlite (file)",
        "state DB integrity": "ok",
        "thread history DB": "/home/jaideep/.codex/thread_history_1.sqlite (file)",
        "thread history DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 4150
    },
    "state.rollout_db_parity": {
      "id": "state.rollout_db_parity",
      "category": "threads",
      "status": "warning",
      "summary": "rollout files and state DB thread inventory differ",
      "details": {
        "default model provider": "openai",
        "rollout DB active files": "1372",
        "rollout DB active rows": "1372",
        "rollout DB archive mismatches": "0",
        "rollout DB archived files": "0",
        "rollout DB archived rows": "0",
        "rollout DB duplicate DB paths": "0",
        "rollout DB duplicate rollout thread ids": "0",
        "rollout DB malformed file names": "0",
        "rollout DB missing active rows": "0",
        "rollout DB missing archived rows": "0",
        "rollout DB model providers": "openai=1372",
        "rollout DB rows": "1372",
        "rollout DB scan cap reached": "false",
        "rollout DB scan error sample": [
          "/home/jaideep/.codex/sessions/2026/05/14/rollout-2026-05-14T02-43-17-019e232f-d47e-7ac0-8ec2-dd2853e42cf9.jsonl (rollout at /home/jaideep/.codex/sessions/2026/05/14/rollout-2026-05-14T02-43-17-019e232f-d47e-7ac0-8ec2-dd2853e42cf9.jsonl has no usable header record)",
          "/home/jaideep/.codex/sessions/2025/08/30/rollout-2025-08-30T19-32-43-0b1937c0-d7b8-4ded-921b-af28b5a132de.jsonl (rollout at /home/jaideep/.codex/sessions/2025/08/30/rollout-2025-08-30T19-32-43-0b1937c0-d7b8-4ded-921b-af28b5a132de.jsonl has no usable header record)",
          "/home/jaideep/.codex/sessions/2025/08/30/rollout-2025-08-30T19-32-29-879aee9f-9dff-4a48-ac76-75c219384029.jsonl (rollout at /home/jaideep/.codex/sessions/2025/08/30/rollout-2025-08-30T19-32-29-879aee9f-9dff-4a48-ac76-75c219384029.jsonl has no usable header record)",
          "/home/jaideep/.codex/sessions/2025/09/07/rollout-2025-09-07T20-20-05-36a38db1-a2ba-406f-a9c5-660edaa71077.jsonl (rollout at /home/jaideep/.codex/sessions/2025/09/07/rollout-2025-09-07T20-20-05-36a38db1-a2ba-406f-a9c5-660edaa71077.jsonl has no usable header record)",
          "/home/jaideep/.codex/sessions/2025/09/03/rollout-2025-09-03T20-03-04-f1af1d46-5917-4cc6-980e-88ef07ce031e.jsonl (rollout at /home/jaideep/.codex/sessions/2025/09/03/rollout-2025-09-03T20-03-04-f1af1d46-5917-4cc6-980e-88ef07ce031e.jsonl has no usable header record)"
        ],
        "rollout DB scan errors": "9",
        "rollout DB sources": "cli=547, vscode=423, subagent:thread_spawn=387, exec=10, subagent:other=5",
        "rollout DB stale rows": "0"
      },
      "issues": [
        {
          "severity": "warning",
          "cause": "rollout scan was incomplete or found bad files",
          "measured": "9 scan errors, 0 malformed names, scan cap reached: false",
          "expected": "rollout directories are fully scannable",
          "remedy": "Check file permissions and unexpected files under CODEX_HOME sessions.",
          "fields": []
        }
      ],
      "remediation": null,
      "durationMs": 702
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language en-US",
      "details": {
        "EDITOR": "set",
        "LANG": "en_US.UTF-8",
        "LESS": "set",
        "PAGER": "set",
        "VISUAL": "not set",
        "os": "Arch Linux [64-bit]",
        "os language": "en-US",
        "os type": "Arch Linux",
        "os version": "Unknown"
      },
      "remediation": null,
      "durationMs": 0
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "COLORTERM": "truecolor",
        "DISPLAY": "present",
        "TERMINFO": "/usr/share/terminfo (dir)",
        "TERM_PROGRAM": "ghostty",
        "WAYLAND_DISPLAY": "present",
        "color output": "disabled (stdout is not a terminal)",
        "effective locale": "en_US.UTF-8",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout is terminal": "false",
        "terminal": "Ghostty",
        "terminal size": "91x34",
        "terminal version": "1.3.1-arch2"
      },
      "remediation": null,
      "durationMs": 0
    },
    "terminal.title": {
      "id": "terminal.title",
      "category": "title",
      "status": "ok",
      "summary": "terminal title default",
      "details": {
        "terminal title activity": "true",
        "terminal title items": "activity, project-name",
        "terminal title project source": "cwd",
        "terminal title project value": "jaideep",
        "terminal title source": "default"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.147.0",
        "check for update on startup": "true",
        "last checked at": "2026-08-13T04:45:02.081539307Z",
        "latest version": "0.147.0",
        "latest version status": "current version is not older",
        "npm update target": "/home/jaideep/.local/npm-global/lib/node_modules/@openai/codex",
        "update action": "npm install -g @openai/codex",
        "version cache": "/home/jaideep/.codex/version.json"
      },
      "remediation": null,
      "durationMs": 351
    }
  }
}
What issue are you seeing?

Codex ran shutdown -h now as per instructions when I've gone to bed at night when I turn on the laptop again in the morning I can see the model being interrupted as the process is killed due shutdown.
then I picked up the thread again via codex resume and continued for some time but when I closed it and gone to revisit again the issue appears that the history is from the yesterday night model interruption point after it executed to shell tool shutdown -h now
now the thread can't be resumed but the work is logged

What steps can reproduce the bug?
  1. keep codex running inside the CLI
  2. ask the model to run shutdown -h now
  3. visit the thread back via codex resume and send few more messages
  4. close the re opened thread and try to open it again (the new history is gone with only access point for that being the logs)
What is the expected behavior?

the updated history should populate in the same thread ideally if any issues with that then alteast in a new forked thread

Additional information

No response

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

Start at the codex resume flow and inspect how the rollout JSONL files are matched with state_5.sqlite and thread_history_1.sqlite when ordinals differ. Reproduce the ordinal-mismatch case and verify that the resumed session includes the previously omitted thread without introducing a rollout/state inventory mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sqlite
Domain
cli, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.