Skip to content

[Bug]: byte-identical catalog resync bumps the mtime and latches the app-server staleness check to stale #1459

Description

@tlsdnwn55

Client or integration

Codex CLI

Area

Catalog / models

Summary

writeRetainedCatalogSync writes the Codex catalog unconditionally — replaceActiveCodexCatalogatomicWriteFile, with no comparison against what is already on disk. So every sync moves the catalog file's mtime even when the produced bytes are identical and the advertised model set did not change.

collectCodexAppServerCatalogState() compares that mtime against each running Codex's start time, so an ordinary ocx start — or any dashboard/CLI action that re-syncs an unchanged model set — classifies every already-running Codex as holding an outdated in-memory catalog. Since #1407 that verdict withholds all opencodex-authored v2 model guidance, so a configured injectionModel / subagentModels roster silently stops reaching the session for the rest of that Codex's lifetime, even though nothing about the catalog changed.

A long-lived Codex App app-server outlives every proxy restart, which makes the state effectively latched: restarting the Codex CLI does not clear it, and the only way out is quitting the Codex App or ocx sync --restart-codex.

Expected: a sync that produces no change should not make a running Codex look stale. #1046 covered warning about stale app-servers after a catalog rewrite; it did not cover avoiding the rewrite when there is nothing to write.

Reproduction

  1. macOS with the Codex App (ChatGPT desktop) running, so a long-lived /Applications/ChatGPT.app/Contents/Resources/codex … app-server process exists.
  2. ocx start with a settled config, so the sync reproduces the catalog it already wrote.
  3. Observe the catalog mtime move even though the file content is unchanged, and collectCodexAppServerCatalogState() report stale.
  4. Start a new Codex CLI session with a v2 spawn_agent surface and a configured injectionModel: no preferred model and no roster reach the session.

Measured on the affected machine (collectCodexAppServerCatalogState()):

state: stale
catalogMtime: 2026-08-11T02:52:27.788Z
pid 80794  start 2026-08-11T02:43:11.000Z  stale: true   <- Codex App app-server
pid 95407  start 2026-08-11T02:55:35.000Z  stale: false  <- codex-code-mode-host (live CLI session)
pid 91809  start 2026-08-11T02:53:12.000Z  stale: false  <- codex-code-mode-host (live CLI session)

The mtime bump on identical bytes, reproduced hermetically through the same writer:

identical bytes: true
mtime before/after identical rewrite: 2026-08-11T04:08:17.643Z -> 2026-08-11T04:08:18.746Z  bumped: true

Version

2.12.0

Operating system

macOS 15.3.1

Provider and model

openai (ChatGPT login) / gpt-5.6-luna

Logs or error output

# state on the affected machine, and the same state with the Codex App process excluded
verdict incl. the Codex App app-server : stale
verdict excl. the Codex App app-server : fresh

Redacted configuration

{
  "multiAgentGuidanceEnabled": true,
  "injectionModel": "gpt-5.6-luna",
  "injectionEffort": "max",
  "subagentModels": ["gpt-5.6-luna"]
}

Checks

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcatalogModel catalog, slugs, visibility, routed entries

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions