Repository navigation
Description
Client or integration
Codex App
Area
Catalog / models
Summary
Routed catalog rows (any provider/model slug — local bridges, OpenRouter, DeepSeek, etc.) inherit comp_hash from whichever native GPT row findSupportedNativeTemplate() happens to pick as the clone template (src/codex/catalog/derive-entry.ts:124-146, cloning src/codex/catalog/parsing.ts:363-372's pick). Which native row that is can change between two catalog rewrites that are otherwise unrelated to the routed models themselves, because different rebuild paths read different source catalogs (current catalog vs. catalog backup vs. active Codex models cache vs. bundled — the fallback chain in src/codex/catalog/bundled.ts:540-551).
comp_hash is not stripped for routed rows the way context_window/max_context_window/auto_compact_token_limit already are (derive-entry.ts:139-145, with the comment "A routed model is NOT the native template: never inherit its context window..."), so it survives the clone as an accident of catalog rebuild order rather than a real property of the routed model.
Per openai/codex#27520, Codex compacts a thread before its next turn whenever the thread's recorded model comp_hash no longer matches the current one. So every unrelated catalog rewrite that happens to change which native row is template-eligible silently force-compacts every active routed thread on its next turn — regardless of how full the context actually is, and with no log line or catalog diff warning the user beforehand. It can also flip back and forth (observed 3000 → opencodex → 3000 within ~8 hours), so a thread can pay the compaction cost twice for no reason related to its own model or usage.
Expected: a routed model's comp_hash should be a stable, deterministic property of that model (e.g. derived from provider name + model id + adapter), not inherited from whichever unrelated native row happens to be catalog-first on a given rebuild.
Reproduction
This is intermittent and depends on catalog rebuild history rather than a fixed command sequence, but the trigger is reliable:
- Have at least one routed provider registered (e.g. via
connect-local-bridges.cjs, or any custom provider) and an active Codex thread using a routed model. - Trigger a catalog rebuild through a path whose
findSupportedNativeTemplate()resolves to a different native row than the previous rebuild did — e.g.:- registering/re-registering a provider (calls into the catalog builder), or
- an OpenCodex resync/restart that reads a different source catalog (current vs. backup vs. active-models-cache vs. bundled) than the last rebuild, especially if a catalog backup was recovered that predates the
comp_hashfield (falls through to the"opencodex"default atparsing.ts:634).
- Diff
~/.codex/opencodex-catalog.jsonbefore/after: every routed row'scomp_hashchanges together, in lockstep, even though no routed model itself changed. - Send the next message on any routed-model thread that had a prior turn recorded with the old
comp_hash. Codex compacts before answering, even at low context fill.
Observed concretely on 2026-09-24 (times local):
| time | trigger | routed comp_hash |
|---|---|---|
| through 03:53 | (baseline, many prior rebuilds) | "3000" |
| 03:53:18 | connect-local-bridges.cjs registered a new provider (routine add, unrelated to any native model) |
"3000" → "opencodex" — template became gpt-5.5, restored from an old catalog backup with no comp_hash, defaulted per parsing.ts:634 |
| 06:48:19 | opencodex restart / pinned-start resync | stayed "opencodex" |
| 11:59:06 | a user action inside the OpenCodex dashboard (package still 2.64.0, no process restart) rewrote ~/.opencodex/config.json |
— |
| 12:01:34 | catalog rewritten again; template resolved back to a "3000"-tagged native row |
"opencodex" → "3000" |
Every routed thread with a turn recorded between 03:53 and 12:01 (comp_hash:"opencodex") compacted on its next message after 12:01 — at context fills of 12%, 16%, 24%, 24%, and 30% of the model's auto_compact_token_limit (896,800 tokens for the affected model), nowhere near the normal 95% compaction threshold. None of these threads' routed model changed in any way — same provider, same model id, same context window; only the unrelated native template row changed.
Version
2.64.0
Operating system
Windows 11 Pro, 10.0.26200 (Build 26200)
Provider and model
Not provider-specific — reproduced across every routed provider active at the time (local bridge providers and openai-1m/gpt-6-sol). Affects any routed (namespaced provider/model) catalog row.
Logs or error output
Session comp_hash trace (routed threads), local time:
2026-09-24T11:14:37Z 3000->opencodex openai-1m/gpt-6-sol
2026-09-24T11:37:59Z 3000->opencodex openai-1m/gpt-6-sol
2026-09-24T16:09:21Z 3000->opencodex local-zcode/glm-5.3-flash
2026-09-24T19:03:26Z opencodex->3000 local-zcode/glm-5.3-flash
2026-09-24T19:03:49Z opencodex->3000 local-zcode/glm-5.3-flash
2026-09-24T19:03:59Z opencodex->3000 local-zcode/glm-5.3-flash
2026-09-24T19:04:27Z opencodex->3000 local-zcode/glm-5.3-flash
2026-09-24T19:04:32Z opencodex->3000 openai-1m/gpt-6-sol
2026-09-24T19:04:34Z opencodex->3000 local-zcode/glm-5.3-flash
2026-09-24T19:07:08Z opencodex->3000 openai-1m/gpt-6-sol
Context fill at compaction (well below the 95% auto_compact_token_limit gate):
2026-09-24T10:57Z fill=16% (146041 / 896800 tokens)
2026-09-24T10:58Z fill=24% (218981 / 896800 tokens)
2026-09-24T10:58Z fill=12% (111901 / 896800 tokens)
2026-09-24T11:02Z fill=30% (267585 / 896800 tokens)
2026-09-24T11:07Z fill=24% (213003 / 896800 tokens)
Screenshots and supporting files
None attached; happy to provide the full opencodex-catalog.json diff across the 03:53/12:01 rebuilds if useful.
Redacted configuration
Not config-dependent in a way a snippet would show — this reproduces with any routed provider registered, using the default catalog rebuild paths (no custom routing config involved).
Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
github-actions commentedon Sep 24, 2026
Issue reopened
The report now contains the information required by the automated check. Thanks for updating it.
fix(catalog): stop routed rows inheriting the template's comp_hash (#…
lidge-jun commentedon Sep 25, 2026
Fixed on
devby #5802 (merge commit c0599d0). Routed catalog rows no longer inheritcomp_hashfrom whichever native row a rebuild picked as its template. Every routed row gets the fixed"opencodex"marker, including rows kept from disk during a provider outage, so a catalog rebuild no longer forces compaction on active routed threads. Native, Codex-forward and foreign rows keep their own values. The fix ships in the next release. After updating, runocx synconce to rewrite the catalog.