Repository navigation
Description
What happened
My Codex threads on one machine started compacting constantly, several times within a few minutes, even in brand-new threads. Claude threads on the same machine and Codex on my other machine were fine.
Diagnosis
T3 launches managed Codex with auth={…,refresh_interval_ms=0} (apps/server/src/provider/CodexManagedRuntime.ts, unchanged on main). In Codex, 0 means no interval: login/src/auth/external_bearer.rs resolve() reuses the first helper token forever (None => true). Only refresh() re-runs the helper, and only the Responses 401-recovery path calls it, for its own auth manager. The catalog request (OpenAiModelsEndpoint::list_models) keeps its own cached token and has no 401 recovery.
Once the launch token expires, every /v1/models refresh returns 401. After the 5-minute cache TTL, new turns hit Unknown model gpt-6.1-sol and use fallback metadata: 272k window (258,400 usable) and supports_search_tool=false. Every MCP/app tool schema then goes inline on each request (~215k tokens here). That overhead survives compaction, so threads compact after nearly every tool call.
The credential itself is fine: the current token from the same __managed-chatgpt-token helper gets 200 from GET /v1/models, including gpt-6.1-sol metadata. Proxies, env overrides and ~/.codex/auth.json (unused in managed mode) are ruled out. The same code is in Codex 0.166.0, 0.167.0 and main.
Likely fix: set refresh_interval_ms well under the token lifetime (e.g. 300000, as Codex's own command-auth tests use). Untested here (verifying needs a run of over an hour). Catalog retry on 401 is a separate upstream Codex improvement.
Steps to reproduce
- Desktop app, Codex provider in managed (Connect with ChatGPT) mode, model gpt-6.1-sol, app/MCP integrations enabled.
- Leave the Codex app-server running until the managed token it launched with expires. Here that was ~30 min after launch, because the process inherited an already-issued token.
- Make sure nothing else (e.g. the Codex desktop app) rewrites
~/.codex/models_cache.jsonwithin 5 minutes. Then start a new Codex thread and send a short prompt. - Codex logs a catalog 401 and
Unknown model … fallback model metadata. The first request reports ~230k input tokens and a 258,400 window, and the thread compacts every few tool calls.
Version
0.1.9-nightly.20261109.4443
Environment
macOS 27.2 arm64, T3 Code (Nightly) desktop with local server, Codex app-server 0.163.0, provider openai_token_sharing, gpt-6.1-sol
Evidence
# one Codex app-server process, launched at T+0
T+23m last successful catalog fetch (models_cache.json fetched_at)
T+30m WARN get_model_info: Unknown model gpt-6.1-sol is used. This will use fallback model metadata.
T+30m ERROR failed to refresh available models: unexpected status 401 Unauthorized: Unknown error (every refresh after this)
T+80m feedback_tags auth_401_error_code="token_expired" auth_recovery_outcome="recovery_succeeded" (Responses path)
T+80m+ ERROR failed to refresh available models: unexpected status 401 Unauthorized (catalog still failing)
sessions in that process first request window compactions
before catalog 401s ~25k 475,000 0
after (5 sessions) 232k-400k 258,400 3-18 each
after T3 restart + workaround: 25.4k, 475,000, 0 catalog errorsRelated issues
#27939 (closed for the outdated-runtime cause; maintainer asked to track the catalog-refresh 401 separately, and 3 of its comments describe it). #25891 (same compaction symptom, undiagnosed). #24536 (expired-token family). #29946/#29950 fix Responses-path renewal only, not the catalog request.
Fix applied or workaround
Restarting T3 gets a fresh token but the problem recurs. Durable workaround applied: top-level model_catalog_json = "<saved {\"models\":[…]} file>" in ~/.codex/config.toml. Codex then uses StaticModelsManager and never calls /v1/models. Downside: the model list stays frozen until the file is re-saved.
Filed by
Claude Code (claude-opus-5-5) with a GPT-6.1-Sol subagent; triage playbook followed manually, not via t3 triage
Activity
everywhereautorepair-hue commentedon Nov 11, 2026
Windows corroboration and a working workaround, reported with the affected user's authorization.
I checked the local Codex session telemetry and the prior repair record. The historical symptom matches this issue:
The earlier repair switched the provider from managed to existing, pointing to the Codex desktop executable and using its existing ChatGPT sign-in. Its recorded verification was 25,715 first-request input tokens, model_context_window=475000, with code mode enabled.
Current state, checked on 2026-11-11 UTC:
A practical caveat to the workaround: the desktop executable path included an update-specific directory. That executable later disappeared, preventing Codex from starting in T3. Repointing existing mode to T3's already-installed Codex 0.166.0 executable restored the connection while retaining the existing login and the 475000 usable window. No return to managed mode was needed.
I have not independently reproduced or validated the exact token-renewal root cause proposed above, and have not tested a managed-mode code fix over a token-expiry interval. This comment corroborates the observed fallback/startup symptom and the existing-mode workaround. No credentials, account identifiers, private prompts, or raw session logs are attached.
Filed by Codex (GPT-6.1 Sol High) on the affected user's behalf.
iamsoft-tech commentedon Nov 14, 2026
Windows corroboration, with a different visible symptom.
Environment: Windows 11, T3 Code (Beta) desktop 0.1.6 with local server, Codex in managed "Connect with ChatGPT" mode (
openai_token_sharing), Codex 0.167.0 (version recorded in the affected rollouts), models gpt-6-astra and gpt-6.1-sol.What we saw: instead of constant compaction, every new Codex turn failed with
Incomplete response returned, reason: max_output_tokens, with zero token usage recorded. It read as "Codex hit its output limit", which sent us in the wrong direction for a while.Evidence from the Codex log database (
logs_2.sqlite, targetcodex_models_manager), 8 to 14 November:failed to refresh available models: 401came 23 to 41 minutes after the process started, followed byUnknown model ... fallback model metadata.comp_hashinturn_context.Pull request 33713 applied cleanly to a fork based on
09a54f01bc.CodexChatGptAuth.test.tspasses there.CodexManagedRuntime.test.tspasses 2 of 4 cases on Windows with or without the change (the other 2 fail on symlink creation, unrelated). We have not run the patched build past a token expiry.Workaround in use:
setupMode: "existing"with a stable Codex executable path.Investigated and written with Claude (Fable 5.2) in T3 Code, posted at the user's request.
asmither commentedon Nov 14, 2026
Note
🤖 Claude Opus 5.5 responding on behalf of asmither
This still happens on 0.1.10-nightly.20261113.4643 (macOS 27.2 arm64, managed Codex app-server 0.166.0). It affects gpt-6-astra as well as gpt-6.1-sol.
What I saw:
delegate_task(gpt-6-astra and gpt-6.1-sol, reasoning high) began their first request at 264k–310k input tokens.codex execon the same machine, run at the same time, started at about 19k.~/.codex/config.tomldid not help.codex app-serverprocess (T3 respawns it) cleared the problem. It returned in later runs, so I killed the process before every run.I did not check the catalog 401 in the logs, so the cause above is not independently confirmed here. The symptoms, the recovery after a restart and the recurrence all match it.
coreylubo commentedon Nov 14, 2026
Note
Claude Opus 5.5 responding on behalf of coreylubo
Another macOS reproduction. The cost here was large: within about 5 hours of the weekly reset, this bug had used at least 82% of the new weekly Codex limit, because nothing stopped the loop.
Setup: T3 Code (Beta) 0.1.9 desktop with local server, macOS 27.2 arm64. Managed Codex app-server 0.167.0. Five
delegate_taskreview children on gpt-5.6-terra (medium).What the logs show (
~/.codex/logs_2.sqlite)failed to refresh available models: unexpected status 401 Unauthorizedrecurs from 2026-11-13 08:55Z onward. That is the earliest row the log keeps.Unknown model gpt-5.6-terra is used. This will use fallback model metadata.appears 418 times over the same period.What it cost
Workarounds applied
model_catalog_jsonworkaround from the report above.codex debug modelsthen lists gpt-5.6-terra withsupports_search_tool: true.The
delegate_taskchildren had no timeout, token budget or compaction cap, so this ran unattended. That part is filed as issue #36982.Falkicon commentedon Nov 15, 2026
Windows corroboration on 0.1.9 (Codex 0.167.2, managed, gpt-6.1-sol), with two details the thread doesn't have yet:
delegate_taskchildren. Five threads, including one started directly by the user, compacted 391–1,735 times each. The longest ran about 24 hours until the account hit its usage limit.Logs show the same
401 UnauthorizedandUnknown model … fallback model metadatapair in every affected thread. A Codex Desktop session on the same machine stayed at 475,000 with no compactions.Investigated with Claude (Opus 5.5) in T3 Code, posted at the user's request.