Skip to content

fix(openrouter): prevent Kimi tool-schema rejection without losing alternatives - #110138

Merged
fuller-stack-dev merged 14 commits into
openclaw:mainfrom
novalis78:fix/openrouter-tool-schema-compat
Sep 17, 2026
Merged

fuller-stack-dev merged 14 commits into
openclaw:mainfrom
novalis78:fix/openrouter-tool-schema-compat

Conversation

@novalis78

@novalis78 novalis78 commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes supported Kimi/Moonshot tool-schema rejection through OpenRouter without discarding valid tool argument alternatives.

User Impact

Kimi tools retain meaningful string/integer and nullable/literal alternatives. Canonical, qualified, and tilde-prefixed Moonshot model references work with the existing replay, thinking, and stream wrappers. No configuration migration is needed.

Why This Change Was Made

The provider-local normalizer distributes a parent type only where that preserves JSON Schema acceptance, retaining every branch and all other parent constraints. Unknown types, references, boolean branches, incompatible types, and nested unions remain unchanged. It traverses schema locations only, preserving annotation values and own __proto__ keys.

Other OpenRouter model families retain their existing schemas and tool identity. The earlier proposal to apply native DeepSeek/Gemini reductions through the proxy was removed after review: that tradeoff lacked route-specific evidence. Shared DeepSeek and native Moonshot production policies are unchanged.

The original OpenRouter contribution and reproduction are by @novalis78 (Lennart Lopin); contributor ancestry is preserved. The constraint-preserving native Moonshot work in #113462 by @harjothkhara informed this repair, but native-provider evidence is not OpenRouter acceptance.

Evidence

  • Current prepared head: 6ebfe0c9a5c727393da6d54dae91a7badbc8bee4. The Qwen integration conflict is resolved to exact main; only three OpenRouter files remain. No Slack or Qwen delta.
  • 34 schema tests and 50 wrapper tests passed on the unchanged OpenRouter source. Nine non-Moonshot regressions genuinely failed before scope narrowing and passed after it, preserving schema/tool identity.
  • All 28 current-main Qwen timeout tests passed after conflict resolution.
  • Fresh entire staged three-file independent autoreview: scoped-clean P0–P2, exit 0. Configured targeted lint passed; no suppression.
  • Exact-head CI: 34 successful jobs, no failures. Hosted lint supplies the local lane blocked by ancestor-install isolation.
  • Native review validation and preparation passed on this unchanged head.
  • Final prepared-head real OpenRouter run: both meaningful alternatives accepted, both echo tools executed and both result round trips completed; four HTTP 200 responses, native wrapper exit 0.

Current prepared-head runtime receipt

The registered OpenRouter plugin, current stream wrappers, and production OpenAI-completions transport called OpenRouter—not native Moonshot or a mocked endpoint. The wrapper verified the full source/tree; the probe checked eight pins, the transmitted schema, and both returned arguments against original and normalized schemas. Bounded synthetic receipts are inline so no external artifact-storage access is required. Subsequent lease-cleanup cancellation of the Actions session does not change the successful native command result.

{
  "head": "6ebfe0c9a5c727393da6d54dae91a7badbc8bee4",
  "tree": "c00e0f15497d540bbb28ee2b8ec726ab366a014a",
  "normalizedSchemaSha256": "fb78ac1a7fcef430902ef4028f11c2e2e293edf21ca6e611e1ffe108357c2b2d",
  "proofScriptSha256": "ee6f61a2e35c6c46366a989ad0f2ed8585b96583565b3dc286b217ce4af364e8",
  "provider": "openrouter",
  "model": "moonshotai/kimi-k3",
  "endpoint": "https://openrouter.ai/api/v1",
  "outcomes": [
    {
      "expected": {
        "value": "hello",
        "color": "red"
      },
      "actual": {
        "value": "hello",
        "color": "red"
      },
      "httpStatus": 200,
      "roundTripHttpStatus": 200,
      "wireToolsSha256": "5a5c20564747de67617dffc0e0b436c5a6cd692599bffea4b7df2937f34f2b50",
      "toolExecuted": true,
      "roundTrip": "stop"
    },
    {
      "expected": {
        "value": 7,
        "color": "blue"
      },
      "actual": {
        "value": 7,
        "color": "blue"
      },
      "httpStatus": 200,
      "roundTripHttpStatus": 200,
      "wireToolsSha256": "5a5c20564747de67617dffc0e0b436c5a6cd692599bffea4b7df2937f34f2b50",
      "toolExecuted": true,
      "roundTrip": "stop"
    }
  ],
  "http200Count": 4,
  "nativeWrapperExit": 0,
  "nativeSourceAndTreeVerified": true,
  "finishedAt": "2026-09-17T03:58:01.906066+00:00"
}

