Restarting codex does not reload `model_catalog_json` — the model list is loaded once by a separate long-lived process

Author: SilverRegexCreated Sep 30, 2026Updated Sep 30, 2026

Environment

  • codex CLI 0.159.2, app-server daemon 0.159.2 (codex app-server --managed-daemon)
  • ~/.codex/config.toml sets model_catalog_json = "/path/to/catalog.json" (generated by an external tool, in my case claude-code-router)
  • Linux 5.15 x86_64

Problem

With tui_app_server enabled, the TUI is a thin client: session state and model calls live in a separate long-lived app-server process. That process reads model_catalog_json once, at its own startup, and never re-reads it. Consequently restarting the codex CLI never refreshes the model list — a new process attaches to the same daemon and is served the daemon's boot-time copy.

This matters when the catalog is machine-generated and can change while codex is running (e.g. a router that adds or renames upstream models). The list is then wrong indefinitely, and the only thing that fixes it is restarting the hidden daemon — which is not discoverable from the CLI surface.

Reproduction

~/.codex/logs_2.sqlite, table logs, column feedback_log_body. The external tool rewrote the catalog at 09:54:44 (a model rename, gpt-6-sol -> gpt-6.1-sol). A full cold start of the codex CLI followed 11 seconds later:

09:54:44 (external tool) catalog rewritten on disk 09:54:55 initialize pid:3494303 09:54:56 account/read pid:3494303 09:54:56 config/read pid:3494303 09:54:56 model/list pid:3494303 09:54:56 configRequirements/read pid:3494303 09:54:56 collaborationMode/list pid:3494303 09:54:56 thread/start pid:3494303

Every request in the handshake — including initialize, the first message a client sends, and model/list — was served by pid 3494303, a daemon that had been running since 08:50. The new process never touched the catalog file; it asked the old process, and got the pre-rewrite list. This reproduces reliably: restarting the CLI, opening /model, resuming a thread, starting a new thread — none of them refresh it.

When this regressed

The same logs show the request transport changing, which pins the regression to the shared-daemon design (rpc.transport in codex_app_server::message_handling spans):

  • through 2026-09-28: in-process — the TUI owned the session loop and read the catalog itself, so restarting the CLI did refresh the list
  • from 2026-09-30: unix_socket — the loop moved into the shared daemon, gated by tui_app_server

So this is a behaviour change accompanying the app-server work, not a config error.

Expected

At least one of:

  • re-read model_catalog_json when a client session starts, or
  • watch the catalog file and reload on change (mtime/inode), or
  • reload on config/read, which clients already issue at startup.

Failing those, surface it: if the catalog file changes underneath a running daemon, the next client should be told the list is stale (or the daemon should log that a restart is required). The behaviour is otherwise indistinguishable from "the tool that generates my catalog is broken".

Note

model_catalog_url is not a workaround. With only model_catalog_url = "http://127.0.0.1:3456/v1/models" set and no model_catalog_json, codex 0.159.2 ignores the URL and silently falls back to its built-in catalog (11 models, no warning).

Source: musistudio/claude-code-router