Skip to content

[Bug]: Codex catalog refresh gives up after 3s and serves the stale cache, so new models stay hidden #38609

Open

Description

@VortiMedia

What happened

A newly released Codex model (gpt-6.2-sol) did not show up in T3's model catalog or in orchestrator_capabilities for an agent that asked for it. The agent concluded the model did not exist and delegated on gpt-6.1-sol instead. Nothing told the user or the agent that the catalog was stale. The model appeared about ten minutes later, only after some other Codex process happened to write a fresh models_cache.json.

Diagnosis

requestCodexChatGptModels calls model/list, then polls $CODEX_HOME/models_cache.json until fetched_at >= spawnedAtMs, bounded by CODEX_CATALOG_REFRESH_TIMEOUT_MS = 3e3 and the probe deadline. On timeout it logs Codex did not refresh its model catalog in time; using the cached catalog. (WARN), returns the old list, and the probe's app-server is stopped.

Codex's own refresh is often slower than that. In Codex's log (~/.codex/logs_2.sqlite), GET https://chatgpt.com/backend-api/codex/models returns 200 OK, and about 10 ms later codex_models_manager logs failed to refresh available models: request timed out. The response is about 600 KB. So Codex sometimes never writes the cache, and T3 has already given up by then either way.

Timeline (UTC, 2026-11-18, T3 server trace + Codex log):

  • 13:13:15 requestCodexChatGptModels takes 8014 ms and falls back to the cache (WARN).
  • 13:17:30–41 the agent searches the catalog for "gpt-6.2 sol", "sol" and "6.2". Only gpt-6.1-sol, gpt-6-sol and gpt-5.6-sol come back.
  • 13:18:28 the refresh takes 3009 ms and falls back again (WARN).
  • 13:20:15, 13:23:36 Codex: GET /models 200, then "request timed out".
  • 13:26:46 a fresh models_cache.json is finally written (gpt-6.2-sol, gpt-6.2-astra present).
  • 13:28:10 ProviderRegistry.refreshModelCatalog succeeds in 584 ms, and the model appears.

Over one day of traces, 4 of 17 requestCodexChatGptModels calls hit the fallback.

Expected

  • When the refresh times out, keep a background refresh going (or retry with backoff) and publish the catalog when a fresh cache lands, rather than waiting for the next probe.
  • Surface staleness: when the catalog comes from a cache older than the probe, say so (for example catalogFetchedAt or a stale flag in orchestrator_capabilities and provider status), so agents don't read "missing" as "does not exist".
  • Optionally, let delegate_task accept a model id that is in models_cache.json but not yet in the published catalog.

Version

T3 Code 0.1.10 (macOS arm64, local server), codex-cli 0.169.0, ChatGPT sign-in.

Related but different root cause: #33701 (catalog 401 after the managed token expires). Here the catalog request is authorized (200), but the body download times out.

Activity

  1. Dopetaiga commented on Nov 19, 2026

    @Dopetaiga

    I'd like to work on this. Confirmed on main: requestCodexChatGptModels polls models_cache.json for CODEX_CATALOG_REFRESH_TIMEOUT_MS (3s) and silently serves the stale catalog when Codex's own refresh misses, so a new model can be invisible to the agent for minutes. Plan: reproduce with a probe, then surface the staleness to the caller and retry the refresh instead of a single 3s wait; PR to follow per the repo's rules.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions