Skip to content

[Bug]: ocx doctor reports a false history integrity failure when state_5.sqlite is WAL without -shm #7044

Closed

Description

@flokosti96

Client or integration

Codex CLI

Area

CLI

Summary

ocx doctor reports "backup manifest or restore target failed integrity checks — manual review required" when Codex's state_5.sqlite is a WAL database with no live writer (no -wal/-shm files). countPendingOpencodexHistory (src/codex/history-provider.ts:1834) opens the DB with new Database(path, { readonly: true }); SQLite cannot open a WAL database read-only without -shm (SQLITE_CANTOPEN). The error is not classified as recoverable and falls through to failureReason: "integrity".

openCodexStateForPreflight (src/codex/history-state-open.ts:86) already handles exactly this case with an ?immutable=1 fallback (from #4943), but countPendingOpencodexHistory does not use it.

Reproduction

  1. Quit all Codex processes so ~/.codex/state_5.sqlite-wal and -shm are gone.
  2. sqlite3 "file:$HOME/.codex/state_5.sqlite?mode=ro" "SELECT 1 FROM threads LIMIT 1" → unable to open database file (14).
  3. ocx doctor → integrity warning under "Codex native-write coordinator".

On a machine where Codex is running (WAL files present) the same check prints ok.

Version

@bitkyc08/opencodex 2.84.0, codex-cli 0.162.1

Operating system

macOS 27 (Apple Silicon)

Provider and model

n/a

Logs or error output

Codex native-write coordinator
  --     backup manifest or restore target failed integrity checks — manual review required

Redacted configuration

Client mode, no history backup entries pending.

Proposed fix

Open the state DB in countPendingOpencodexHistory via openCodexStateForPreflight(stateDbPath) (or classify SQLITE_CANTOPEN without WAL files as "busy"/unknown instead of "integrity").

Related: #4943.

Screenshots and supporting files

No response

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    cli
    on Oct 13, 2026
  2. lidge-jun commented on Oct 13, 2026

    @lidge-jun
    Owner

    Fixed on dev by #7060 (5b6bff7): the pending-history count now opens state_5.sqlite through openCodexStateForPreflight, so a WAL database with no -wal/-shm files no longer reports a false integrity failure in ocx doctor. It ships in the next release after 2.84.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcli

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions