Skip to content

fix(gateway): report unknown model providers as invalid requests - #159237

Merged
steipete merged 1 commit into
mainfrom
fix/live2-models-list-unknown-provider
Sep 26, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/live2-models-list-unknown-provider

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Asking the Gateway for models from a provider that does not exist, models.list with {"provider":"missing"} (or openclaw models list --provider missing), failed with UNAVAILABLE: 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 on main (71ca294).

Why This Change Was Made

createModelsListProviderFilter (src/gateway/server-methods/models-list-capabilities.ts) threw a plain Error for an unknown provider filter, which fell through models.list's handler to the generic availability path. It now throws a module-scoped UnknownModelCatalogProviderError, and models.list maps exactly that error to INVALID_REQUEST with a message naming the rejected provider and pointing at openclaw 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 on main (1 failed, 14 passed) and pass; CLI propagation and exit code 1 covered.
  • On a Blacksmith Testbox via Crabbox: 109 tests across the models server-method and CLI list suites passed; node scripts/check-changed.mjs passed.
  • Codex autoreview: scoped-clean ("patch is correct", 0.94).

Production LOC: +9 / −2. Tests: +71 / −21. Docs: +4 / −1.

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

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 26, 2026 22:59
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations size: S labels Sep 26, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 26, 2026, 7:07 PM ET / 23:07 UTC.

ClawSweeper review

What this changes

The 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
Reviewed head: 1242c5b39461502993d5c4b3503127f9adcb18a2

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch and handler regression are sound, while the client-facing RPC result and test costs remain unrecorded.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: The supplied repository-state association identifies a member-authored PR, so the external-contributor proof gate does not apply. The changed Gateway response is covered through the registered handler and a mocked CLI error; the captured body has no after-fix real-Gateway RPC result. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository-state association identifies a member-authored PR, so the external-contributor proof gate does not apply. The changed Gateway response is covered through the registered handler and a mocked CLI error; the captured body has no after-fix real-Gateway RPC result. No stored-data contract changes.
Evidence reviewed 9 items PR introduction: The pinned merge-base-to-head patch changes only the unknown-provider error type and message in the filter and adds a matching handler response; the verified test merge retains those changes.
Current-main behavior: Current main throws a plain Error for an unrecognized provider, so it lacks the typed classification proposed here.
Current-main response boundary: The current-main handler has no unknown-provider catch and rethrows errors outside its existing authorization and availability cases.
Findings None None.
Security None None.

How this fits together

Gateway models.list reads a published model catalog and applies a client-supplied provider filter before returning model rows. The openclaw models list command uses that Gateway response when a Gateway is selected.

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
Loading

Before merge

  • Resolve merge risk (P1) - The captured evidence shows the failure on a real Gateway before the fix, but no after-fix RPC exchange confirms the client-visible error code across the Gateway transport.
  • Resolve merge risk (P1) - The PR does not state one-worker wall time and CI seconds for its two changed test files, as required by the repository test-cost policy.
  • Complete next step (P2) - Record an after-fix real-Gateway models.list response and the one-worker wall time plus CI seconds for both changed test files before merge.
Agent review details

Security

None.

PR surface

Source +7, Tests +50, Docs +3. Total +60 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 2 9 2 +7
Tests 2 71 21 +50
Docs 2 4 1 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 84 24 +60

Review metrics

Metric Value Why it matters
RPC error classification 1 case: UNAVAILABLE → INVALID_REQUEST Client callers can distinguish an unknown provider ID from an availability failure.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the classification at the Gateway's existing provider-filter boundary while preserving genuine availability and authorization errors.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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 models.list provider reaches a plain Error that the registered handler does not classify; the PR body also reports a real-Gateway baseline failure. This read-only review did not rerun it.

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.

Labels

Label changes:

  • add P2: The fix improves a user-facing Gateway and CLI error for an invalid filter with limited blast radius.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository-state association identifies a member-authored PR, so the external-contributor proof gate does not apply. The changed Gateway response is covered through the registered handler and a mocked CLI error; the captured body has no after-fix real-Gateway RPC result. No stored-data contract changes.

Label justifications:

  • P2: The fix improves a user-facing Gateway and CLI error for an invalid filter with limited blast radius.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository-state association identifies a member-authored PR, so the external-contributor proof gate does not apply. The changed Gateway response is covered through the registered handler and a mocked CLI error; the captured body has no after-fix real-Gateway RPC result. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Josh Lehman: Raw commit cde6bbd adds src/gateway/server-methods/models-list-capabilities.ts:81 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cde6bbdcfe84; files: src/gateway/server-methods/models-list-capabilities.ts)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record the after-fix unknown-provider response from a running Gateway.
  • Add one-worker wall time and CI seconds for both changed test files to the PR body.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 74469f5 into main Sep 26, 2026
270 of 275 checks passed
@steipete
steipete deleted the fix/live2-models-list-unknown-provider branch September 26, 2026 23:39
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
…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]>
steipete added a commit that referenced this pull request Sep 27, 2026
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.
steipete added a commit that referenced this pull request Sep 27, 2026
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.
steipete added a commit that referenced this pull request Sep 27, 2026
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.
steipete added a commit that referenced this pull request Sep 27, 2026
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.
steipete added a commit that referenced this pull request Sep 28, 2026
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.
steipete added a commit that referenced this pull request Sep 28, 2026
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.
steipete added a commit that referenced this pull request Sep 28, 2026
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.
steipete added a commit that referenced this pull request Sep 28, 2026
* 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
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant