Skip to content

fix: keep custom model routes on their declared tool surface - #156017

Merged
steipete merged 3 commits into
mainfrom
codex/frv-model-compat-route-20260922
Sep 24, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/frv-model-compat-route-20260922

Conversation

@steipete

@steipete steipete commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Custom model endpoints could inherit the standard catalog endpoint's compatibility flags. Inherited Code Mode preference could suppress Tool Search even when the custom endpoint did not support the same tool behavior. Config materialization and runtime resolution now use the endpoint that owns those capabilities.

User Impact

Catalog capabilities apply to their matching API and physical endpoint. Equivalent Anthropic /v1 and /v1/ spellings retain the canonical endpoint's capabilities. When configuration selects catalog endpoint A after discovery returned endpoint B, resolution selects A's catalog capabilities, including provider-only overlays with no model row. Same-endpoint discovery keeps its refreshed metadata.

Upgrade note: Custom endpoints that implicitly borrowed codeMode: "preferred" now use the normal Tool Search controls. An endpoint verified to support Code Mode can retain the existing explicit models.providers.<provider>.models[].compat.codeMode: "preferred" setting. Other endpoint-specific flags, including supportsTemperature, also belong in the custom endpoint's existing compat declaration. No new configuration field is introduced.

Why This Change Was Made

Keep compatibility decisions at the existing catalog and transport owners. Reuse Anthropic endpoint normalization and consult the existing static catalog lookup only when discovery's endpoint differs from the selected endpoint. Doctor retains its unique-route and equality checks when removing redundant compatibility declarations; divergent and custom declarations remain protected.

Related: #154964, whose Gateway/MCP proof exposed the original defect.

Evidence

  • The route-alias and discovery-to-configured-route failures were reproduced at the resolver boundary. The provider-only regression also failed for missing capabilities on raw and materialized configuration, with retained-discovery and same-route refresh controls passing.
  • All 332 candidate tests passed: 15 route cases, 4 catalog cases, 21 config-default cases, 24 migration cases, and 268 sibling cases. Measured command wall with one worker: route file 29.081 seconds, catalog 1.544 seconds, defaults 16.303 seconds, and migration 17.770 seconds. The four unchanged sibling files passed together in 55.382 seconds. Focused proof.
  • Fresh independent P2 review found no actionable issues. The only subsequent change was the exact assertion allowance shrink from seven to six, leaving production and test bytes unchanged.
  • All mapped checks passed in 1,570.165 seconds, including all 25 core-test typecheck graphs. Canonical package build and validation passed in 379.273 seconds. Checks and package proof.

The published-updater proof passed on the unchanged candidate tree. The released 2026.9.4 updater installed the canonical 2026.9.5 candidate and ran its Doctor. Before any manual Doctor invocation, the original config's exact .pre-update backup was verified, only the matching canonical compatibility declaration was removed, divergent temperature and custom-endpoint Code Mode declarations were preserved, and the selected model stayed unchanged. Two subsequent Doctor passes retained identical config bytes. The complete installed-update cell took 85.309 seconds; the updater command itself took 48.401 seconds. This used isolated state and --no-restart, with the updater's own staged validation and canary. Installed model status proves selection; the resolver tests prove compatibility behavior. The initial fixture failure was an incorrect expectation that postinstall retained its consumed lifecycle marker; it was corrected without changing product code, and all other packaged-file hashes remained checked.

Current-head CI35977015261 passed for dd15d1a17c35b499b2c4d400ad5a0f18e10ec313 (140 successful jobs; 16 skipped). In CI, summed reported case times were 0.053 seconds for the 15 route cases, 0 milliseconds at reporter precision for the 4 catalog cases, 0.002 seconds for the 21 defaults cases, and 0.373 seconds for the 24 migration cases. These exclude file setup/import/teardown; CI file wall times were not available. The standalone file walls above remain the measured total command costs.

Earlier composed Gateway/MCP proof for the original route fix passed with four tool-bearing requests exercising Tool Search, description, and the real MCP call. That proof predates the added alias and discovery cases; its temporary fixture overlay is excluded from this PR. Earlier CI35798278130 failed plugin-state and session-group fixtures; the reproduced failures were repaired by 8ce411c1 and 46dfea6a, both already included in this branch. CI35806084181 passed on the previous head 355ca68a; those historical results are not presented as current-head CI.

@clawsweeper

clawsweeper Bot commented Sep 22, 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 size: M maintainer Maintainer-authored PR labels Sep 22, 2026
@steipete
steipete marked this pull request as ready for review September 22, 2026 23:37
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 7:24 AM ET / 11:24 UTC (Revision 8).

ClawSweeper review

What this changes

The branch selects model capabilities by provider API and endpoint during config loading and runtime resolution, recognizes equivalent Anthropic URLs, and adds route, Doctor, and operator guidance.

Merge readiness

✅ Ready for maintainer review

Current main still applies catalog compatibility across custom endpoints, so this PR remains useful. The recorded compatibility tradeoff is accepted, and this review found no concrete introduced defect.