The schema retains both constrained string/integer branches and the red/blue alternatives. Native Moonshot #113462 was an implementation lead only. The Slack prerequisites landed in #111148, and #150482 was closed as verified superseded. The contributor’s original unpatched Gateway rejection and ten-call older build reproduction establish the failure path; this current prepared-head receipt independently establishes proxy acceptance after the repair.

…d providers

Models routed through OpenRouter inherit no tool schema normalization,
so providers that reject anyOf/oneOf (Moonshot/Kimi, DeepSeek, Google)
receive raw schemas and return 400. Route model prefixes to the
matching tool compat family, mirroring ClawRouter's resolveToolFamily.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 16, 2026, 11:46 PM ET / September 17, 2026, 03:46 UTC (Revision 23).

ClawSweeper review

What this changes

The OpenRouter plugin adapts Kimi tool schemas while preserving valid argument alternatives and adds regression coverage for schema constraints and model aliases.

Merge readiness

⛔ Blocked before merge - 2 items remain

This remains a useful, actively maintained fix that current main does not provide. Earlier alias and union-preservation concerns are resolved, and no blocking code defect was found.

Priority: P1
Reviewed head: 6ebfe0c9a5c727393da6d54dae91a7badbc8bee4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, constraint-preserving patch with meaningful regression coverage and real provider evidence.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The inline pre-integration receipt exercises the registered OpenRouter plugin and real completions transport, demonstrating both argument alternatives, tool execution, and successful result round trips. Inspected behavior inputs remain unchanged; this valid proof does not satisfy the separately promised confirmation of the latest integrated head.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The inline pre-integration receipt exercises the registered OpenRouter plugin and real completions transport, demonstrating both argument alternatives, tool execution, and successful result round trips. Inspected behavior inputs remain unchanged; this valid proof does not satisfy the separately promised confirmation of the latest integrated head.
Evidence reviewed 8 items Introduced scope and current-main necessity: The pinned introduced delta contains only the OpenRouter registration, normalizer, and tests. Comparing the registration against fetched main still shows the two new schema hooks; main has no OpenRouter tool-schemas.ts.
Conservative transformation and resolved findings: The normalizer uses existing model-family normalization, retains every union branch and sibling constraint, and limits type distribution to compatible anyOf branches. Non-Moonshot routes use the existing OpenAI helper, which returns OpenRouter tools unchanged. Tests exercise registered hooks, acceptance equivalence, annotations, special property names, and non-target aliases.
Existing production extension point: The runner normalizes both base and bundled tools through the existing provider schema hook. The OpenAI-completions request converter forwards tool parameters on its direct path. This is an OpenClaw-owned provider/transport change and supplies no dependency signal requiring Codex-source inspection.
Findings None None.
Security None None.

How this fits together

OpenClaw passes tool definitions through the selected provider plugin before sending them to a model. This change adjusts schemas for Moonshot models reached through OpenRouter, allowing tool calls to proceed without discarding valid arguments.

flowchart LR
  A[Agent and MCP tools] --> B[Provider schema hook]
  C[Selected OpenRouter model] --> B
  B --> D{Moonshot family?}
  D -->|Yes| E[Preserve constraints and distribute type]
  D -->|No| F[Keep existing schemas]
  E --> G[OpenRouter transport]
  F --> G
  G --> H[Tool calls and result replies]
Loading

Before merge

  • Resolve merge risk (P1) - The explicitly promised OpenRouter confirmation for the latest integrated head remains pending in the captured and live PR body.
  • Complete next step (P2) - Record the maintainer-required OpenRouter acceptance confirmation for the latest integrated head in the PR body.
Agent review details

Security

None.

PR surface

Source +141, Tests +232. Total +373 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 141 0 +141
Tests 1 232 0 +232
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 373 0 +373

Review metrics

Metric Value Why it matters
Production and regression coverage production +141 lines; tests +232 lines Production growth implements the stated constraint-preservation requirement that existing lossy family helpers cannot satisfy.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the constraint-preserving adaptation in the existing OpenRouter hook, preserve other provider routes, and complete the already-required integrated-head confirmation.
  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 constraint-preserving adaptation in the existing OpenRouter hook, preserve other provider routes, and complete the already-required integrated-head confirmation.

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

Yes: the reported parent-type/untyped-anyOf shape follows a clear provider path without the required transformation on main, supported by historical rejection evidence. This read-only review did not execute a fresh failing request.

Is this the best way to solve the issue?

Yes: the existing provider hook is the appropriate boundary, and the conservative rewrite preserves acceptance rather than applying another provider's lossy reduction.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: Rejected tool schemas can prevent affected Kimi agent turns from completing through OpenRouter.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The inline pre-integration receipt exercises the registered OpenRouter plugin and real completions transport, demonstrating both argument alternatives, tool execution, and successful result round trips. Inspected behavior inputs remain unchanged; this valid proof does not satisfy the separately promised confirmation of the latest integrated head.
  • proof: sufficient: Contributor real behavior proof is sufficient. The inline pre-integration receipt exercises the registered OpenRouter plugin and real completions transport, demonstrating both argument alternatives, tool execution, and successful result round trips. Inspected behavior inputs remain unchanged; this valid proof does not satisfy the separately promised confirmation of the latest integrated head.

Evidence

What I checked:

  • Introduced scope and current-main necessity: The pinned introduced delta contains only the OpenRouter registration, normalizer, and tests. Comparing the registration against fetched main still shows the two new schema hooks; main has no OpenRouter tool-schemas.ts. (extensions/openrouter/index.ts:351, 6ebfe0c9a5c7)
  • Conservative transformation and resolved findings: The normalizer uses existing model-family normalization, retains every union branch and sibling constraint, and limits type distribution to compatible anyOf branches. Non-Moonshot routes use the existing OpenAI helper, which returns OpenRouter tools unchanged. Tests exercise registered hooks, acceptance equivalence, annotations, special property names, and non-target aliases. (extensions/openrouter/tool-schemas.ts:43, 6ebfe0c9a5c7)
  • Existing production extension point: The runner normalizes both base and bundled tools through the existing provider schema hook. The OpenAI-completions request converter forwards tool parameters on its direct path. This is an OpenClaw-owned provider/transport change and supplies no dependency signal requiring Codex-source inspection. (src/agents/embedded-agent-runner/run/attempt-bundle-tools.ts:49, 6ebfe0c9a5c7)
  • Real OpenRouter acceptance: The captured PR body and fix(openrouter): prevent Kimi tool-schema rejection without losing alternatives #110138 (comment) record production plugin and transport execution at b6c8c96: both string/red and integer/blue arguments executed successfully and completed tool-result round trips, with four HTTP 200 responses and wrapper exit 0. The receipt is inline and was inspected; no embedded script was executed. (b6c8c964665e)
  • Proof continuity and explicit remaining confirmation: The inspected OpenRouter registration, model normalization, stream wrapper, schema normalizer, shared provider helper, and completions provider are unchanged since the accepted runtime receipt. However, both the captured body and the live REST response explicitly describe the integrated-head OpenRouter confirmation as pending; the historical receipt is preserved without claiming a new execution. (extensions/openrouter/tool-schemas.ts:1, 6ebfe0c9a5c7)
  • Latest-release check: The OpenRouter entrypoint at the supplied latest-release commit, v2026.9.4, also lacks these schema hooks. Its blob was inspected through GitHub REST after the local historical-blob read failed. (extensions/openrouter/index.ts, 3a9d69db306c)

