Skip to content

fix(codex): restore gpt-5.3-codex-spark for ChatGPT Pro (salvage #18286 + #19530, fixes #16172)#22991

Merged
kshitijk4poor merged 8 commits into
NousResearch:mainfrom
kshitijk4poor:feat/restore-codex-spark-pro
May 10, 2026
Merged

fix(codex): restore gpt-5.3-codex-spark for ChatGPT Pro (salvage #18286 + #19530, fixes #16172)#22991
kshitijk4poor merged 8 commits into
NousResearch:mainfrom
kshitijk4poor:feat/restore-codex-spark-pro

Conversation

@kshitijk4poor

@kshitijk4poor kshitijk4poor commented May 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Salvages PR #18286 (@nederev) and PR #19530 (@askclaw-vesper) into a unified restoration of gpt-5.3-codex-spark for ChatGPT Pro subscribers, fixes #16172.

PR #12994 (April 2026, mine) removed gpt-5.3-codex-spark from the openai-codex catalog on the assumption that it was unsupported. That was wrong. Per OpenAI's Codex pricing page and Codex developer docs:

GPT-5.3-Codex-Spark is in research preview for ChatGPT Pro users only, and isn't available in the API at launch. Because it runs on specialized low-latency hardware, usage is governed by a separate usage limit that may adjust based on demand.

So it's a real, valid Codex model — just gated to the ChatGPT Pro subscription via the Codex OAuth backend (chatgpt.com/backend-api/codex/models), not the public OpenAI API. Two community PRs fixed pieces of this; neither alone is sufficient. This salvage combines them and adds documentation so it doesn't get stripped again.

What landed (per-commit, original authorship preserved)

Commit Author Origin Purpose
feat(codex): add gpt-5.3-codex-spark model @nederev #18286 Re-add to DEFAULT_CODEX_MODELS + forward-compat templates
fix(model-metadata): restore gpt-5.3-codex-spark fallback context @nederev #18286 Add to _CODEX_OAUTH_CONTEXT_FALLBACK
fix(model-metadata): set codex-spark fallback context to 128k @nederev #18286 Correct Codex OAuth fallback to 128k (Spark's reduced window)
fix: surface Codex CLI-only models @askclaw-vesper #19530 Drop supported_in_api: false filter; wire gateway picker to live discovery
chore: add codex-spark salvage contributors to AUTHOR_MAP me Attribution for the contributor commits above
docs(codex-spark): document ChatGPT Pro entitlement gating me Comments explaining why this model belongs (and why the filter is gone)
test(codex-spark): add live-API regression and make picker test deterministic me Symmetric live-fetch unit test + pin gateway-picker test to cache fallback
fix(codex-spark): defensive 128k entry in DEFAULT_CONTEXT_LENGTHS + clarify validation test docstring me Defensive fallback override (longest-substring would otherwise resolve Spark to 400k via gpt-5 match); docstring cleanup

Why both PRs together

Spark only flows through one path: the Codex OAuth backend. That means three things must all be true:

  1. The supported_in_api: false filter must be removed. The Codex backend reports this flag on Spark because it's not in the public OpenAI API — but Hermes' openai-codex provider talks to the same OAuth backend Codex CLI does, so the flag is irrelevant for our route. (PR fix: surface Codex CLI-only models #19530)
  2. The gateway /model picker must use live discovery for openai-codex. Otherwise Telegram/Discord fall through to a static curated list that has no way to reflect ChatGPT-Pro-only entitlements. (PR fix: surface Codex CLI-only models #19530)
  3. The static curated catalog must include Spark. Live discovery falls back to this when the user is offline, hits a transient API error, or lands on first run before the cache is populated. Without it, Pro users still lose Spark in those cases. (PR feat(codex): add gpt-5.3-codex-spark model #18286)

PR #18286 alone leaves the filter in — Pro users see nothing from live discovery. PR #19530 alone leaves no fallback — offline users see nothing. Both together = correct.

Asymmetry: openai-codex vs openai

Spark stays out of _PROVIDER_MODELS["openai"] (the public API key catalog) on purpose. It isn't on the public OpenAI API. The new docstring on DEFAULT_CODEX_MODELS documents this intent so future cleanups don't strip the entry again.

Test plan

scripts/run_tests.sh tests/hermes_cli/test_codex_models.py \
                     tests/hermes_cli/test_codex_cli_model_picker.py \
                     tests/hermes_cli/test_openai_codex_model_validation_fallback.py \
                     tests/agent/test_model_metadata.py

119 passed locally, against current origin/main after rebase.

E2E coverage (verified in an isolated tempdir with mocked httpx):

  • ✅ Curated DEFAULT_CODEX_MODELS returns Spark when no token + no cache
  • ✅ Cached lookup keeps supported_in_api: false slugs (Spark survives, visibility: hidden still gets filtered)
  • ✅ Live API fetch keeps supported_in_api: false slugs
  • ✅ Context length resolves to 128k for Spark, 272k for sibling gpt-5.3-codex via Codex OAuth fallback (longest-key-first match)
  • ✅ Defensive: DEFAULT_CONTEXT_LENGTHS longest-substring lookup also resolves Spark → 128k (was 400k via the generic gpt-5 entry)
  • provider_model_ids("openai-codex") end-to-end returns Spark

Closes #16172. Supersedes #18286, #19530.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard provider/copilot GitHub Copilot (ACP + Chat) P3 Low — cosmetic, nice to have labels May 10, 2026
nederev and others added 8 commits May 10, 2026 11:45
Maps olegwn@gmail.com → nederev (PR NousResearch#18286) and vesper@askclaw.dev →
askclaw-vesper (PR NousResearch#19530) so the contributor attribution check passes
when their commits land via this salvage.
PR NousResearch#12994 stripped gpt-5.3-codex-spark on the assumption that it was
unsupported. It's actually research-preview, ChatGPT-Pro-only, exposed
via the Codex OAuth backend at chatgpt.com/backend-api/codex/models —
not via the public OpenAI API.

Add explanatory comments in:
  - DEFAULT_CODEX_MODELS / _FORWARD_COMPAT_TEMPLATE_MODELS (codex_models.py)
  - _CODEX_OAUTH_CONTEXT_FALLBACK (model_metadata.py)
  - list_authenticated_providers' live-discovery branch (model_switch.py)

so future maintainers don't strip the entry again. Also documents the
intentional asymmetry that Spark stays out of the "openai" provider
catalog (it isn't on the public API) and why the supported_in_api
filter is *not* applied for the openai-codex route.
…ministic

Two follow-ups from self-review:

1. Add unit test for _fetch_models_from_api covering the live HTTP path.
   The salvaged PR NousResearch#19530 dropped the supported_in_api:false filter in
   both _fetch_models_from_api and _read_cache_models, but only the
   cache path had a regression test. This adds the symmetric live-fetch
   test (mocked httpx) so a future drive-by change to the HTTP path
   can't silently re-introduce the filter.

2. Pin test_codex_picker_uses_live_codex_catalog to the cache fallback.
   The test wrote a fake JWT and a CODEX_HOME cache, but provider_model_ids
   ('openai-codex') still issued a real 10s HTTP probe to
   chatgpt.com/backend-api/codex/models before falling back to the cache.
   That made the test slow and non-deterministic in restricted/CI
   networks. Patch _fetch_models_from_api to return [] so we go straight
   to the cache path the test actually means to exercise.
…larify validation test docstring

Two follow-ups from self-review:

1. Add gpt-5.3-codex-spark to DEFAULT_CONTEXT_LENGTHS at 128k. The
   primary resolution path for Spark goes through provider='openai-codex'
   → _CODEX_OAUTH_CONTEXT_FALLBACK (already correct). But if any future
   code path resolves Spark's context with a different provider (custom
   proxy, generic fallthrough), the longest-substring-first lookup in
   step 8 would match 'gpt-5' and report 400k, which is wrong by ~3x.
   Adding the explicit override is a cheap defensive correctness fix
   matching how gpt-5.4-mini and gpt-5.4-nano already shadow the generic
   gpt-5 entry.

2. Update test_openai_codex_model_validation_fallback.py docstring. The
   bug it was originally written for (gpt-5.3-codex-spark missing from
   listing) is now resolved by this PR's catalog restoration. The test
   still validly exercises the soft-accept code path for any future
   entitlement-gated Codex slug that ships before Hermes catalogs it,
   but the framing was stale — clarified.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have provider/copilot GitHub Copilot (ACP + Chat) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cannot select gpt-5.3-codex-spark in openai-codex provider

4 participants