Priority: P2
Reviewed head: dd15d1a17c35b499b2c4d400ad5a0f18e10ec313

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused patch and current-head checks have relevant runtime and update observations, with a stated limit on independent log inspection.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Resolver coverage connects selected routes to the agent tool surface; the PR body records an earlier real Gateway/MCP tool flow and a later installed-updater run observing backed-up, stable saved config after Doctor. The linked updater workflow is cancelled and its raw log was inaccessible here, so the detailed PR-body observations are the available update capture; they support existing-state compatibility.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Resolver coverage connects selected routes to the agent tool surface; the PR body records an earlier real Gateway/MCP tool flow and a later installed-updater run observing backed-up, stable saved config after Doctor. The linked updater workflow is cancelled and its raw log was inaccessible here, so the detailed PR-body observations are the available update capture; they support existing-state compatibility.
Evidence reviewed 9 items Current-main behavior: Current main seeds catalog compatibility by model ID without checking the configured endpoint, so the central problem remains.
Introduced route selection: The PR selects a catalog donor matching the resolved transport and then resolves compatibility against that route.
Config defaulting: Config materialization now compares the catalog API and base URL with the configured route before seeding compatibility.
Findings None None.
Security None None.

How this fits together

Provider settings, plugin catalog metadata, and model discovery feed OpenClaw's model resolver. Its selected compatibility flags determine the agent's Code Mode or Tool Search controls; Doctor can also remove redundant flags from saved config.

flowchart LR
A[Provider settings] --> D[Route matching]
B[Plugin catalog] --> D
C[Model discovery] --> D
D --> E[Compatibility selection]
E --> F[Agent tool surface]
D --> G[Doctor config cleanup]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +24, Tests +326, Docs +4, Other 0. Total +354 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 4 54 30 +24
Tests 4 326 0 +326
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 10 385 31 +354

Review metrics

Metric Value Why it matters
Production and test delta production +24 net lines; tests +326 lines The production growth supports route selection and normalization; the tests cover resolver behavior and Doctor cleanup.

Technical review

Best possible solution:

Keep capabilities owned by the selected endpoint across runtime resolution and Doctor, while preserving explicit custom declarations and backup-safe upgrades.

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

Yes. Current-main source shows catalog compatibility seeded without a route check, and the affected tool-surface decision is explicit; this read-only review did not execute the path.

Is this the best way to solve the issue?

Yes. The patch uses the existing route-compatibility owner and explicit custom compatibility setting, without adding a competing configuration surface.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a533ff8f836e.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: Incorrect tool controls affect custom model routes, with limited blast radius.
  • merge-risk: 🚨 compatibility: Existing custom endpoints that borrowed preferred Code Mode change tool controls; the recorded maintainer disposition accepts this documented tradeoff.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Resolver coverage connects selected routes to the agent tool surface; the PR body records an earlier real Gateway/MCP tool flow and a later installed-updater run observing backed-up, stable saved config after Doctor. The linked updater workflow is cancelled and its raw log was inaccessible here, so the detailed PR-body observations are the available update capture; they support existing-state compatibility.
  • proof: sufficient: Contributor real behavior proof is sufficient. Resolver coverage connects selected routes to the agent tool surface; the PR body records an earlier real Gateway/MCP tool flow and a later installed-updater run observing backed-up, stable saved config after Doctor. The linked updater workflow is cancelled and its raw log was inaccessible here, so the detailed PR-body observations are the available update capture; they support existing-state compatibility.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: 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 (7 earlier review cycles)
  • reviewed 2026-09-23T00:00:53.657Z sha 4a76471 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-23T00:12:30.902Z sha 4a76471 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-23T01:32:07.177Z sha 355ca68 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-23T01:58:39.217Z sha 355ca68 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T03:57:14.400Z sha 355ca68 :: blocked before merge. :: none
  • reviewed 2026-09-24T04:19:53.364Z sha 355ca68 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T08:52:53.761Z sha dd15d1a :: blocked before merge. :: none

@steipete steipete self-assigned this Sep 24, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 24, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer disposition: accept the route-owned compatibility behavior described in this review. Reusing a model ID at a different API or base URL does not establish that the new endpoint supports the original catalog route's capabilities; the existing route-compatibility owner and provider documentation already define that boundary.

Existing custom endpoints that relied on inherited automatic Code Mode will use the normal tool-search controls. Operators who want automatic Code Mode on a verified custom endpoint can retain it with the existing explicit compat.codeMode: "preferred" declaration. Other compatibility flags are likewise endpoint-owned. The PR's upgrade guidance now spells out this operator action; no new configuration key or native Codex tool contract is introduced.

This resolves the review's compatibility disposition. Code review, source-bound validation, and the ordinary native merge gates still apply.

Reuse Anthropic endpoint normalization and select the final route catalog donor, including provider-only overlays. Preserve explicit custom endpoint declarations and keep Doctor cleanup bound to matching catalog routes.
@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Sep 24, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 24, 2026
@steipete
steipete merged commit a7777b3 into main Sep 24, 2026
230 of 232 checks passed
@steipete
steipete deleted the codex/frv-model-compat-route-20260922 branch September 24, 2026 11:36
@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 25, 2026
…w#156017)

* fix: keep custom model routes on their declared tool surface

* fix(models): preserve compatibility on equivalent configured routes

Reuse Anthropic endpoint normalization and select the final route catalog donor, including provider-only overlays. Preserve explicit custom endpoint declarations and keep Doctor cleanup bound to matching catalog routes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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