Repository navigation
fix(models): keep v3 catalog rows when newer publishers add fields - #190187
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR makes v3 catalog readers tolerate unknown fields while keeping publisher validation strict and reusing the unreleased v3 cache slot. Example: A v3 mirror adds an unknown field to claude-fable-5.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR is useful and ready for normal landing consideration: no actionable defects were found, and the new upgrade evidence resolves the prior blocker. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherRemote catalog downloads enter the shared schema validator, which sanitizes model metadata before SQLite persistence and publication to model and pricing consumers. flowchart LR
A[Catalog mirror] --> B[Remote refresh]
B --> C[Shared catalog validator]
C --> D[SQLite cache worker]
D --> E[Catalog projection]
E --> F[Model and pricing consumers]
Technical reviewBest possible solution: Land the focused v3 reader repair with strict authoring validation and the released cache slots preserved. Do we have a high-confidence way to reproduce the issue? Current main passes v3 rows through strict schemas that reject unknown row keys; the author reports the matching real CLI failure and successful refresh after the repair. Is this the best way to solve the issue? The patch uses the existing validation and storage owners, removes only reported unknown keys, retains validation of known fields, and preserves strict publisher parsing without another wire version. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2a49211f59ef. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +50, Tests +25, Docs +6. Total +81 across 7 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 1, 2026, 4:41 AM ET / 09:41 UTC (Revision 2). |
|
Upgrade proof: stable
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed as 8ef2c73.
|
…penclaw#190187) Related: openclaw#189678 ## What Problem This Solves The opt-in v3 model catalog repeats the problem that forced v2 and v3: its reader rejects unknown fields. Any field a newer publisher adds would drop rows on every install that reads v3, so the next additive change would need a v4. ## User Impact Installs that read a v3 catalog keep every model when the hosted feed gains new fields. Unknown fields are ignored at any depth. Released clients are unaffected: they read only v1/v2, which are unchanged. ## Why This Change Was Made - **Reader:** the v3 reader now parses with the existing strict schemas and drops only the keys zod reports as unrecognized, then parses again. The publisher keeps the same strict schemas, so typos in rows, providers and pricing still fail before publication. The v1/v2 readers are unchanged. - **Cache slot:** v3 is cached in the existing `modelCatalog.remote.v3` slot again, and the `modelCatalog.remote.v4` slot added in openclaw#189678 is removed. - No release or beta reads `modelCatalog.remote.v3`: stable `2026.10.9`, extended-stable `2026.9.36` and beta `2026.10.10-beta.5` all read `modelCatalog.remote.v2`, which this client never writes. - So the extra slot protected no shipped downgrade. Production +70/−20: the reader helper is the growth; the fourth cache slot and its fallback branch are gone. Tests +33/−8. This follows the catalog schema decision: v3 is the last version for additive change. New capability kinds go inside `inference` with `chat: false`, and v1/v2 stay frozen. The doc is updated with these rules. Peer catalogs reached the same rule: - models.dev v2 tells clients to accept extra keys. - LiteLLM's cost map has had no version in three years. - OpenRouter and Codex readers drop unknown keys. ## Evidence - **Real refresh, before vs after.** Ran `pnpm openclaw models refresh` (built from this branch) against a loopback mirror, with isolated state. - Feed: the hosted v3 catalog plus one unknown field on one row. - Before: 1,243 models and `skipped invalid row models.4 (claude-fable-5)`. - After: 1,244 models, no warning. - Hosted v3, v3 with an unknown kind inside `inference`, and v3 with two fal image/music rows: 1,244 / 1,244 / 1,246 models, no warnings. - All v2 feeds behave exactly as before. - The stored row is `modelCatalog.remote.v3` with `schemaVersion: 3` and 1,244 models; no `.v4` row. - **Upgrade from stable `2026.10.9`** on one state dir: - The standard `doctor --fix` migration ran first. - This head adopted stable's cached catalog (`unchanged`, 1,230 models) and then read hosted v3 (1,244 models). - It cached v3 in `modelCatalog.remote.v3` and never rewrote the released `modelCatalog.remote.v2` row, which stays byte-identical. - `agents.defaults.model.primary` was preserved. - Details are in the PR comment. - **Released readers.** `pnpm catalog:compare-released` with `2026.10.9` and `2026.9.36`: both reject any v2 feed with an extra field, as expected. This is why v1/v2 stay frozen and new fields go to v3 only. - **Focused tests.** `model-catalog-normalize.test.ts` (41) and `remote-refresh.test.ts` (19) pass. The new test fails without the reader change (1 failed / 40 passed) and passes with it. - **Checks.** `oxfmt`, `oxlint` and `git diff --check` are clean on the changed files. `pnpm build` passes. - **Not run locally.** Full typecheck and broad suites are left to CI. Merge danger: a two-way door. A revert restores strict v3 parsing and the `.v4` slot. Only installs built from `main` since openclaw#189678 that already cached v3 in `.v4` refetch once. Blast radius is limited to opt-in v3 mirror users on unreleased builds. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #189678
What Problem This Solves
The opt-in v3 model catalog repeats the problem that forced v2 and v3: its reader rejects unknown fields. Any field a newer publisher adds would drop rows on every install that reads v3, so the next additive change would need a v4.
User Impact
Installs that read a v3 catalog keep every model when the hosted feed gains new fields. Unknown fields are ignored at any depth. Released clients are unaffected: they read only v1/v2, which are unchanged.
Why This Change Was Made
modelCatalog.remote.v3slot again, and themodelCatalog.remote.v4slot added in feat(models): preserve inference capabilities in opt-in catalog v3 #189678 is removed.modelCatalog.remote.v3: stable2026.10.9, extended-stable2026.9.36and beta2026.10.10-beta.5all readmodelCatalog.remote.v2, which this client never writes.Production +70/−20: the reader helper is the growth; the fourth cache slot and its fallback branch are gone. Tests +33/−8.
This follows the catalog schema decision: v3 is the last version for additive change. New capability kinds go inside
inferencewithchat: false, and v1/v2 stay frozen. The doc is updated with these rules.Peer catalogs reached the same rule:
Evidence
pnpm openclaw models refresh(built from this branch) against a loopback mirror, with isolated state.skipped invalid row models.4 (claude-fable-5).inference, and v3 with two fal image/music rows: 1,244 / 1,244 / 1,246 models, no warnings.modelCatalog.remote.v3withschemaVersion: 3and 1,244 models; no.v4row.2026.10.9on one state dir:doctor --fixmigration ran first.unchanged, 1,230 models) and then read hosted v3 (1,244 models).modelCatalog.remote.v3and never rewrote the releasedmodelCatalog.remote.v2row, which stays byte-identical.agents.defaults.model.primarywas preserved.pnpm catalog:compare-releasedwith2026.10.9and2026.9.36: both reject any v2 feed with an extra field, as expected. This is why v1/v2 stay frozen and new fields go to v3 only.model-catalog-normalize.test.ts(41) andremote-refresh.test.ts(19) pass. The new test fails without the reader change (1 failed / 40 passed) and passes with it.oxfmt,oxlintandgit diff --checkare clean on the changed files.pnpm buildpasses.Merge danger: a two-way door. A revert restores strict v3 parsing and the
.v4slot. Only installs built frommainsince #189678 that already cached v3 in.v4refetch once. Blast radius is limited to opt-in v3 mirror users on unreleased builds.