Repository navigation
fix(clients): stop advertising native models the proxy cannot route - #9042
Draft
yogesh-aggarwal wants to merge 3 commits into
Draft
yogesh-aggarwal wants to merge 3 commits into
yogesh-aggarwal wants to merge 3 commits into
Conversation
A native OpenAI row is only servable while `providers.openai` is enabled: the router answers every bare `gpt-*` selector with `NoEnabledOpenAiProviderError` the moment that provider is disabled, in both Pool and Direct mode. Three client-facing surfaces did not apply that rule, so they offered a picker whose selections could only fail: - `loadExportModels` (`src/server/management/model-rows.ts`) kept native rows unless the individual slug was disabled. Every `/api/client-config` client, every managed integration route and `ocx export` read this roster, so a config with `providers.openai.disabled` exported all native slugs — including the eleven a stock catalog lists — while the router refused each one. - `opencodeCatalogFromProxyRows` and `opencodeLaunchNativeSlugs` (`src/cli/opencode.ts`) filtered natives only for Codex Direct mode, so `ocx opencode` and the launcher's V1/V2 blocks advertised the same dead rows. The rule is one predicate, `isNativeOpenAiProviderEnabled`, which is the router's own admission for a bare native selector: the provider exists and is not disabled, whatever its auth mode. It is deliberately weaker than `shouldIncludeAccountBoundNativeOpenAi` (canonical forward auth is an account-qualified requirement) and deliberately omits `shouldIncludeNativeOpenAi`'s no-enabled-provider bootstrap exception, which keeps the Codex catalog listable rather than promising a servable row. `loadExportModels` and the launcher now both consult it. Direct-mode omission for the launcher is unchanged, and the Pi/DSH rosters keep their own stronger credential rule. Regression coverage: `tests/server/management-model-roster.test.ts` (enabled in both modes, disabled in both modes, absent provider), `tests/providers/opencode-cli.test.ts` (slug selection and proxy-row catalog under a disabled provider), plus the three fixtures that described a config without `providers.openai` while asserting native rows — an unrepresentable state, since a fresh install materializes that provider enabled. Docs: `structure/clients/export-model-names.md` records the admission rule, and the OpenCode guide states when native rows are omitted.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Contributor
|
✅ Deterministic PR hygiene checks passed. |
Contributor
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This PR stays in draft until every box above is ticked. Hygiene✅ Deterministic PR hygiene checks passed. |
The English guide gained a paragraph explaining when native OpenAI slug rows are omitted from the picker. `tests/ci-workflows/docs-spanish-localization.test.ts` requires every inline code identifier in the canonical page to appear in the Spanish translation, so the untranslated paragraph failed that gate on `openai` and `gpt-*`. AGENTS.md also requires translated locales not to contradict the English source, so all eight translated guides carry the same statement rather than only the one the gate reads.
The paragraph had landed inside 'Selector proof', between the alias-candidate sentence and the paragraph that continues it. It is a separate invariant about which rows the export roster may publish, so it now stands on its own after 'Stored connection mode', before the CLI and API boundary.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a defect in which client-facing surfaces advertised native OpenAI models that the proxy
cannot route.
routeModelanswers any baregpt-*selector withNoEnabledOpenAiProviderErroras soon asproviders.openaiis disabled or absent — in Pool and Direct mode alike. Three paths did notapply that rule:
loadExportModels(src/server/management/model-rows.ts) kept a native row unless theindividual slug was disabled.
GET /api/client-config, every management integration route andocx exportread this one roster, so a config withproviders.openai.disabledexported allnative slugs — the eleven a stock catalog lists — while the router refused each one.
opencodeCatalogFromProxyRowsandopencodeLaunchNativeSlugs(src/cli/opencode.ts)filtered natives only for Codex Direct mode, so
ocx opencodeand the launcher's V1/V2 blocksoffered the same unroutable rows.
This is the client-export half of the class #636 fixed for the Codex catalog (#643 added
shouldIncludeNativeOpenAithere). The catalog stopped advertising bare rows; the export andlauncher rosters did not.
The fix is one predicate,
isNativeOpenAiProviderEnabledinsrc/codex/catalog/metadata.ts, which is the router's own admission for a bare native selector:the provider exists and is not disabled, whatever its auth mode.
shouldIncludeAccountBoundNativeOpenAi, whose exact-accountroutes additionally require canonical forward auth.
shouldIncludeNativeOpenAi's no-enabled-provider bootstrap exception,which keeps the Codex catalog listable (so an operator can turn a provider on) rather than
promising a row is servable.
loadExportModelsand both launcher functions now consult it. The launcher's Direct-modeomission and the Pi/DSH per-client credential rules are unchanged; a disabled provider is simply
one more state in which no client may be offered a native selector.
Regression coverage
tests/server/management-model-roster.test.ts— native rows kept with an enabled provider inboth account modes; dropped with a disabled provider in both modes (routed rows untouched);
dropped when
providers.openaiis absent.tests/providers/opencode-cli.test.ts—opencodeLaunchNativeSlugsempty for a disabledprovider in both modes, and
opencodeCatalogFromProxyRowsdropping the same row.providers.openaiwhile asserting native rowswere corrected. That state is unrepresentable on disk — a fresh install materializes
providers.openaienabled (pool) — so the fixtures now include it rather than testing ashape the code cannot produce. No assertion was relaxed.
Docs
structure/clients/export-model-names.md— records the native-row admission rule and whichpredicate it uses.
docs-site/.../guides/opencode.md— states when native slug rows are omitted from the picker,and the same paragraph is carried by all eight translated guides. The Spanish localization gate
requires every inline code identifier on the canonical page to appear in its translation, so
leaving the paragraph English-only failed that gate; AGENTS.md separately requires translations
not to contradict the English source, so every locale was updated rather than just the one checked.
Verification
Commands run at the PR head on macOS (darwin 27.2.0, Bun 1.4.4):
Documentation gates, which the docs change also affects:
Focused suites (254 pass / 0 fail):
bun test tests/server/management-model-roster.test.ts \ tests/providers/opencode-cli.test.ts \ tests/cli/cli-export-command.test.ts \ tests/config/client-config-export.test.ts \ tests/server/management-client-config-route.test.ts \ tests/server/api-catalog-route.test.tsFull suite:
bun run test(cap raised from the default 900 s for this machine) — the parallellane reported 72,688 pass / 739 skip / 4 fail across 73,431 tests in 3,411 files in 1,341 s;
the isolated serial lanes it excludes reported 84 pass / 23 skip, every lane exiting 0. None of the four failures involve
this change, and each is reproducible without it:
end-to-end Home <-> compiled ocx-child lifecycleocx-childbinary on PATH and no cargo to build one.release-preflight"source resolution refuses invalid dispatch…"test preload"fails the case after which the guarded checkout's config changed"commit.gpgsignwith a key the sandboxed probe cannot use; the probe's fixture commit fails for that reason.bun test argv"changed-mode uses the shared merge base…"commit.gpgsigncause.The last two pass with
GIT_CONFIG_GLOBAL=/dev/null.codex-cli-update-apply.test.tsalsofails in this checkout only: its fixture root is
<repo>/.tmp/codex-cli-management-e2e-*,and this checkout lives under
/Volumes/Work/Vault(mode775), whichassertTrustedCodexCliAncestryrejects as group-writable — the same test passes in a clone at a755path. That is a property of my local checkout, not of the diff.Behavioral evidence: with
providers.openaidisabled,loadExportModelsnow returns zero nativerows where it previously returned all eleven, and
routeModel("gpt-6.1-sol")throwsNoEnabledOpenAiProviderErrorfor exactly the states the roster now omits.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.