Skip to content

feat(providers): opt in to skipping invalid /models rows - #8503

Merged
lidge-jun merged 1 commit into
devfrom
codex/7910-skip-invalid-model-rows
Nov 10, 2026
Merged

lidge-jun merged 1 commit into
devfrom
codex/7910-skip-invalid-model-rows

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

A gateway whose GET /v1/models returns one row with an empty id ({"id":"", ...}) next to 28 valid ones made OpenCodex reject the whole listing as malformed. A newly registered provider's initial model selection then stayed pending, even with a static models fallback, until the operator switched to liveModels: false. This implements the owner decision on #7910 (options 1 and 2).

  • Diagnostic (default behavior unchanged): strict discovery still rejects a listing with any invalid row. The warning now names the first bad row and how many rows are invalid (row 0 has an empty id; 1 of 2 rows invalid), never row contents. The hint now names the new opt-in next to the liveModels: false recovery. /api/providers/test gives the same guidance.
  • Opt-in: providers.<name>.modelDiscovery.skipInvalidRows: true skips rows that are not objects or have a missing, non-string, empty or invalid id, and keeps the valid ones. A one-time warning per provider reports skipped/received counts.
    • The raw row ceiling still counts every row as received.
    • stripIdPrefix, filters, preferFirst and deduplication apply to the surviving rows.
  • Never an empty roster: if any row was skipped and nothing was admitted, the listing stays malformed. It never becomes an authoritative empty roster.
  • Initial selection: with the issue's reduced two-row example, a newly registered provider now goes from pending to ready (modelCount: 1) under the opt-in, and stays pending without it.
  • Config and management:
    • A malformed block in config.json loads as absent, so discovery stays strict.
    • Every management write path rejects a bad shape.
    • PATCH sets the field, and null or {} clears it.
    • A same-destination POST save keeps it; moving the provider drops it.
    • The field is separate from the top-level OcxConfig.modelDiscovery state.
  • Docs: a row in the providers reference in all eight locales; structure/providers-and-adapters.md and structure/gui-and-management-api.md are edited in place, since both are at their line budgets. The English reference would have reached 2,000 lines, so one hard-wrapped paragraph was joined onto one line; it renders identically.

Closes #7910

Verification

  • Fail-first on unmodified dev: the two new files, tests/providers/model-discovery-skip-invalid-rows.test.ts and tests/server/management-provider-model-discovery.test.ts, had 24 of 30 cases failing. They cover extraction, hint text, catalog discovery, initial selection, schema loading and management writes. The 6 that passed assert behavior that must not change. Two connection-test cases added later failed 0/2 with src/ stashed.
  • Merged with current dev 4bf2ec8de: bun run typecheck, bun run structure:check and bun run privacy:scan pass. The new and changed discovery tests, initial-selection, compat-carry and docs-policy suites, plus the layout, ratchet, Lab and quota boundary guards: 285 pass, 0 fail.
  • docs-site bun run build: 665 pages.
  • bun run test:changed (2,408 files, isolated HOME): 54,627 pass, 35 fail, 3 errors. Every failure is the container's environment-only set, which also fails on clean dev: local-control-socket (17 plus the 3 errors), the real-npm Codex CLI update suites, codex-composed-acceptance, update-stop-first, cli-codex-cli-update-boundary, and one catalog-omit-disabled-native case.
  • NOT RUN: a live request to the reporting gateway; full bun run test; lint:gui (no gui/ change); macOS/Windows.

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.

Maintainer judgment

  • Value: a gateway with one bad row no longer blocks a new provider. The operator opts in instead of maintaining a static roster.
  • UX change scope: one opt-in per-provider field. For everyone else only the warning text changes (now with row counts and the opt-in named), and accept/reject and returned items are unchanged.
  • Regression evidence for existing users: provider-model-discovery-contract.test.ts changes only its expected diagnostic strings; acceptance and rejection are unchanged. Without the opt-in, the initial-selection test still stays pending.
  • Windows impact: none.
  • Verification scope / NOT RUN: see above.

A gateway whose /models listing carries one malformed row (for example an
empty id) used to lose live discovery entirely, and a newly registered
provider stayed in pending initial model selection.

Add providers.<name>.modelDiscovery.skipInvalidRows. With it, rows that are
not objects or whose id is missing, non-string, empty or otherwise invalid
are skipped and counted in a one-time warning that never includes row
contents. The raw-row and byte limits still count every received row, and
stripIdPrefix, filters, preference and deduplication apply to the survivors.
A listing that skipped rows and admitted none stays malformed, so it never
becomes an authoritative empty roster. The admitted rows are authoritative,
so a pending initial selection becomes ready.

Unset keeps strict rejection; the malformed-listing diagnostic now reports
the first invalid row plus how many rows are invalid and names the opt-in
next to the liveModels: false recovery. The block is validated at config
load (malformed degrades to absent) and on every management write, PATCH
sets and clears it, and a POST overwrite carries it only while the
destination is unchanged. It is unrelated to the top-level modelDiscovery
discovery state.

Closes #7910
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 10, 2026 19:26
@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 10 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4bf2ec8 and 9178098.

Files selected for processing: 27

  • docs-site/src/content/docs/fr/reference/configuration/providers.md
  • docs-site/src/content/docs/ja/reference/configuration/providers.md
  • docs-site/src/content/docs/ko/reference/configuration/providers.md
  • docs-site/src/content/docs/reference/configuration/providers.md
  • docs-site/src/content/docs/ru/reference/configuration/providers.md
  • docs-site/src/content/docs/tr/reference/configuration/providers.md
  • docs-site/src/content/docs/zh-cn/reference/configuration/providers.md
  • docs-site/src/content/docs/zh-tw/reference/configuration/providers.md
  • scripts/test-layout/layout-providers.json
  • src/codex/catalog/gather-capture.ts
  • src/codex/catalog/provider-models.ts
  • src/codex/convergence-types.ts
  • src/config/schema/leaf-validators.ts
  • src/providers/model-discovery-config.ts
  • src/providers/model-discovery-diagnostic.ts
  • src/providers/model-discovery.ts
  • src/providers/model-rename-fields.ts
  • src/server/auth-cors.ts
  • src/server/management/provider-overwrite-carry.ts
  • src/server/management/provider-routes.ts
  • src/types/provider.ts
  • structure/gui-and-management-api.md
  • structure/providers-and-adapters.md
  • tests/fixtures/test-layout-expected.json
  • tests/providers/model-discovery-skip-invalid-rows.test.ts
  • tests/providers/provider-model-discovery-contract.test.ts
  • tests/server/management-provider-model-discovery.test.ts
  • 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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T19:28:48.214411Z 9178098 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the enhancement New feature or request label Nov 10, 2026
@lidge-jun
lidge-jun merged commit 4e83a8e into dev Nov 10, 2026
30 checks passed
@lidge-jun
lidge-jun deleted the codex/7910-skip-invalid-model-rows branch November 10, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Provider compatibility] Empty-ID model row rejects discovery and leaves new provider selection pending

1 participant