Repository navigation
fix(gateway): report unknown model providers as invalid requests - #159237
Conversation
Reject unknown models.list provider filters with INVALID_REQUEST instead of letting a generic exception become UNAVAILABLE. Name the rejected provider and point callers to openclaw models list --all. Preserve valid provider filtering and genuine availability errors. Move existing provider-filter coverage to the registered handler and verify CLI message propagation and exit code 1. Update CLI and RPC documentation. Validation on Blacksmith Testbox tbx_01m3ftahjxpg1pz589w82vtz6f: baseline regression failed with the generic provider error (1 failed, 14 passed); repaired handler, model/session, and CLI suites passed (109 tests). Full check-changed and independent P0-P3 review passed. Local hooks disabled because all checks were required to run remotely.
|
🦞👀 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: blocked before merge. Reviewed September 26, 2026, 7:07 PM ET / 23:07 UTC. ClawSweeper reviewWhat this changesThe branch makes the Gateway report unknown model-provider filters as invalid requests with a recovery hint, updates CLI and protocol documentation, and adds Gateway-handler and CLI regression tests. Merge readiness⛔ Blocked before merge - 3 items remain Current main still classifies an unknown model provider as an availability failure. This PR repairs that client-facing error at the existing Gateway boundary, and I found no introduced correctness or security defect. The after-fix RPC response and required test-cost figures are not yet recorded. Priority: P2 Review scores
Verification
How this fits togetherGateway flowchart LR
A[Client provider filter] --> B[Gateway access check]
B --> C[Published model catalog]
C --> D{Provider recognized?}
D -->|Yes| E[Filtered model rows]
D -->|No| F[Invalid request with hint]
E --> G[Client display]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +7, Tests +50, Docs +3. Total +60 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the classification at the Gateway's existing provider-filter boundary while preserving genuine availability and authorization errors. Do we have a high-confidence way to reproduce the issue? Yes. On fetched current main, an unknown Is this the best way to solve the issue? Yes. A typed error from the existing filter and a narrow handler catch change this failure without reclassifying unrelated errors. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fb720291b0a3. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…penclaw#159237) Reject unknown models.list provider filters with INVALID_REQUEST instead of letting a generic exception become UNAVAILABLE. Name the rejected provider and point callers to openclaw models list --all. Preserve valid provider filtering and genuine availability errors. Move existing provider-filter coverage to the registered handler and verify CLI message propagation and exit code 1. Update CLI and RPC documentation. Validation on Blacksmith Testbox tbx_01m3ftahjxpg1pz589w82vtz6f: baseline regression failed with the generic provider error (1 failed, 14 passed); repaired handler, model/session, and CLI suites passed (109 tests). Full check-changed and independent P0-P3 review passed. Local hooks disabled because all checks were required to run remotely. Co-authored-by: Peter Steinberger <[email protected]>
Retain three original implementations required by strict validation and lint contracts. Align the process fixture with the provider diagnostic already shipped by #159237, without weakening envelope, output, or exit assertions.
Retain three original implementations required by strict validation and lint contracts. Align the process fixture with the provider diagnostic already shipped by #159237, without weakening envelope, output, or exit assertions.
Retain three original implementations required by strict validation and lint contracts. Align the process fixture with the provider diagnostic already shipped by #159237, without weakening envelope, output, or exit assertions.
Retain three original implementations required by strict validation and lint contracts. Align the process fixture with the provider diagnostic already shipped by #159237, without weakening envelope, output, or exit assertions.
Retain three original implementations required by strict validation and lint contracts. Align the process fixture with the provider diagnostic already shipped by #159237, without weakening envelope, output, or exit assertions.
Retain three original implementations required by strict validation and lint contracts. Align the process fixture with the provider diagnostic already shipped by #159237, without weakening envelope, output, or exit assertions.
Retain three original implementations required by strict validation and lint contracts. Align the process fixture with the provider diagnostic already shipped by #159237, without weakening envelope, output, or exit assertions.
* refactor(cli): deslop CLI fourth pass Consolidate command preparation, argument validation and report rendering under their existing CLI owners. Remove redundant forwarding, test-only injection, repeated normalization and duplicate finalization guards while preserving command, output and configuration contracts. * test(cli): preserve boundary checks and current provider diagnostics Retain three original implementations required by strict validation and lint contracts. Align the process fixture with the provider diagnostic already shipped by #159237, without weakening envelope, output, or exit assertions. * test(cli): verify progress completion before command parsing * fix(gateway): publish connection presence after hello delivery Keep pending connection rows in the canonical presence store, but expose them only to their own hello snapshot until delivery succeeds. Preserve disconnect cleanup and explicitly transfer publication ownership when an HTTP watch node replaces a pending WebSocket connection. Force an overlapping presence broadcast in the registered handshake regression and cover the HTTP handoff through its real route. Keep existing handshake assertions and move unchanged fixture helpers into their existing support module to satisfy the line-cap ratchet. * test: stabilize config audit and browser server fixtures
…law#159554) * refactor(cli): deslop CLI fourth pass Consolidate command preparation, argument validation and report rendering under their existing CLI owners. Remove redundant forwarding, test-only injection, repeated normalization and duplicate finalization guards while preserving command, output and configuration contracts. * test(cli): preserve boundary checks and current provider diagnostics Retain three original implementations required by strict validation and lint contracts. Align the process fixture with the provider diagnostic already shipped by openclaw#159237, without weakening envelope, output, or exit assertions. * test(cli): verify progress completion before command parsing * fix(gateway): publish connection presence after hello delivery Keep pending connection rows in the canonical presence store, but expose them only to their own hello snapshot until delivery succeeds. Preserve disconnect cleanup and explicitly transfer publication ownership when an HTTP watch node replaces a pending WebSocket connection. Force an overlapping presence broadcast in the registered handshake regression and cover the HTTP handoff through its real route. Keep existing handshake assertions and move unchanged fixture helpers into their existing support module to satisfy the line-cap ratchet. * test: stabilize config audit and browser server fixtures
What Problem This Solves
Asking the Gateway for models from a provider that does not exist,
models.listwith{"provider":"missing"}(oropenclaw models list --provider missing), failed withUNAVAILABLE: the error class for a Gateway or provider that cannot currently serve the request. The caller's typo looked like an outage, and the message did not name the provider or say how to find valid ids. Found by live QA against a real Gateway onmain(71ca294).Why This Change Was Made
createModelsListProviderFilter(src/gateway/server-methods/models-list-capabilities.ts) threw a plainErrorfor an unknown provider filter, which fell throughmodels.list's handler to the generic availability path. It now throws a module-scopedUnknownModelCatalogProviderError, andmodels.listmaps exactly that error toINVALID_REQUESTwith a message naming the rejected provider and pointing atopenclaw models list --all. Every other failure keeps its existing classification, and valid provider filters are unchanged. The CLI shows the message and exits 1.User Impact
An unknown provider filter now reports a request error that names the provider and how to list valid ones, instead of looking like the Gateway is unavailable.
Evidence
models.test.ts,models-list-result.plugin-runtime.test.ts,list.prepared-catalog.test.ts: new cases fail onmain(1 failed, 14 passed) and pass; CLI propagation and exit code 1 covered.node scripts/check-changed.mjspassed.Production LOC: +9 / −2. Tests: +71 / −21. Docs: +4 / −1.