Ephemeral shell-snapshot cleanup logs DB discrepancy despite successful filesystem fallback in 0.160.0
In Codex CLI 0.160.0 on macOS arm64, an ephemeral read-only run can succeed while emitting:
state db discrepancy during find_thread_path_by_id_str_in_subdir: falling_back
Reproduction in an existing Codex home with stored threads:
codex -a never exec --strict-config --ephemeral --sandbox read-only --skip-git-repo-check --model gpt-6.1-sol --json 'Return exactly DB_PROBE_OK. Do not use tools, spawn agents, or modify files.'
Observed: the turn completes with DB_PROBE_OK and the warning above. With the same executable and prompt plus --disable shell_snapshot, the turn completes without this warning. The result was reproduced against the desktop-bundled 0.160.0 executable.
Source inspection indicates that ephemeral sessions intentionally use no DB handle, while shell-snapshot cleanup calls the rollout filename lookup. That lookup succeeds through the filesystem, but the fallback path emits the discrepancy warning. The relevant lookup function is unchanged from 0.159.2 to 0.160.0. This differs from the SQLite setup fixes in the 0.160.0 release notes.
Expected: intentional DB absence in an ephemeral cleanup context should be distinguished from a required database failing or containing inconsistent metadata. Preserve diagnostics for actual DB errors, stale paths, and missing required rows. A regression test should cover successful cleanup against a valid pre-existing rollout without a DB handle.
Source: https://github.com/openai/codex/blob/rust-v0.160.0/codex-rs/rollout/src/list.rs
This draft contains no authentication data, private paths, raw transcripts, or attachments.
Retested on stable Codex CLI 0.162.1: the strict-config, default ephemeral regression completed successfully with shell snapshots enabled and no workaround profile, but state db discrepancy during find_thread_path_by_id_str_in_subdir: falling_back appeared three times. A valid pre-existing rollout DB row and file were verified read-only before the check.
The scoped mitigation, disabling shell snapshots only for an explicitly selected ephemeral-check profile, also passes on 0.162.1 with zero targeted warnings. This is a workaround, not defect resolution; global shell snapshots remain enabled.
The October 10 desktop update still bundles the same 0.162.0-alpha.17.2 executable bytes as the previously tested desktop build, so that unchanged default regression was not repeated. Please retain the regression for intentional ephemeral DB absence during snapshot cleanup while preserving diagnostics for genuine DB errors, stale paths and missing required rows. No logs, transcripts or files are attached.
I have now qualified a local source candidate against rust-v0.162.1, commit 092d3acd6bec3e3a14bdc7e7a2810ab628ab759d. No installed official binary was replaced.
The correction adds an explicit optional-DB rollout lookup for best-effort shell-snapshot cleanup. Intentional DB absence uses filesystem lookup without the discrepancy warning or db_unavailable fallback telemetry. Supplied databases retain missing-row read repair, stale/mismatched-path diagnostics and query-error diagnostics. The existing general/archived lookup behavior, filesystem errors and DB-initialization warning remain intact.
Executed on Apple Silicon macOS using the source-required Rust 1.95.0:
- All 152 codex-rollout library tests passed, including the absent/required/supplied DB cases.
- The new cleanup warning assertion failed against original production code with the exact falling_back warning, establishing the regression.
- The corrected final candidate passed all three focused core cleanup tests, preserving live/active snapshots and deleting stale/orphan snapshots. Its final core build emitted no compiler warnings.
- Formatting and diff checks passed.
The tag's manifests declare 0.162.1 while its lockfile lists 161 local workspace packages at 0.0.0. The isolated build normalized only those local versions; all external dependency records were unchanged. The vendor lockfile was restored afterward and is excluded from the six-file DB patch.
This is source qualification, not vendor defect closure. A corrected official release still needs the default ephemeral regression with shell snapshots enabled and zero targeted falling_back warnings. The source/test patch is ready; please identify the supported contribution route for this collaborator-restricted repository. No logs, transcripts or attachments are included.