Skip to content

Model catalog changes are not reflected in running Codex app-server until it is restarted #476

Description

@firewine

Summary

Changes to the OpenCodex model catalog are written correctly to disk, but an already-running Codex app-server continues using the previous model list until the app-server processes are terminated.

Restarting the OpenCodex proxy, running ocx sync, and running ocx sync-cache are not sufficient. Rebooting the machine appeared to fix the problem only because it terminated the persistent Codex app-server processes.

Environment

  • Ubuntu, accessed over SSH
  • tmux
  • OpenCodex 2.7.40
  • Codex CLI 0.145.0
  • Bun 1.3.14
  • Node.js v24.18.0
  • OpenCodex systemd user service enabled

Reproduction

  1. Start OpenCodex using the systemd user service.
  2. Start Codex CLI and allow its background app-server processes to remain running.
  3. Modify the OpenCodex model configuration. In this case, Anthropic should expose only:
    • anthropic/claude-fable-5
    • anthropic/claude-opus-5
    • anthropic/claude-sonnet-5
  4. Run:
ocx service stop
ocx service start
ocx sync
ocx sync-cache
  1. Verify the generated files:
grep -oE '"anthropic/[^"]+"' ~/.codex/opencodex-catalog.json | tr -d '"' | sort -u
grep -oE '"anthropic/[^"]+"' ~/.codex/models_cache.json | tr -d '"' | sort -u

Both files correctly contain only the three intended Anthropic models.

  1. Codex still shows the previous/stale model list.
  2. Check background processes:
pgrep -af 'codex|app-server'

Persistent processes include variants of:

codex ... app-server --listen unix://
codex app-server proxy
codex-code-mode-host
  1. Terminate only the Codex app-server processes:
pkill -TERM -f 'codex.*app-server'
pkill -TERM -f 'codex-code-mode-host'

After Codex recreates/restarts these processes, the new model list is immediately reflected.

Actual behavior

ocx sync and ocx sync-cache update the catalog/cache files, but running Codex app-server processes continue serving the old in-memory model catalog.

The OpenCodex proxy itself is healthy and correctly restarted with a new PID. The issue is specifically the persistent Codex app-server processes.

Expected behavior

One of the following would be helpful:

  1. Running Codex app-server processes reload the updated model catalog; or
  2. ocx sync detects running Codex app-server processes and clearly warns that they must be restarted; or
  3. Add an explicit safe option/command, for example:
ocx sync --restart-codex

or:

ocx codex reload-models

The command could update the catalog/cache, then send SIGTERM only to the current user's Codex app-server processes.

Important safety detail

A broad command such as pkill -f codex is unsafe because unrelated processes may contain codex in their command line, for example hermes-codex-bridge-mcp.

A targeted pattern such as the following worked in this environment:

pkill -TERM -f 'codex.*app-server'
pkill -TERM -f 'codex-code-mode-host'

It may also be preferable to avoid restarting automatically while a turn is active, or require an explicit flag/confirmation because restarting app-server can interrupt active work.

Activity

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions