Repository navigation
feat(providers): opt in to skipping invalid /models rows - #8503
Merged
Merged
Conversation
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
Contributor
|
Warning Review limit reachedYou'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. View limit details
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. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
|
✅ Deterministic PR hygiene checks passed. |
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
A gateway whose
GET /v1/modelsreturns one row with an emptyid({"id":"", ...}) next to 28 valid ones made OpenCodex reject the whole listing as malformed. A newly registered provider's initial model selection then stayedpending, even with a staticmodelsfallback, until the operator switched toliveModels: false. This implements the owner decision on #7910 (options 1 and 2).row 0 has an empty id; 1 of 2 rows invalid), never row contents. The hint now names the new opt-in next to theliveModels: falserecovery./api/providers/testgives the same guidance.providers.<name>.modelDiscovery.skipInvalidRows: trueskips 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 reportsskipped/receivedcounts.stripIdPrefix, filters,preferFirstand deduplication apply to the surviving rows.pendingtoready(modelCount: 1) under the opt-in, and stayspendingwithout it.config.jsonloads as absent, so discovery stays strict.PATCHsets the field, andnullor{}clears it.POSTsave keeps it; moving the provider drops it.OcxConfig.modelDiscoverystate.structure/providers-and-adapters.mdandstructure/gui-and-management-api.mdare 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
dev: the two new files,tests/providers/model-discovery-skip-invalid-rows.test.tsandtests/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 withsrc/stashed.dev4bf2ec8de:bun run typecheck,bun run structure:checkandbun run privacy:scanpass. 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.bun run build: 665 pages.bun run test:changed(2,408 files, isolatedHOME): 54,627 pass, 35 fail, 3 errors. Every failure is the container's environment-only set, which also fails on cleandev: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 onecatalog-omit-disabled-nativecase.bun run test;lint:gui(nogui/change); macOS/Windows.Checklist
Maintainer judgment
provider-model-discovery-contract.test.tschanges only its expected diagnostic strings; acceptance and rejection are unchanged. Without the opt-in, the initial-selection test still stayspending.