Repository navigation
Description
What version of Codex CLI is running?
codex-cli 0.144.5
What subscription do you have?
ChatGPT authentication. The exact subscription tier is not relevant to the
reproduction.
Which model were you using?
gpt-5.6-sol
What platform is your computer?
macOS 26.5.2, Darwin 25.5.0, Apple Silicon.
What issue are you seeing?
Two long-lived app-server processes built from the exact same Codex binary and using the same CODEX_HOME, provider, auth mode, and ChatGPT account receive different model catalogs when only their app-server originator differs.
Both processes persist their originator-specific response to the same global $CODEX_HOME/models_cache.json. The file therefore alternates between two
valid, but semantically incompatible, catalogs:
Codex Desktop/codex_cli_rs:gpt-5.6-solhas
multi_agent_version = v1andtool_mode = direct.codex-chrome-extension-sidepanel: the same model has
multi_agent_version = v2andtool_mode = code_mode_only.
The app-server background refresh worker repeats the overwrite approximately
every three minutes. Depending on which process wrote last, newly started
sessions and runtime metadata consumers can see a different multi-agent/tool
configuration.
This is not a corrupt server response and is not explained by a CLI version,
provider, or account mismatch. It is a cache-identity and cross-process storage
problem.
Confirmed A/B measurements
The two app-server processes had:
- the same executable SHA-256;
- Codex CLI
0.144.5; - the same
CODEX_HOME, auth file, provider, token, account, request URL, and
User-Agent; - different app-server client identities/originators.
Direct /models?client_version=0.144.5 requests changing only originator
returned:
| Originator | Models ETag | Sol multi-agent | Sol tool mode |
|---|---|---|---|
Codex Desktop |
W/"6cbd9267ee12889ea6614486cc5879ff" |
v1 |
direct |
codex_cli_rs |
W/"6cbd9267ee12889ea6614486cc5879ff" |
v1 |
direct |
codex-chrome-extension-sidepanel |
W/"68e28197d956a749f12435108b07ff25" |
v2 |
code_mode_only |
Observed cache writes included:
| Time (UTC) | Writer | Request ID | Result |
|---|---|---|---|
| 11:33:36 | Codex Desktop | 25cc13a9-0991-4bc8-a5e6-ed9a125bd759 |
V1/direct catalog written |
| 11:34:03 | Chrome sidepanel | bb12724f-9a1d-4ef3-a256-1fa3c9fe3b1e |
V2/code-mode catalog written |
| about 3 minutes later | Chrome sidepanel | cfaa5c42-34e5-4600-8e1e-73df23bb9132 |
the alternating pattern repeated |
No token, account identifier, raw session transcript, or auth file is included
in this report.
What steps can reproduce the bug?
Reproduction A: two app-server clients
- Use one Codex binary, one
CODEX_HOME, and one ChatGPT account. - Start app-server A and initialize it with
clientInfo.name = "Codex Desktop". - Start app-server B and initialize it with
clientInfo.name = "codex-chrome-extension-sidepanel". - Request the model catalog from both processes.
- Record the request originator, ETag, and the
gpt-5.6-solfields
multi_agent_version,tool_mode, anduse_responses_lite. - Observe that the server returns different ETags/catalog metadata.
- Observe both processes writing to the same
$CODEX_HOME/models_cache.json. - Wait for multiple app-server refresh intervals and observe the file
alternating again.
Reproduction B: Desktop plus Chrome extension
- Fully quit ChatGPT Desktop and Chrome.
- Start ChatGPT Desktop and create a Codex task.
- Record app-server ancestry, initialize identity,
/modelsoriginator, ETag,
and the cache hash/content. - Start Chrome and open the ChatGPT extension side panel.
- Confirm that the extension's native host starts another Codex app-server.
- Record the same data and monitor
models_cache.json. - Close only the side panel, then Chrome, and repeat to determine the precise
native-host lifecycle.
In the observed run, the second app-server was a child of the ChatGPT for
Chrome native extension host, not a browser tab merely visiting chatgpt.com.
Reproduction C: deterministic regression test
Use two model managers sharing one temporary CODEX_HOME. Mock /models so
the same provider/account/version returns catalog A for originator A and
catalog B for originator B. Alternate online refreshes, drop both managers,
recreate them offline, and verify that each surface can recover its own
catalog. Current single-file behavior cannot preserve both.
Root cause
The request identity and cache identity do not match.
/models uses the app-server originator, and the service can return a different
catalog and ETag for each client surface. The persisted cache is nevertheless a
single global file. Cache eligibility on current main does not include
originator/client surface, and the file is last-writer-wins.
There are three interacting layers:
- Semantic isolation: originator-specific catalogs share one cache slot.
- Cross-process coordination: independent app-servers have separate
in-memory ETag/catalog state but overwrite the same disk file. - Write safety/amplification: the cache is rewritten as a complete file,
including matching-ETag TTL renewal, without a per-identity slot. Related
reports also show truncated/EOF reads and excessive write churn.
The app-server refresh worker makes the latent design issue persistent: each
long-lived process refreshes immediately and then approximately every three
minutes.
How the code reached this state
- load models from disk and set a ttl and etag #7722 introduced one disk cache, a five-minute TTL, and ETag storage.
- Refresh on models etag mismatch #8491 added refresh on a model ETag mismatch.
- fix(app-server): set originator header from initialize JSON-RPC request #8873 and fix(app-server): set originator header from initialize (re-revert) #8988 made app-server
clientInfo.namethe process originator,
allowing/modelsrequests to represent the actual client surface. - Renew cache ttl on etag match #9174 renews cache freshness on matching ETags by rewriting the cache.
- Require models refresh on cli version mismatch #10414 rejects caches from another client version, but does not preserve
multiple producer identities. - feat: let model providers own model discovery #18950 moved model discovery under providers. A Codex P1 review explicitly
warned that cache eligibility needed provider identity or separate cache
files. The PR was subsequently approved and merged without adding that
isolation, leaving the single-slot design debt in place:
feat: let model providers own model discovery #18950 (review) - app-server: keep the model cache warm #28699 added immediate and three-minute app-server background refreshes to
avoid cold model-list latency. That change did not create the originator
split, but it turns occasional last-writer-wins contamination into a
recurring oscillation. - [codex] Scope model cache by provider and account #30984 is a current draft that adds
provider_id,auth_mode, and
account_idto cache eligibility. It does not include originator and still
uses a single file, so both producers in this reproduction have the same key
and one surface's catalog still evicts the other's.
Related reports:
- Windows app launches stale cached app-server runtime (0.142.0) instead of current one — causes "model requires a newer version of Codex" and corrupts shared models_cache.json #32482 and Codex CLI /model picker hides GPT-5.6 when models_cache.json is stale #33146: a different runtime/version overwrites the shared cache.
- Excessive SSD write churn from
scope_v3.jsonandmodels_cache.json#32496: matching-ETag TTL renewal causes high write volume. - Codex Desktop crash: codex_models_manager failed to renew cache TTL after EOF parsing model cache #30864: truncated/EOF cache reads.
- [App 26.707.62119] Running picker exposes unsupported gpt-5.2 and hides Spark while fresh model/list shows the opposite #32850: a running UI and a fresh catalog disagree.
- gpt-5.6-sol loses all MCP tools after runtime metadata changes to tool_mode = "direct" #33575 and MCP tools discovered but unavailable after updating from 0.144.4 to 0.144.5 #33547: model-visible MCP tools disappear after runtime metadata
changes. - Regression: Responses Lite makes deferred MultiAgentV1 tools unreachable because tool_search is hidden in AdditionalTools #32086: a separate downstream bug where Responses Lite makes deferred V1
tools unreachable becausetool_searchis not exposed correctly.
The last distinction matters: cache isolation explains why a surface/session
can unexpectedly receive V1 versus V2 metadata. If the server intentionally
returns V1/Responses Lite to a surface, #32086 still needs its own fix.
What is the expected behavior?
Different catalog identities must not overwrite or reuse one another's model
metadata. A client surface should consistently receive and recover the catalog
that was fetched for its own request identity, including after process restart
or while temporarily offline.
Suggested fix
Treat the catalog scope as a first-class identity derived from the same
snapshot used to make the request:
provider_id
endpoint identity/fingerprint
effective auth mode
account/principal
exact originator/client surface
client-version compatibility
The smallest robust storage change is independent per-identity cache slots,
preferably separate files keyed by a hash of that tuple. Each slot should own
its catalog, ETag, and freshness. Storing the account ID directly in the
filename is unnecessary.
Also recommended:
- snapshot auth and originator once per fetch, then use that snapshot for both
the HTTP request and cache key; - start the refresh worker only after the app-server initialize identity is
fixed; - use atomic temporary-file replacement;
- use a same-key cross-process lock or another conflict-safe strategy;
- avoid rewriting the full catalog for every equal-ETag freshness renewal,
for example by using a small freshness sidecar or coalescing writes; - keep in-memory catalog/ETag state partitioned by the same identity.
Adding only an originator validation field to the existing single file would prevent applying a mismatched catalog, but it would still cause eviction, repeated network fetches, and loss of the previous surface's offline state.
Validation plan
Please include regression coverage for:
- Same binary/provider/account/version, two originators, different ETags/catalogs.
- Alternating online writes in one
CODEX_HOME. - Dropping and recreating both managers, followed by offline lookup for each originator.
- Multiple background-worker cycles.
- Concurrent writers always leaving parseable, complete JSON.
- Failure injection during atomic replacement.
- Matching-ETag renewal affecting only the correct identity and obeying a write-rate bound.
- Initialization races where a worker starts before client identity is known.
- A separate Regression: Responses Lite makes deferred MultiAgentV1 tools unreachable because tool_search is hidden in AdditionalTools #32086 regression proving that V1/Responses Lite retains a usable top-level
tool_searchroute.
Why this is a separate root-cause report
Existing issues cover symptoms or adjacent dimensions: V1 tool serialization, MCP tools disappearing, version skew, provider/account contamination, write amplification, and truncated files. This reproduction isolates a missing cache dimension that is not covered by those reports: the exact same binary, provider, auth mode, account, and client version receive different catalogs
solely because their originators differ, then continuously overwrite one shared cache file.
Activity
github-actions commentedon Jul 16, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
nerdchanii commentedon Jul 16, 2026
Follow-up: this is not an app-server version mismatch
I rechecked the two live processes and their executable files directly.
/Applications/ChatGPT.app/Contents/Resources/codexcodex-cli 0.144.5bdcb530615d44fcc7b35d12fe00f30c3025c25fc22a21193591dcdb064304385~/.codex/plugins/.plugin-appserver/codexcodex-cli 0.144.5bdcb530615d44fcc7b35d12fe00f30c3025c25fc22a21193591dcdb064304385cmpalso reports that the two executable files are byte-for-byte identical. Both processes use the same~/.codex/models_cache.json.The catalog is returned by the remote ChatGPT Codex backend endpoint:
This is not a locally generated catalog and it is not a request to
api.openai.com. The observed HTTP response is served through thechatgpt.combackend (the edge response identifies Cloudflare). The exact internal OpenAI service name behind that endpoint is not visible from clientlogs.
The live sequence makes the identity mismatch explicit:
At
2026-07-16 13:13:16 UTC, Chrome app-server PID60805requested/models?client_version=0.144.5and received:This is the Chrome-sidepanel V2 /
code_mode_onlycatalog.At
13:13:29 UTC, Desktop app-server PID57870loaded that freshly written cache. It accepted it because the cached and expectedclient_versionwere both0.144.5, then applied ETag68e28197....At
13:13:30 UTC, Desktop requested the same URL with the sameclient_versionand received:This is the Desktop V1 /
directcatalog, which was then persisted back tothe same cache file.
The material request difference is the client
originator:Therefore
multi_agent_version = v1versusv2is not the version of the app-server executable. It is server-provided model runtime metadata inside two originator-specific catalogs.The failure condition is consequently:
If the two processes received identical catalog content and ETags, sharing the cache would not create this semantic contamination. Here, however, executable version equality does not protect the cache because
originatoraffects the server response but is absent from the cache identity.nerdchanii commentedon Jul 17, 2026
I put together a reference implementation of the originator-scoped cache described above:
https://github.com/nerdchanii/codex/tree/models-cache-originator-scope (single commit: nerdchanii/codex@78060a7)
What it does:
CODEX_HOME/models_cache/<sha256(originator)>.jsonKnown limitations, intentionally out of scope for this PoC:
models_cache.jsonModelsCacheKeyproposed in [codex] Scope model cache by provider and account #30984 rather than living as a separate path scheme.Happy to turn this into a PR if the direction looks reasonable to the maintainers.
Stop the model catalog from serving a snapshot it cannot vouch for
shiwandehongbai commentedon Oct 12, 2026
Confirmed on Windows on 2026-10-12. The same shared-cache problem also affects the new GPT-6.1 Sol 500k default context.
Environment:
A controlled test used the same official binary and account, fresh isolated CODEX_HOME/model caches, the same minimal config and clientInfo.version, and initialize -> initialized -> model/list. Only clientInfo.name changed, so the generated originator/User-Agent also changed:
The serialized provider/auth identity was equal across all three tests. A separate native test with codex_cli_rs also returned 272000.
The actual shared models_cache.json was observed at 08:50:01 UTC with context_window=500000 after an independent client fetched the catalog. At 08:50:16 UTC, the Desktop process replaced it with context_window=272000 following another successful official GET /backend-api/codex/models?client_version=0.162.0. Desktop session token_count telemetry remained model_context_window=258400 (272000 * 95%).
Selected Desktop requests returning the 272k-catalog ETag:
The independent client's 08:50:00 UTC request returned the 500k-catalog ETag:
There are two distinct issues to resolve:
No credentials, account IDs, local usernames/paths, or raw conversation transcripts are included. The isolated tests made no model-generation calls and did not modify the real app configuration or client identity.
gudabing commentedon Oct 12, 2026
macOS reproduction: GPT-6.1 Sol 500K/272K oscillation (2026-10-12, UTC+08:00)
Adding an independent macOS reproduction to the existing cross-originator shared-cache report. This is the actual context window used by a live session, not merely a stale UI label.
Environment
0.162.0-alpha.17.2; another browser-assistant app-server uses the sameCODEX_HOME.gpt-6.1-sol, catalog requestclient_version=0.162.0.model_catalog_json,model_context_window, ormodel_auto_compact_token_limitoverride. Third-party OpenCodex routing was not active.~/.codex/models_cache.json. No configuration/cache modifications were made during the investigation.Actual oscillation within one existing session (2026-10-12, Beijing time; transitions at
task_started, followed bytoken_count.info.model_context_window):token_countconfirmationAll of these turns used GPT-6.1 Sol; the effective window changed in runtime telemetry as well as in the UI.
Controlled official catalog A/B
Authenticated requests to
https://chatgpt.com/backend-api/codex/models?client_version=0.162.0, with the same account and client_version, changed only theoriginatorheader. Both responses were HTTP 200:originatorcontext_windowmax_context_windowcodex_cli_rsfab6ce39…codex-browser-use8c738ab0…Both catalogs specify
effective_context_window_percent = 95, explaining the exact observed values272000 × .95 = 258400and500000 × .95 = 475000.Desktop and browser-assistant processes were observed using the respective catalog ETags, and both share the global model-cache file. Cache reloads occurred near the session transitions. This strongly supports originator-dependent server catalogs + cross-process shared-cache contamination. The complete catalog snapshot was not captured at every transition, so the exact overwrite chain for each individual flip remains an inference; random variation for identical requests was not established.
Two issues to address
codex_cli_rsoriginator still receives a 272K default, even in a successful fresh authenticated response.Expected result: a consistent 500K default (475K effective) for eligible first-party coding clients and a stable effective context window across successive turns, regardless of simultaneous browser-assistant and Desktop app-server activity.
No credentials, account identifiers, local usernames, raw session transcripts, or private files are included in this report.
Roland0511 commentedon Oct 12, 2026
Independent macOS reproduction: Sol Ultrafast repeatedly disappears from the shared catalog
I am a $500 Pro subscription user, using ChatGPT sign-in. This adds a service-tier reproduction to the cache-identity problem in this issue and connects it to #52839.
Environment and scope
26.1007.30912, build20156(installed bundle verified).0.162.0-alpha.17.2; managed daemon CLI0.162.1.gpt-6.1-sol.$CODEX_HOME/models_cache.json.Fresh official catalog comparisons
Using the same account and both official binaries, fresh catalog reads reproduced the selected comparisons below. Probe processes were denied reads of the shared model cache and writes anywhere in the real
CODEX_HOME, with read/write denial controls verified.Codex Desktop(desktop main service's observed override)codex_cli_rscodex-browser-use(Computer Use helper initialize name)codex_desktop(underscore spelling)A separate four-request control held User-Agent identity constant and changed only the
originatorheader. For both binary versions,originator=codex-browser-usereturnedservice_tiersIDs["priority","ultrafast"]andadditional_speed_tiers=["fast","ultrafast"];originator=Codex Desktopreturned only["priority"]/["fast"]. Thus the space-versus-underscore identity difference is reproducible; binary version alone does not explain the returned capabilities.Actual file writers
A five-minute filesystem trace attributed successful replacements of the real shared cache to these process roles:
The daemon's historical GET and writer PID were correlated, but its exact outgoing originator header was not logged.
Deterministic local fixture controls
Both binaries preserve a synthetic catalog's Ultrafast fields when writing the cache, with
features.ultrafast_modeeither true or false. The field is not being removed by a local serialization filter.With two identities sharing one temporary cache:
This demonstrates both cross-originator cache reuse at the same version and repeated full replacement when the two installed versions alternate.
Requested upstream behavior
Please partition persisted catalog/ETag/freshness by the request's exact effective originator together with provider/endpoint/auth/account and version compatibility, rather than allowing independent clients to reuse/evict one global slot. Also please investigate why normal first-party identities omit Sol Ultrafast for affected $500 subscribers; cache isolation alone does not change a fresh server response.
Limits and privacy
The backend rollout/eligibility rule is unknown. Catalog metadata is not proof of inference entitlement, served tier, or billing. These probes started no inference tasks and did not parse/copy auth tokens or modify the real cache. The observed cache replacements came from the existing services. Only this sanitized summary is posted; no account IDs, credentials, raw account responses, private transcripts, or local personal paths are attached. Subsequent local mitigation is separate from the observations above.
Related service-tier report: #52839
javadavado-svg commentedon Nov 10, 2026
I’m seeing similar context-window instability in a long-running Codex Desktop conversation on Windows, using GPT-6 Astra with High reasoning effort.
On November 10, 2026, the local rollout recorded:
last_token_usage: 274,037 input tokens, 285 output tokens, 274,322 total tokens;model_context_window: 475,000model_context_window: 258,400The previous request’s reported usage was about 58% of the larger window, leaving approximately 42% remaining. The next turn’s reported capacity was about 46% smaller. These percentages are calculated from log fields, not synchronized UI measurements.
Earlier that day, another turn contained five completed compaction markers. The first compaction record was timestamped 07:36:21.669 UTC; the turn ran from approximately 07:35:44 to 07:43:33 UTC and eventually delivered its result. I also observed the context indicator falling from over 40% remaining to roughly 1% across a response, and subsequently saw another drop from a window above 400k into the mid-200k range.
Impact: relatively straightforward follow-up requests are sometimes taking more than five minutes while compaction repeats. The earlier five-compaction turn lasted approximately 7 minutes 49 seconds; the later turn lasted approximately 7 minutes 18 seconds. These are total turn durations—not measurements of time spent exclusively compacting—but the interruptions materially slow interactive work.
The work eventually continued, so I am reporting unstable context capacity, repeated compaction and latency, rather than claiming permanent work loss.
The 475,000 ↔ 258,400 values closely match reports already in this issue. However, I have not established that shared-cache contamination caused my case, or that the window change alone caused each compaction.
Could OpenAI investigate why the reported context capacity changes between turns and expose the effective window, compaction threshold and reason for changes? A stable, predictable context window matters for paid interactive use.
littletaro97-arch commentedon Nov 19, 2026
Additional Windows Codex Desktop data point: the same conversation changed from an effective context window of 258,400 to 475,000 tokens between successive turns, with
gpt-6.2-solandmaxreasoning recorded in both turns.model_context_window: 258400. Five automatic compactions completed in about eight minutes. The first measured input after each one was still 255,466–256,212 tokens./compactturn started withmodel_context_window: 475000before compaction completed. The next ordinary turn also started at 475,000; its first measured input was 96,430 tokens.This confirms the window change in runtime records and the repeated-compaction symptom for this session. I did not capture the catalog responses or cache history at the transition, so I cannot attribute it to the same cache mechanism.