Skip to content

fix: codex models return 404 when upstream providers are configured#369

Merged
icebear0828 merged 2 commits intomasterfrom
fix/codex-model-routing-404
Apr 13, 2026
Merged

fix: codex models return 404 when upstream providers are configured#369
icebear0828 merged 2 commits intomasterfrom
fix/codex-model-routing-404

Conversation

@icebear0828
Copy link
Copy Markdown
Owner

Summary

  • Fix UpstreamRouter.resolveMatch() incorrectly returning not-found for codex-native models (gpt-5.4, o3, etc.) when any upstream provider is configured
  • The root cause was defaultAdapter?.tag === "codex" always failing because the adapters map never contains a "codex" key
  • Make kind: "codex" adapter optional since codex models route to the built-in chatgpt.com backend

Fixes #368

Test plan

  • upstream-router.test.ts — 14 tests pass (codex routing no longer depends on adapter tag)
  • upstream-router-apikeys.test.ts — 10 tests pass (API key pool routing unaffected)
  • Full test suite — 1363/1363 pass, no regressions

The `resolveMatch()` fallback required `defaultAdapter?.tag === "codex"`,
but the adapters map never contains a "codex" key — only configured
provider names (openai, anthropic, etc.). This caused all codex-native
models (gpt-5.4, o3, etc.) to fall through to "not-found".

Remove the adapter tag check: `isKnownCodexModel()` alone is sufficient
since codex models route to the built-in chatgpt.com backend and don't
need an adapter.

Fixes #368
@icebear0828 icebear0828 merged commit df41344 into master Apr 13, 2026
1 check passed
@icebear0828 icebear0828 deleted the fix/codex-model-routing-404 branch April 13, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex models (gpt-5.4, o3, etc.) return 404 when upstream providers are configured

1 participant