Skip to content

fix(openrouter): unsupported models incorrectly receive tool definitions - #129659

Merged
steipete merged 1 commit into
mainfrom
codex/qa-openrouter-live-model-tool-capabilities-20260825
Sep 17, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-openrouter-live-model-tool-capabilities-20260825

Conversation

@steipete

@steipete steipete commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes invalid tool definitions being sent to discovered OpenRouter models whose advertised capabilities explicitly omit tool support.

User Impact

Models without tool support receive tool-free requests. Tool-capable models, the automatic router, and models without explicit capability metadata keep working as before; reasoning controls and pricing remain intact.

Why This Change Was Made

The live catalog now carries OpenRouter's existing supported_parameters contract into model compatibility, matching the dynamic-model resolver. The refreshed change merges that capability with the current reasoning metadata instead of replacing it.

Evidence

  • On a live public catalog snapshot of 444 models, the actual catalog owner and completions request builder sent tools to all 69 explicitly unsupported models before the fix and zero afterward. All 375 tool-capable models retained tools, including the automatic router; reasoning metadata was preserved for 311 models.
  • The catalog regression fails against the original owner for missing tool compatibility. The repaired catalog, all OpenRouter plugin tests, and shared tool-support/transport siblings pass: 267 tests across 17 files.
  • Full changed checks pass, including extension production/test types, formatting, lint, and ownership/architecture guards. Fresh independent complete-diff review found no actionable P0–P2 issues.
  • Clean Linux dependency and behavior proof ran through Blacksmith Testbox. The live proof reads the public catalog and constructs real request payloads; it does not claim authenticated inference.

OpenRouter documents the capability in its models API and tool-calling guide.

@clawsweeper

clawsweeper Bot commented Aug 25, 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.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 8:36 PM ET / September 17, 2026, 00:36 UTC (Revision 4).

ClawSweeper review

What this changes

The PR makes discovered OpenRouter models advertise their actual tool support, adds request-payload regression coverage, and documents behavior when capability metadata is absent.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary on current main and v2026.9.4. The refreshed patch resolves the earlier stale-catalog concern, preserves reasoning metadata, and introduces no actionable correctness finding. Maintainer-authored work also remains protected from automatic closure.

Priority: P2
Reviewed head: aeeb97299f95515d952d10210e38b4f9a869879a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful request-boundary coverage and no identified blocking defect; reported execution results remain distinct from this read-only source review.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its body reports live-catalog input exercised through the actual catalog and request builder, but the linked raw trace could not be independently inspected; authenticated inference is not claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its body reports live-catalog input exercised through the actual catalog and request builder, but the linked raw trace could not be independently inspected; authenticated inference is not claimed.
Evidence reviewed 9 items Current main still lacks the mapping: The live catalog reads supported_parameters for reasoning but does not project its tools capability into compat. The dynamic resolver’s existing capability handling does not repair this separate discovery path.
Introduced change preserves existing compatibility: The patch merges supportsTools into normalized reasoning compatibility only when supported_parameters is an array. Missing metadata retains the existing default. Tests exercise tool-capable, unsupported, empty-array, absent-metadata, automatic-router, and reasoning-preservation cases through the actual request builder.
Existing transport consumes the capability: The SDK request builder delegates to the repository-owned managed completions transport, which gates both tools and tool_choice on supportsModelTools. The dynamic OpenRouter parser already maps the same upstream metadata. This change does not depend on the Codex harness.
Findings None None.
Security None None.

How this fits together

OpenRouter’s catalog supplies model capabilities to OpenClaw’s provider plugin. Those capabilities control whether the shared request builder includes tool definitions and tool choice.

flowchart TD
  A[OpenRouter model catalog] --> B[Provider catalog adapter]
  B --> C{Tool metadata present?}
  C -->|Yes| D[Advertised tool capability]
  C -->|No| E[Existing default behavior]
  D --> F[Shared request builder]
  E --> F
  F --> G[Request with or without tools]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0, Tests +57, Docs +5. Total +62 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 7 7 0
Tests 1 57 0 +57
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 69 7 +62

Review metrics

None.

Technical review

Best possible solution:

Keep tool capability catalog-owned and consistently consumed by the existing transport, preserving absent-metadata defaults and reasoning controls.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: a discovered model with supported_parameters: [] receives no supportsTools flag on current main, so the managed request builder includes supplied tools. This review did not execute that path.

Is this the best way to solve the issue?

Yes. Populating the existing compatibility field at discovery is a narrow repair that matches the dynamic resolver and reuses the established transport guard without adding an API or configuration option.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 00837c258f61.

Labels

Label changes:

  • add P2: This fixes a bounded request-compatibility defect affecting discovered OpenRouter models that explicitly lack tool support.
  • remove P1: Current review triage priority is P2, so this older priority label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: This fixes a bounded request-compatibility defect affecting discovered OpenRouter models that explicitly lack tool support.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool 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 maintainer-authored PR is exempt from the external-contributor proof gate. Its body reports live-catalog input exercised through the actual catalog and request builder, but the linked raw trace could not be independently inspected; authenticated inference is not claimed.

Evidence

What I checked:

  • Current main still lacks the mapping: The live catalog reads supported_parameters for reasoning but does not project its tools capability into compat. The dynamic resolver’s existing capability handling does not repair this separate discovery path. (extensions/openrouter/provider-catalog.ts:175, 00837c258f61)
  • Introduced change preserves existing compatibility: The patch merges supportsTools into normalized reasoning compatibility only when supported_parameters is an array. Missing metadata retains the existing default. Tests exercise tool-capable, unsupported, empty-array, absent-metadata, automatic-router, and reasoning-preservation cases through the actual request builder. (extensions/openrouter/provider-catalog.ts:181, aeeb97299f95)
  • Existing transport consumes the capability: The SDK request builder delegates to the repository-owned managed completions transport, which gates both tools and tool_choice on supportsModelTools. The dynamic OpenRouter parser already maps the same upstream metadata. This change does not depend on the Codex harness. (packages/ai/src/transports/openai-completions-params.ts:410, aeeb97299f95)
  • Latest release also lacks the mapping: The v2026.9.4 catalog implementation likewise omits tool compatibility. GitHub contents inspection succeeded after local release-blob inspection could not retrieve the object. (extensions/openrouter/provider-catalog.ts:175, 3a9d69db306c)
  • Previous rebase concern resolved: Raw test-merge parents exactly match pinned main followed by the PR head, and its result changes only the intended catalog, test, and documentation files. The previous review contained no findings. Direct comparison with the earlier reviewed head failed because that object was unavailable; no unchanged-code or late-finding claim is made. (9691d73338e6)
  • Relevant merged history: Current-main history identifies steipete’s reasoning-preservation work and obviyus’s catalog-refresh work as relevant routing context. GitHub commit metadata confirms those handles. Deeper blame and content-search history encountered unavailable objects, so no original-feature attribution is asserted. (extensions/openrouter/provider-catalog.ts:6, f024e6786025)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-26T00:30:40.219Z sha 25a6449 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T01:12:50.641Z sha 25a6449 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-04T18:34:22.121Z sha 25a6449 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Aug 26, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 7, 2026
@steipete
steipete force-pushed the codex/qa-openrouter-live-model-tool-capabilities-20260825 branch from 25a6449 to aeeb972 Compare September 17, 2026 00:29
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. and removed P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Sep 17, 2026
@steipete
steipete merged commit 8d9152c into main Sep 17, 2026
103 of 104 checks passed
@steipete
steipete deleted the codex/qa-openrouter-live-model-tool-capabilities-20260825 branch September 17, 2026 00:57
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: openrouter maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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