Skip to content

Codex app-server started during an update restart treats a routed model as unknown and loops on compaction #7423

Closed

Description

@darylltee

Client or integration

Codex App

Area

Catalog / models

Summary

After an in-app update (2.88.0 → 2.89.0, restart: true), a Codex app-server --managed-daemon that started in the same second as the new proxy treated a routed model already in use as unknown. It kept that state until it was killed:

WARN codex_models_manager::model_info: get_model_info{model="anthropic/claude-opus-5-5"}:
Unknown model anthropic/claude-opus-5-5 is used. This will use fallback model metadata.

With fallback metadata, two long-running threads on that model got into a compaction loop that never ended:

  • Codex used the generic window (full_context_window_limit=258400, auto_compact_scope_limit=244800) instead of the catalog row's context_window: 1000000 / auto_compact_token_limit: 400000. Another app-server that started later on the same machine logged auto_compact_scope_limit=Some(400000) for the same model.
  • The catalog row's tool settings (tool_mode: "code_mode_only", supports_search_tool: true) no longer applied. Codex's request body right after a compaction was 1,027,574 bytes (211,340 after zstd), even though the input (replacement history) was only ~98 KB. Upstream input was ~413k tokens, ~408.7k of it a constant cached prefix. The summary request, which drops tools, was only ~33k tokens.
  • So every mid-turn compaction left the next request at ~413k, still above 244,800. Codex compacted again after each sampling request, about every 40 s. In about 75 minutes, the two threads sent ~44M input tokens.

Expected: a routed model that is already in the Codex catalog should not disappear from what a Codex process loads while the proxy restarts. If a running app-server is known to hold a stale catalog, the user should be told somewhere they will see it, because a silent fallback here causes a costly loop and no visible error.

Startup log of the restarted proxy (paths redacted):

--- 2026-10-20T01:23:36.048Z ---
$ node .../opencodex/bin/ocx.mjs start --port 10100
   + 11 models appended to Codex catalog (~/.codex/model-catalogs/models_cache-luna-v2.json)
WARNING: 3 Codex app-server process(es) still running (PIDs: <a>, <daemon>, <daemon-pid-loop>). Disk catalog/cache were updated, but Codex may keep showing the old model list until those processes restart. Re-run with `ocx sync --restart-codex` ...
Client startup work complete.
[catalog-auto-refresh] served model set changed; running Codex sessions keep the old list until restarted (ocx sync --restart-codex)

Timeline (UTC):

Time Event
01:23:16 Update job 2.88.0 → 2.89.0 starts (installer: npm, restart: true)
01:23:36 New proxy starts and appends 11 models to the catalog. The managed daemon process starts in the same second.
01:25:08 First compaction that does not shrink the context (443,755 → 411,437 tokens)
01:26:30 Daemon logs Unknown model anthropic/claude-opus-5-5 ... fallback model metadata
01:26:37 Catalog files rewritten again (catalog-auto-refresh). The daemon keeps its fallback.
01:25–02:42 43 and 44 consecutive compactions in the two threads; none shrank the context
02:29 Rolling the proxy back to 2.88.0 does not help, because the daemon is still stale
02:42 Daemon stopped (SIGTERM was ignored mid-turn; SIGINT worked). The loop stops.

On 2.88.0 the same thread had compacted normally the day before (342k → 71k and 357k → 71k). So I don't think the 2.89.0 code diff is the trigger. The trigger is a Codex process loading the catalog while the proxy restart is rebuilding it.

The update ran in the background, so the existing WARNING ... ocx sync --restart-codex hint only reached update-pinned-start.log. I did not capture the catalog contents between 01:23:36 and 01:26:37. So whether the 11-model write omitted this row, or the daemon read the file mid-write, is an inference from the daemon's log.

Reproduction

Not reproduced on purpose; this was observed once. Conditions:

  1. Codex App with a routed model in the injected catalog (anthropic/claude-opus-5-5 through the anthropic provider, a native first-party endpoint) and a Codex standalone app-server --managed-daemon hosting long threads on that model.
  2. Run an update with restart from the dashboard or update job (2.88.0 → 2.89.0 here), while those threads exist.
  3. The daemon (re)starts in the same second as the new proxy's startup catalog write. Its later turns on the routed model log Unknown model ... fallback model metadata.
  4. Once a thread's tool catalog and history put the post-compaction request above the fallback auto_compact_scope_limit (244,800), every mid-turn compaction is followed by another one.

Workaround: restart the stale Codex app-server or daemon (ocx sync --restart-codex, or stop the processes ocx status lists under "restart Codex clients").

Possible fixes (for discussion):

  • During startup, don't shrink the routed set in the Codex catalog. Keep previously cataloged routed rows until discovery completes, or don't write until the served set is final.
  • When catalog-auto-refresh changes the served set and an app-server older than the change is running, show it where the user will see it (dashboard or update job result), or offer the client restart as part of an update with restart: true.

Version

Observed right after updating 2.88.0 → 2.89.0; persisted after rolling back to 2.88.0 until the Codex daemon was restarted. Codex standalone 0.163.0 (managed daemon); Codex App bundled app-server 0.163.0-alpha.10.2.

Operating system

macOS 26.7.1 (25G241), Apple silicon

Provider and model

anthropic / claude-opus-5-5 (Codex slug anthropic/claude-opus-5-5)

Logs or error output

# Codex app-server log (logs_2.sqlite), stale daemon, post-sampling decision:
total_usage_tokens=416027 auto_compact_scope_tokens=416027 auto_compact_scope_limit=Some(244800)
full_context_window_limit=Some(258400) full_context_window_limit_reached=true token_limit_reached=true

# Same model, app-server started at 01:54Z:
auto_compact_scope_limit=Some(400000)

# Codex request sizes, stale daemon:
sampling request:   pre_compression_bytes=1027574 post_compression_bytes=211340
compaction request: pre_compression_bytes=1339281 post_compression_bytes=366728

# Proxy usage rows for one compaction cycle (same conversation):
summary:  in 33,101   cache_read 0        out 5,031
turn:     in 413,308  cache_read 408,714  out 404

Screenshots and supporting files

Related, closed: #857 (a stale Codex app-server makes the injected roster disagree with the live allowlist). Unrelated but in the same area: #7307 (summary requests drop the tool catalog and miss the Anthropic cache).

Redacted configuration

{
  "providers": {
    "anthropic": {
      "adapter": "anthropic",
      "baseUrl": "https://api.anthropic.com"
    }
  },
  "codexCatalogRow": {
    "slug": "anthropic/claude-opus-5-5",
    "context_window": 1000000,
    "auto_compact_token_limit": 400000,
    "tool_mode": "code_mode_only",
    "supports_search_tool": true
  }
}

Checks

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

Activity

  1. github-actions commented on Oct 20, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

  2. added
    bug
    catalog
    on Oct 20, 2026
  3. Ingwannu commented on Oct 20, 2026

    @Ingwannu
    Owner

    Checked against trusted dev 12025981e5a304cdb6b1b54f525ba8554f623977. Your timeline establishes a stale in-memory model view and materially different compaction thresholds, but it does not capture whether startup published an incomplete roster or the daemon observed an intermediate write. Those are distinct fixes. Keep this open: a synthetic lifecycle test should pause discovery/catalog publication, start a fake reader at each boundary, and assert that a known routed row is never transiently removed and that publication is atomic. Persistent-client warning visibility/update-result UX is a separate owner decision. I will not run ocx sync or restart a live app-server; the workaround is user-operated recovery, not permission for automatic restarts.

  4. FredAmartey commented on Oct 25, 2026

    @FredAmartey
    Contributor

    The + 11 models appended to Codex catalog line in the restarted proxy's log suggests the routed rows were missing just before startup, which points at a third window besides the two above.

    An update runs a full ocx stop before installing (src/update/index.ts), and unless a client connection owns the integrations, that stop restores native Codex. The catalog goes back to the pristine backup and every routed row is removed (restoreCodexCatalogWithPermit). The new proxy adds them back when it starts. A Codex process that loads the catalog between the two sees routed models as unknown until it restarts, which matches a daemon that started in the same second as the new proxy.

    If that holds, the lifecycle test also needs a boundary between the old proxy's stop and the new proxy's first publication. This is from reading dev at 50afcec; I haven't reproduced it live.

  5. Ingwannu commented on Oct 25, 2026

    @Ingwannu
    Owner

    That third boundary is supported by current dev 8ebe46b207: src/update/index.ts still invokes full stop before package replacement, and performStopTeardown restores native Codex unless persisted connection ownership, a live sibling or a valid deferral owns the teardown. With a pristine backup, restoreCodexCatalogWithPermit intentionally replaces the injected catalog, removing routed rows before the new proxy publishes them. Atomic individual writes do not close that stop-to-first-publication gap.

    I am extending the investigation boundary accordingly: the disposable lifecycle fixture must pause (1) after old-proxy teardown/restore, (2) during new discovery, and (3) at first publication, with a fake reader checking the known routed row at every boundary. The +11 log alone does not prove which boundary the real daemon observed, and the source path is not a live reproduction.

    No patch or release is claimed here. Ordinary user-requested stop must still restore native routing, so retaining the routed catalog unconditionally would be the wrong fix; an update handover needs an explicit ownership/recovery contract, including failed install/restart. No live Codex process, catalog or configuration was changed.

  6. lidge-jun commented on Oct 26, 2026

    @lidge-jun
    Owner

    Fixed on dev by #7747 (squash 81ce59591c06b2f1bde71748588fda69078662a2), which ships with v2.93.0.

    A dashboard update with restart now keeps Codex routing and the routed catalog in place while the package is replaced, and the restarted proxy takes them over. Before, the update's ocx stop put back the pristine catalog, so a Codex process loading it in that gap treated routed models as unknown. A plain ocx stop, an update without restart, and a startup with the Codex integration off still restore native Codex as before. If the restarted proxy never comes up, the next ocx stop finishes the restore.

    The issue's second suggestion is not part of this fix: surfacing a stale running app-server in the update result.

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

    bugcatalog

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions