Area
Catalog / models
What are you trying to accomplish?
I need to keep a Codex CLI or Desktop client synchronized with the complete model catalog generated by a remotely hosted OpenCodex instance.
OpenCodex already exposes the persisted catalog through the authenticated GET|HEAD /v1/catalog data-plane endpoint. The missing workflow is safely materializing that snapshot into the remote client's local CODEX_HOME, rebuilding models_cache.json, and reporting when a running Codex app-server or Desktop process still holds the previous catalog in memory.
This would make centrally hosted OpenCodex deployments usable without maintaining deployment-specific web roots, cron jobs, PowerShell downloaders, or ad hoc cache-rebuild scripts.
What prevents this today?
model_catalog_json accepts a local filesystem path, not a URL. ocx sync builds a catalog from locally configured providers, while ocx export --client generates client-specific configuration; neither consumes a complete catalog from another OpenCodex server.
Operators currently need to implement the entire client-side lifecycle themselves:
- authenticate to
/v1/catalog;
- download into a same-directory temporary file;
- validate JSON structure and model slug uniqueness;
- preserve the last-known-good catalog on network, HTTP, or validation failure;
- atomically replace the local catalog;
- rebuild
$CODEX_HOME/models_cache.json;
- detect stale Codex app-server/Desktop processes;
- schedule the workflow separately on Windows, macOS, and Linux.
This duplicates security-sensitive filesystem and credential handling that OpenCodex already implements elsewhere and makes reliable Desktop synchronization unnecessarily difficult for non-technical client users.
What should OpenCodex do?
Provide an explicit remote-catalog pull workflow that consumes the existing /v1/catalog contract and installs the result as a local Codex catalog.
Observable requirements:
- accept an HTTPS OpenCodex catalog URL;
- read authentication from an environment reference or existing secure credential mechanism, never a plaintext CLI argument;
- support conditional requests through
ETag / If-None-Match, treating 304 as a no-op;
- reject URL-embedded credentials and avoid forwarding authorization across origins;
- enforce response-size and timeout bounds;
- validate the complete catalog before the first filesystem mutation, including a non-empty
models array and unique, valid slugs;
- write through the existing catalog serialization and atomic replacement primitives;
- preserve the last-known-good catalog and cache on every download or validation failure;
- update
models_cache.json in the same coordinated operation;
- preserve mtimes and avoid process handling when the pulled catalog is unchanged;
- report stale Codex processes after a real update;
- keep
--restart-codex and Windows --restart-desktop-app explicit and opt-in, because either can interrupt active work;
- never mutate server configuration, provider credentials, or the source catalog.
The first implementation can stay intentionally narrow: one-shot pull plus cache update. A managed cross-platform scheduled integration can be discussed separately after the command contract is stable.
Example usage or interface
export OPENCODEX_CATALOG_AUTH_TOKEN='...'
ocx catalog pull \
https://proxy.example.com/v1/catalog \
--auth-env OPENCODEX_CATALOG_AUTH_TOKEN \
--restart-codex
Machine-readable automation:
ocx catalog pull \
https://proxy.example.com/v1/catalog \
--auth-env OPENCODEX_CATALOG_AUTH_TOKEN \
--json
Expected no-op result after an unchanged conditional request:
{
"status": "unchanged",
"catalogWritten": false,
"cacheSynced": false,
"codexRestarted": false
}
The exact command and environment-variable names are proposed for discussion; the important contract is authenticated remote-to-local materialization with coordinated catalog/cache writes and opt-in process restart.
Alternatives or workarounds
- Serve a deployment-specific
/dl directory: works, but duplicates the existing authenticated /v1/catalog endpoint and makes nginx/web-root permissions part of catalog correctness.
- Cron plus shell/PowerShell scripts: currently workable, but each operator must reimplement validation, locking, atomic replacement, cache generation, error handling, and secret hygiene.
- Point
model_catalog_json at an HTTPS URL: incompatible with Codex's local-path contract and startup behavior.
- Extend
ocx export --client: misleading because that command exports client-specific configuration rather than the complete Codex catalog.
- Server-side watcher or publisher daemon: does not solve client-side
models_cache.json or in-memory Desktop staleness and adds another service lifecycle.
- Automatically restart Codex Desktop: rejected as a default because it can terminate active conversations; restart must remain explicit.
Additional context
Related existing work solves adjacent, but different, layers:
A production deployment currently uses a validated atomic catalog publisher plus a Windows downloader/cache rebuilder. That proves the workflow is useful, but the proposal deliberately avoids upstreaming deployment-specific paths, nginx configuration, cron syntax, or public unauthenticated /dl behavior.
Security boundaries for implementation review:
- no token in argv, output, errors, redirects, or persisted catalog metadata;
- HTTPS by default;
- no cross-origin credential forwarding;
- bounded body acquisition;
- validation before mutation;
- catalog/cache writes only under the existing per-
CODEX_HOME serialization permit;
- no implicit process termination.
Checks
Area
Catalog / models
What are you trying to accomplish?
I need to keep a Codex CLI or Desktop client synchronized with the complete model catalog generated by a remotely hosted OpenCodex instance.
OpenCodex already exposes the persisted catalog through the authenticated
GET|HEAD /v1/catalogdata-plane endpoint. The missing workflow is safely materializing that snapshot into the remote client's localCODEX_HOME, rebuildingmodels_cache.json, and reporting when a running Codex app-server or Desktop process still holds the previous catalog in memory.This would make centrally hosted OpenCodex deployments usable without maintaining deployment-specific web roots, cron jobs, PowerShell downloaders, or ad hoc cache-rebuild scripts.
What prevents this today?
model_catalog_jsonaccepts a local filesystem path, not a URL.ocx syncbuilds a catalog from locally configured providers, whileocx export --clientgenerates client-specific configuration; neither consumes a complete catalog from another OpenCodex server.Operators currently need to implement the entire client-side lifecycle themselves:
/v1/catalog;$CODEX_HOME/models_cache.json;This duplicates security-sensitive filesystem and credential handling that OpenCodex already implements elsewhere and makes reliable Desktop synchronization unnecessarily difficult for non-technical client users.
What should OpenCodex do?
Provide an explicit remote-catalog pull workflow that consumes the existing
/v1/catalogcontract and installs the result as a local Codex catalog.Observable requirements:
ETag/If-None-Match, treating304as a no-op;modelsarray and unique, valid slugs;models_cache.jsonin the same coordinated operation;--restart-codexand Windows--restart-desktop-appexplicit and opt-in, because either can interrupt active work;The first implementation can stay intentionally narrow: one-shot pull plus cache update. A managed cross-platform scheduled integration can be discussed separately after the command contract is stable.
Example usage or interface
Machine-readable automation:
Expected no-op result after an unchanged conditional request:
{ "status": "unchanged", "catalogWritten": false, "cacheSynced": false, "codexRestarted": false }The exact command and environment-variable names are proposed for discussion; the important contract is authenticated remote-to-local materialization with coordinated catalog/cache writes and opt-in process restart.
Alternatives or workarounds
/dldirectory: works, but duplicates the existing authenticated/v1/catalogendpoint and makes nginx/web-root permissions part of catalog correctness.model_catalog_jsonat an HTTPS URL: incompatible with Codex's local-path contract and startup behavior.ocx export --client: misleading because that command exports client-specific configuration rather than the complete Codex catalog.models_cache.jsonor in-memory Desktop staleness and adds another service lifecycle.Additional context
Related existing work solves adjacent, but different, layers:
/v1/catalogimplementation address least-privilege remote catalog delivery.A production deployment currently uses a validated atomic catalog publisher plus a Windows downloader/cache rebuilder. That proves the workflow is useful, but the proposal deliberately avoids upstreaming deployment-specific paths, nginx configuration, cron syntax, or public unauthenticated
/dlbehavior.Security boundaries for implementation review:
CODEX_HOMEserialization permit;Checks