Skip to content

fix(openrouter): preserve model capabilities on routing variants - #192836

Open
ooiuuii wants to merge 5 commits into
openclaw:mainfrom
ooiuuii:codex/openrouter-routing-variant-capabilities-20261104
Open

ooiuuii wants to merge 5 commits into
openclaw:mainfrom
ooiuuii:codex/openrouter-routing-variant-capabilities-20261104

Conversation

@ooiuuii

@ooiuuii ooiuuii commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #192835

What Problem This Solves

OpenRouter routing modifiers such as :nitro and :floor can silently lose image/reasoning support and use generic token limits when the catalog contains only the base model ID.

The OpenRouter plugin now selects an exact-first capability fallback for recognized routing suffixes while preserving the requested wire model ID. Exact catalog rows, catalog/unknown suffixes, custom endpoints, configured limits and explicit reasoning overrides retain their existing precedence. No configuration migration or pricing-policy change is introduced.

Current Integration

This update integrates upstream commit b12552911c9de982455c72be6a4fda9eb199a759, retaining current provider registration and output-limit defaults. The test conflict is resolved without restoring retired upstream assertions; native openrouter/auto normalization remains covered in the existing table.

Published integration commit: cdf87399a8bc0c52b6037e6971d5c2a32964b507.
Exact tested/reviewed tree: 91fd58592a3756715a32936796fae6782dfc7c39.
Scoped patch SHA256: bb44a22d58de8f6c888d9ecc42d584357e9ba10d8114b2083bb53cf2e64686bc.

Evidence

  • Final candidate: 66 tests passed in four files, core typecheck and whitespace checks passed, and exact-base/candidate test-lines checks passed locally.
  • Final-tree native CLI build completed on November 27, exit 0 (63.969 seconds). This is compilation and CLI help proof, not Gateway/plugin-discovery or model behavior proof.
  • Fresh independent machine code review completed against the exact tree and base: scoped-clean, exit 0, no P0-P3 findings. Scope included all nine changed files and 16 caller/context files. Reviewer tools were disabled, so this review did not independently run tests or establish runtime proof. Parent-side source checks bind the report to this unchanged candidate.
  • A preceding integration passed 140 tests in 14 files. Those results are retained separately and are not represented as a final-tree rerun.

Remaining Proof And CI Limits

The requested shipped-plugin-discovery/Gateway and live OpenRouter proof is still incomplete. The regression uses production resolver/cache and provider callbacks with synthetic catalog data and injected hooks. The transport case sends the unchanged routing-qualified ID to a real local HTTP/SSE endpoint; it does not call an external OpenRouter model.

The normal disposable Gateway-turn invocation was explicitly refused because an agent-exec turn would lose inter-session attribution. No Gateway started. The available attributed session-message tool cannot bind a disposable instance/profile and candidate build. A supported attributed test route is still needed; no alternate CLI/RPC route, guard change or borrowed credential was used. No paid/live OpenRouter call has been made.

The previous required hosted ratchet failure remains a failed historical run. A controlled comparison using its exact historical rule gives excess 1 both before and after the public patch: +271 counted lines and +271 allocation, with no added excess. The original CI merge commit is unavailable, so this is not claimed as a bit-identical replay. Current candidate net test growth is +301 with upstream allowance 400 and the unchanged allocation 271; both local final-base/candidate checks pass. No allocation increase, guard relaxation, CI waiver or maintainer approval is claimed. Fresh hosted checks must evaluate the published commit.

Final-candidate command and raw result excerpts
node scripts/run-vitest.mjs extensions/openrouter/provider-runtime.contract.test.ts extensions/openrouter/prefer-runtime-model.test.ts src/agents/embedded-agent-runner/model.compat-route.test.ts src/agents/model-runtime-choice.native.test.ts --maxWorkers=1
exitCode: 0
Test Files  1 passed (1)
Tests  11 passed (11)
Test Files  1 passed (1)
Tests  29 passed (29)
Test Files  2 passed (2)
Tests  26 passed (26)
[test] passed 3 Vitest shards in 86.39s

The three shards total 66 tests across four files. Raw test log SHA256: 6e0ff569a2bd05d7674cf32ed1409a97d0b939cef63be2eb1324b3baaad06697.

Test lines OK. Net test lines: 0; allowance: 400; allocation credit: 0.
Test lines OK. Net test lines: +301; allowance: 400; allocation credit: 271.
pnpm openclaw --profile pr192836-20261127-final --help
exitCode: 0
wallSeconds: 63.969
gatewayStarted: false
modelTurnRequested: false

Source/index/patch identity was unchanged before and after the build. The build log excerpt is not an end-to-end claim.

Regression boundary: upstream failure and candidate pass

On upstream production code at 7f3bd14b7f7ec681b58076addfc14024223b08d4, with the current test fixture overlaid, the compound-route capability assertion fails. This is a registered-callback/resolver comparison with synthetic data. The same assertion passes in the candidate contract tests; it does not establish shipped discovery or live-provider behavior.


 FAIL   extension-providers  extensions/openrouter/provider-runtime.contract.test.ts > OpenRouter routing variants through runtime resolution > inherits capabilities for nitro:exacto without changing the requested ID or refetching
AssertionError: expected { …(17) } to match object { …(6) }
(18 matching properties omitted from actual)

- Expected
+ Received

  {
    "compat": {
-     "supportedReasoningEfforts": [
-       "none",
-       "high",
-       "low",
-     ],
-     "supportsTools": true,
+     "supportsDeveloperRole": false,
+     "supportsStrictMode": true,
+     "supportsUsageInStreaming": false,
    },
-   "contextWindow": 456789,
+   "contextWindow": 200000,
    "id": "acme/routing-capability-model:nitro:exacto",
    "input": [
      "text",
-     "image",
    ],
-   "maxTokens": <redacted len=5>,
Final-candidate independent review result
{
  "status": {
    "schema_version": 1,
    "status": "scoped-clean",
    "exit_code": 0,
    "engine": "openclaw",
    "report_produced": true,
    "reason": null,
    "reviewer_exit_code": null,
    "timed_out": false,
    "effective_models": [
      "openai/gpt-6-astra"
    ]
  },
  "findings": [],
  "overall_explanation": "No actionable P0–P3 defects found in the nine-file diff and supplied caller context. Capability fallback preserves exact-row precedence, non-routing suffixes, and requested wire IDs. The fixture forwards provider preference and reinstalls fetch per case. Tools are disabled by policy, so repository identity and reported validation were not independently verified. Synthetic/injected coverage does not establish shipped plugin-discovery, Gateway, or live-provider behavior. Earlier builds and inherited CI observations do not establish final-tree build or hosted-CI readiness. This review is not maintainer approval."
}

The effective model was GPT 6 Astra. The helper's supported max effort was requested; effective effort was not separately reported. This report is a code-review result, not proof sufficiency, hosted CI clearance or maintainer approval.

Roboclaw prepared the implementation, tests and machine review; Codex verified the artifact hashes/bindings and transported the exact candidate without local code changes or duplicate tests. Contributor: @ooiuuii.

Work Sessions

Implementation and verification session (team access required; not public proof).

@clawsweeper

clawsweeper Bot commented Nov 4, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling extensions: openrouter size: M labels Nov 4, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 4, 2026
@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

OpenRouter routing variants inherit catalog capabilities without changing the requested API model ID.

Example: Resolve acme/routing-capability-model:nitro:exacto when only its base catalog row exists.

  • Before: Resolution uses text-only input, no reasoning, a 200000-token context and a 32768-token output limit.
  • After: Resolution inherits image input, reasoning, a 456789-token context and a 23456-token output limit while preserving the routing-qualified ID.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused repair appears correct, but required shipped-behavior proof is absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Selecting an OpenRouter routing variant can silently disable images or reasoning and substitute generic token limits.
Reason: The change restores documented routing behavior using existing owners and preserves explicit operator choices.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: this PR addresses a current capability-resolution bug, and no introduced correctness defect was found.

Reviewed head: cdf87399a8bc0c52b6037e6971d5c2a32964b507

Before merge

  • Add real behavior proof - Reported resolver/cache tests and loopback HTTP exercise production components with synthetic catalog data and injected hooks; CLI help proves neither shipped discovery nor a model turn, and the author explicitly leaves both unverified; redact IPs, keys, phone numbers and non-public endpoints from supplied captures. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Await maintainer action - Approve the pending external-PR GitHub Actions workflows for cdf8739 so required CI can execute.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted candidate Gateway logs or terminal output showing shipped plugin discovery and a real OpenRouter routing-variant turn retaining image/reasoning capabilities and the requested wire ID.
Agent review details

How this fits together

The OpenRouter provider resolves requested model IDs against the shared capability cache and supplies executable model metadata to the agent runtime and transport.

flowchart LR
  A[Requested model ID] --> B[OpenRouter provider]
  B --> C[Routing metadata fallback]
  C --> D[Capability cache]
  D --> E[Resolved runtime model]
  E --> F[OpenRouter transport]
Loading

Technical review

Best possible solution:

Retain the provider-owned suffix policy and existing cache owner, with exact catalog rows and authored settings taking precedence.

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

Current-main exact-ID lookup demonstrates the failure path, and the body supplies a failing upstream resolver assertion with synthetic catalog data; no independent runtime execution was performed during this read-only review.

Is this the best way to solve the issue?

The implementation fixes metadata lookup at the existing provider/cache boundary without rewriting wire IDs or introducing another state owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Runtime capability lookup keeps the original intent (8e4a1d8: Runtime catalog lookup prevents new OpenRouter models from silently losing image support because the bundled static snapshot lacks them.)
  • Provider-qualified model normalization keeps the original intent (6314c37: Normalize provider-qualified IDs for transport and metadata lookup while preserving native OpenRouter namespace IDs.)
  • Configured-model precedence keeps the original intent (4ddd0e3: Canonical-route catalog capabilities complete configured models while authored effort metadata and custom routes retain their precedence.)
  • Worker-backed capability cache keeps the original intent (6a6f7ba: Move capability persistence off the Gateway thread while retaining the existing cache and lifecycle owner.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Current main still has the reported gap: The provider requests capabilities using the normalized exact ID, and the loaded getter returns only cache.get(modelId); routing variants without catalog rows therefore receive generic metadata. (src/agents/embedded-agent-runner/openrouter-model-capabilities.ts:331, 6feeb50a3f14)
  • Pinned introduced change: The patch adds provider-owned routing-suffix selection and an optional exact-first cache fallback, retaining requested IDs, custom-route exclusion and existing configured-field precedence. (extensions/openrouter/models.ts:26, cdf87399a8bc)
  • Vendor contract: The patch follows the documented distinction between routing suffixes and catalog variants, including combined suffixes and preservation of the request ID: OpenRouter model variants. Public docs: docs/providers/openrouter.md. (docs/providers/openrouter.md:700, cdf87399a8bc)
  • Proof boundary: The fixture invokes production resolution and cache code but injects provider hooks and synthetic catalog responses; the author explicitly confirms that shipped Gateway discovery and live OpenRouter inference remain unverified. (src/plugin-sdk/test-helpers/openrouter-routing-capabilities.test-support.ts:81, cdf87399a8bc)
  • Current merge and CI state: GitHub reports this head as mergeable with mergeable_state blocked; its CI workflow concludes action_required without test jobs, so this is unexecuted validation rather than a demonstrated patch failure. (cdf87399a8bc)
  • Earlier review requests reassessed: The reported conflict is cleared, the body supplies a controlled historical ratchet comparison and passing candidate checks, and the latest PR-context check succeeds; the shipped-behavior proof request remains unresolved. (cdf87399a8bc)

Likely related people:

  • Olli: Raw commit 4ddd0e3 adds extensions/openrouter/index.ts:62 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4ddd0e33973e; files: extensions/openrouter/index.ts)

PR surface

Source +43, Tests +301, Docs +10, Other +6. Total +360 across 9 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 3 49 6 +43
Tests 4 310 9 +301
Docs 1 10 0 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 1 6 0 +6
Total 9 375 15 +360

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • merge-risk: 🚨 compatibility: The exported capability helpers gain optional fallback parameters used by the bundled provider; this is a narrow additive repair that preserves existing one-argument behavior.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

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

  • Supply the Gateway behavior evidence described in the proof assessment.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-04T15:02:31.520Z sha c2caa2a :: needs real behavior proof before merge. :: [P3] Move the routing integration fixture into the provider-owned tests
  • reviewed 2026-11-26T14:32:30.465Z sha a17a656 :: needs real behavior proof before merge. :: none

Reviewed November 27, 2026, 3:08 AM ET / 08:08 UTC (Revision 3).

ooiuuii and others added 3 commits November 4, 2026 23:47
Transport the reviewed Roboclaw repair without content changes.

Co-authored-by: ooiuuii <[email protected]>
Prepared and validated in the owned Roboclaw task. Exact accepted tree transported by Codex.

Co-authored-by: ooiuuii <[email protected]>
Exact Roboclaw artifact 844f8f729b71a7b4ee3dc753d826d824e89abeb0 transported by Codex; identical tree.

Co-authored-by: ooiuuii <[email protected]>
@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 6, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale after 7 days without qualifying human activity.
Without new human activity, Barnacle may close it as not planned 7 days after this message was posted. This is administrative inactivity cleanup, not a claim that the problem is fixed.
A human update restarts the inactivity clock; a new PR head also restarts it. A maintainer can add no-stale for a durable hold, or bad-barnacle to suppress Barnacle. Remove the hold when work can resume.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Nov 15, 2026

ooiuuii commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 26, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 26, 2026
Transport the exact Roboclaw candidate and managed upstream integration without changing its tree. Preserve current provider registration and native namespace coverage.

Co-authored-by: ooiuuii <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Nov 27, 2026

ooiuuii commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated head: cdf87399a8bc0c52b6037e6971d5c2a32964b507.

This integrates upstream b12552911c9de982455c72be6a4fda9eb199a759, preserves current provider registration/output defaults, and resolves the merge conflict. The exact candidate passed 66 focused tests, core typecheck, both local test-lines checks, a final native CLI build, and a fresh independent scoped code review with no P0-P3 findings.

The PR body now includes raw result excerpts and the historical ratchet attribution. Shipped Gateway/plugin-discovery and live-provider proof are still incomplete; the normal Gateway turn was refused on attribution grounds. Hosted CI has not passed on this head and currently reports action_required. Please assess this revision with those limits retained.

@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Nov 27, 2026

This branch has not been deployed

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

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: openrouter merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OpenRouter routing variants lose base catalog capabilities

1 participant