Likely related people:

  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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 already-promised integrated-head OpenRouter confirmation, retaining redacted evidence of both alternatives and tool-result completion.

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 (22 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-18T12:36:00.163Z sha eaec100 :: found issues before merge. :: [P1] Normalize aliases before selecting the schema family | [P1] Do not route Moonshot schemas through DeepSeek's lossy reducer
  • reviewed 2026-08-25T06:48:12.978Z sha eaec100 :: needs historical verification review before merge. :: [P1] Use the model-family normalizer before dispatch | [P1] Preserve Moonshot union constraints
  • reviewed 2026-09-02T03:14:14.616Z sha eaec100 :: blocked before merge. :: [P1] Preserve Moonshot union constraints
  • reviewed 2026-09-17T01:31:06.096Z sha a1c6882 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-17T01:45:14.495Z sha 728bf04 :: blocked before merge. :: none
  • reviewed 2026-09-17T02:21:00.140Z sha 1ccc459 :: blocked before merge. :: none
  • reviewed 2026-09-17T02:39:07.528Z sha 9204736 :: blocked before merge. :: none
  • reviewed 2026-09-17T03:12:13.589Z sha b6c8c96 :: blocked before merge. :: none

…ection

Canonical OpenRouter model IDs arrive as `openrouter/moonshotai/kimi-k3`
with the provider prefix, which bypasses the prefix-based tool family
routing. Use normalizeOpenRouterApiModelId to strip the prefix before
family selection, matching how the rest of the extension handles model IDs.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 17, 2026
Lennart Lopin and others added 2 commits July 17, 2026 23:19
- Add braces to if statements to satisfy eslint(curly) rule
- Cast TSchema to Record in test assertions to fix TS2339

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 18, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Jul 18, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 4, 2026
@openclaw-barnacle openclaw-barnacle Bot added the channel: slack Channel integration: slack label Sep 17, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member

@clawsweeper re-review

Current head: 728bf04f710154cbdbd8b9967d3b1e3a6eb43dd6. The Moonshot-to-DeepSeek reduction is replaced with conservative provider-local handling that preserves all meaningful alternatives and parent constraints; supported canonical/tilde/short-model aliases use existing normalization. Current wrappers and contributor ancestry are preserved.

50 existing wrapper tests and 34 schema cases passed; the final integration adds four passing Slack approval/quiet-stream cases for an inherited CI prerequisite. Fresh complete-candidate isolated P0–P2 review is scoped-clean. The PR body now includes real proxied OpenRouter acceptance of both string/red and integer/blue values and tool-result round trips (four HTTP200 requests). All OpenRouter input hashes are unchanged at this head; its fresh exact-head confirmation and CI are running, and the body will record their results.

@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 17, 2026
@openclaw-barnacle openclaw-barnacle Bot added extensions: qwen and removed channel: slack Channel integration: slack labels Sep 17, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member

@clawsweeper re-review

Current head: b6c8c964665e5e55d0288634bcd07c09f42b5690. The proxy-policy P1 is resolved by removing both newly introduced DeepSeek/Gemini routing branches. Those OpenRouter routes now preserve the original schema/tool identity and produce no new native-family diagnostics; no unproven reduction remains. Nine existing alias cases reproduced the loss before this correction; all34 schema tests now pass. The coherent staged four-file candidate passed fresh independent P0–P2 review.

The maintainer resolution is to preserve existing non-Moonshot behavior, not to introduce a new proxy tradeoff. Current-head CI and native preparation are running/pending. The prepared920 head completed actual OpenRouter two-alternative acceptance with fourHTTP200 responses and wrapper exit0, and its lease is stopped; that result remains historical. New final prepared-head acceptance will be recorded before native merge, with no waiver of that gate.

@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Sep 17, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member

@clawsweeper re-review

Final prepared-head acceptance is now recorded directly in the PR body for unchanged b6c8c964665e5e55d0288634bcd07c09f42b5690 / tree cab62f68c40c28197f5166cdafc97d921fec5a34. The real OpenRouter moonshotai/kimi-k3 production path accepted both string/red and integer/blue alternatives, executed both echo calls, and completed both tool-result round trips: fourHTTP200 responses and native wrapper exit0. Source/tree plus eight input pins were verified. Exact-head CI passed34jobs/18skipped before native preparation.

The bounded redacted native receipt is inline in the PR body, so it can be inspected without accessing the restricted artifact-storage host. This is the new final-head execution, not reused920/nativeMoonshot evidence. Its lease is stopped and temporary clone absent. Source is unchanged; please refresh the remaining proof-only findings against the now-present evidence.

@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Sep 17, 2026
@fuller-stack-dev
fuller-stack-dev merged commit 120ad02 into openclaw:main Sep 17, 2026
108 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 17, 2026
…ternatives (openclaw#110138)

* fix(openrouter): add model-aware tool schema normalization for proxied providers

Models routed through OpenRouter inherit no tool schema normalization,
so providers that reject anyOf/oneOf (Moonshot/Kimi, DeepSeek, Google)
receive raw schemas and return 400. Route model prefixes to the
matching tool compat family, mirroring ClawRouter's resolveToolFamily.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* fix(openrouter): normalize canonical model IDs before tool family selection

Canonical OpenRouter model IDs arrive as `openrouter/moonshotai/kimi-k3`
with the provider prefix, which bypasses the prefix-based tool family
routing. Use normalizeOpenRouterApiModelId to strip the prefix before
family selection, matching how the rest of the extension handles model IDs.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* fix(openrouter): add curly braces and fix test type errors

- Add braces to if statements to satisfy eslint(curly) rule
- Cast TSchema to Record in test assertions to fix TS2339

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* fix(openrouter): preserve schema routing for model aliases

* fix(slack): forward approval callbacks without growing dispatch

* test(qwen): freeze the clock for request-shape assertions

* refactor(openrouter): preserve schema branches with explicit iteration

* fix(openrouter): keep proxy schema normalization Moonshot-local

---------

Co-authored-by: Lennart Lopin <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Jason (Json) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: openrouter P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M stale Marked as stale due to inactivity 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.

2 participants