Skip to content

fix(clients): stop advertising native models the proxy cannot route - #9042

Draft
yogesh-aggarwal wants to merge 3 commits into
lidge-jun:devfrom
yogesh-aggarwal:fix/native-rows-unservable-provider
Draft

yogesh-aggarwal wants to merge 3 commits into
lidge-jun:devfrom
yogesh-aggarwal:fix/native-rows-unservable-provider

Conversation

@yogesh-aggarwal

@yogesh-aggarwal yogesh-aggarwal commented Nov 21, 2026 •

Copy link
Copy Markdown

Summary

Fixes a defect in which client-facing surfaces advertised native OpenAI models that the proxy
cannot route.

routeModel answers any bare gpt-* selector with NoEnabledOpenAiProviderError as soon as
providers.openai is disabled or absent — in Pool and Direct mode alike. Three paths did not
apply that rule:

  • loadExportModels (src/server/management/model-rows.ts) kept a native row unless the
    individual slug was disabled. GET /api/client-config, every management integration route and
    ocx export read this one roster, so a config with providers.openai.disabled exported all
    native slugs — 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
    offered the same unroutable rows.

This is the client-export half of the class #636 fixed for the Codex catalog (#643 added
shouldIncludeNativeOpenAi there). The catalog stopped advertising bare rows; the export and
launcher rosters did not.

The fix is one predicate, isNativeOpenAiProviderEnabled in
src/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.

  • It is deliberately weaker than shouldIncludeAccountBoundNativeOpenAi, whose exact-account
    routes additionally require canonical forward auth.
  • It deliberately omits 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.

loadExportModels and both launcher functions now consult it. The launcher's Direct-mode
omission 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 in
    both account modes; dropped with a disabled provider in both modes (routed rows untouched);
    dropped when providers.openai is absent.
  • tests/providers/opencode-cli.test.ts — opencodeLaunchNativeSlugs empty for a disabled
    provider in both modes, and opencodeCatalogFromProxyRows dropping the same row.
  • Three fixtures that described a config with no providers.openai while asserting native rows
    were corrected. That state is unrepresentable on disk — a fresh install materializes
    providers.openai enabled (pool) — so the fixtures now include it rather than testing a
    shape the code cannot produce. No assertion was relaxed.

Docs

  • structure/clients/export-model-names.md — records the native-row admission rule and which
    predicate 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):

bun run typecheck       # ✓ No type errors in 2,691 files
bun run structure:check # structure/ SSOT checks passed
bun run privacy:scan    # Privacy scan passed

Documentation gates, which the docs change also affects:

bun test tests/ci-workflows/docs-spanish-localization.test.ts   # 54 pass / 0 fail
bun test tests/ci-workflows/docs-link-targets.test.ts \
         tests/ci-workflows/docs-readme-translation-parity.test.ts \
         tests/ci-workflows/docs-navigation-label.test.ts       # 67 pass / 0 fail

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.ts

Full suite: bun run test (cap raised from the default 900 s for this machine) — the parallel
lane 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:

Failure Why it is environmental
end-to-end Home <-> compiled ocx-child lifecycle No ocx-child binary on PATH and no cargo to build one.
release-preflight "source resolution refuses invalid dispatch…" 5 s test timeout under full-suite load; passes in isolation.
test preload "fails the case after which the guarded checkout's config changed" This machine has global commit.gpgsign with 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…" Same global commit.gpgsign cause.

The last two pass with GIT_CONFIG_GLOBAL=/dev/null. codex-cli-update-apply.test.ts also
fails in this checkout only: its fixture root is <repo>/.tmp/codex-cli-management-e2e-*,
and this checkout lives under /Volumes/Work/Vault (mode 775), which
assertTrustedCodexCliAncestry rejects as group-writable — the same test passes in a clone at a
755 path. That is a property of my local checkout, not of the diff.

Behavioral evidence: with providers.openai disabled, loadExportModels now returns zero native
rows where it previously returned all eleven, and routeModel("gpt-6.1-sol") throws
NoEnabledOpenAiProviderError for exactly the states the roster now omits.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

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.

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.
@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Nov 21, 2026
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ 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.

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant