Skip to content

fix(models): preserve captured routes in configured catalog views - #143643

Merged
obviyus merged 3 commits into
mainfrom
fix/configured-route-precedence
Sep 10, 2026
Merged

obviyus merged 3 commits into
mainfrom
fix/configured-route-precedence

Conversation

@obviyus

@obviyus obviyus commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #136257.

What Problem This Solves

Configured model listings could show provider-default routing even when the captured catalog retained a different route, such as reporting a local endpoint as remote.

Why This Change Was Made

Configured composition now prefers an explicit model route, then the captured route for the exact model identity, then provider defaults. Startup and visibility use that same decision. A per-call identity index removes repeated scans without introducing a persistent cache.

User Impact

Listings retain captured routes while respecting explicit settings and case-distinct identities. Configuration-only callers retain provider defaults when no captured catalog is supplied. No credential, schema, protocol, or operator-option change is introduced.

Consumers: configured catalog composition, startup publication, and visibility now share captured-route selection.

Evidence

The original Gateway returned incorrect locality in all three catalog views. Twelve authenticated candidate responses across four route scenarios retained the expected locality and metadata. Source regressions passed, including the case-distinct identity control. A producer benchmark improved from 1,963 to 35 ms at 400 rows; this is not end-to-end latency. Continuous integration passed its 400-model, 11-agent case with no upstream requests. Passive-read checks preserved saved configuration and catalog bytes. Inference and live account sign-in were not tested.

@clawsweeper

clawsweeper Bot commented Sep 10, 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 agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 10, 2026
@obviyus obviyus self-assigned this Sep 10, 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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 1:37 AM ET / 05:37 UTC (Revision 4).

ClawSweeper review

What this changes

Preserves captured model endpoints and API types in configured catalog views while honoring explicit model settings and provider-default fallbacks.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: current main and the latest release still lose captured routes when composing configured rows. The prior exact-identity finding is resolved, and no blocking defect remains in the reviewed patch.

Priority: P2
Reviewed head: 822b45dac9b7061441172a0b050f18255ee5071b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with resolved prior feedback, meaningful regression coverage, and relevant reported Gateway proof.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured body reports real authenticated Gateway listings through the changed catalog owners, with correct routes and metadata in all/configured/default views across four scenarios. Changed production files match the reported CI proof build; its historical merge identity does not establish a current merge result.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured body reports real authenticated Gateway listings through the changed catalog owners, with correct routes and metadata in all/configured/default views across four scenarios. Changed production files match the reported CI proof build; its historical merge identity does not establish a current merge result.
Evidence reviewed 10 items Current main still needs the fix: At fetched main, configured catalog construction accepts no captured catalog and selects model.api or provider.api and model.baseUrl or provider.baseUrl. Startup also places configuration-only entries ahead of captured rows.
Latest release has the same configuration-only construction: The v2026.9.3 source also lacks captured catalog input and uses provider defaults when model-level route fields are absent. The release source was read through GitHub after the local blob read failed.
Exact donor matching resolves the prior finding: The optional catalog is indexed with canonical, case-preserving identities and first-match deduplication. Model-level API and endpoint pins take precedence over captured values; absent captures retain the old fallback. Startup regression cases include distinct Selected and selected rows.
Findings None None.
Security None None.

How this fits together

The model catalog combines configured models with captured provider inventory. Startup and visibility policies use that catalog to supply model lists and route metadata to clients.

flowchart TD
  A[Configured models] --> C[Configured catalog composer]
  B[Captured provider inventory] --> C
  C --> D[Model pin then exact captured route then default]
  D --> E[Prepared catalog]
  E --> F[Visibility and route projection]
  F --> G[Client model lists]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +12, Tests +136. Total +148 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 49 37 +12
Tests 2 196 60 +136
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 245 97 +148

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +12 lines; tests net +136 lines Production growth supplies the optional captured input and per-call identity index while removing duplicate visibility construction.
SDK input compatibility 1 optional input added; 0 required inputs or operator settings added Existing configuration-only callers retain their previous fallback behavior.

Technical review

Best possible solution:

Use one exact-identity route-precedence rule across catalog composition and visibility while preserving explicit pins, replace mode, and configuration-only SDK behavior.

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

Yes: current-main configuration-only overlays replace a differing captured route with provider defaults; the body also records a real Gateway baseline showing incorrect locality. This review established the path from source without executing it.

Is this the best way to solve the issue?

Yes: the patch repairs the shared producer, preserves configuration-only callers, and reuses prepared visibility facts; exact matching and replace-mode coverage address the relevant compatibility boundaries.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports real authenticated Gateway listings through the changed catalog owners, with correct routes and metadata in all/configured/default views across four scenarios. Changed production files match the reported CI proof build; its historical merge identity does not establish a current merge result.

Label justifications:

  • P2: Repairs incorrect model-list route metadata with a bounded catalog-composition change.
  • 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): The captured body reports real authenticated Gateway listings through the changed catalog owners, with correct routes and metadata in all/configured/default views across four scenarios. Changed production files match the reported CI proof build; its historical merge identity does not establish a current merge result.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports real authenticated Gateway listings through the changed catalog owners, with correct routes and metadata in all/configured/default views across four scenarios. Changed production files match the reported CI proof build; its historical merge identity does not establish a current merge result.

Evidence

What I checked:

  • Current main still needs the fix: At fetched main, configured catalog construction accepts no captured catalog and selects model.api or provider.api and model.baseUrl or provider.baseUrl. Startup also places configuration-only entries ahead of captured rows. (src/agents/model-selection-shared.ts, 0153d84c02af)
  • Latest release has the same configuration-only construction: The v2026.9.3 source also lacks captured catalog input and uses provider defaults when model-level route fields are absent. The release source was read through GitHub after the local blob read failed. (src/agents/model-selection-shared.ts, 1391f7cd2d40)
  • Exact donor matching resolves the prior finding: The optional catalog is indexed with canonical, case-preserving identities and first-match deduplication. Model-level API and endpoint pins take precedence over captured values; absent captures retain the old fallback. Startup regression cases include distinct Selected and selected rows. (src/agents/model-selection-shared.ts:1390, 822b45dac9b7)
  • Startup, refresh, and compatibility boundaries: Startup passes captured rows only outside replace mode. Full refresh still adds configured membership rather than every startup row. The existing SDK export gains an optional input, with unchanged config-only behavior; the captured PR body explicitly discusses this extraction contract. (src/agents/prepared-model-runtime.configured-catalog.ts:32, 822b45dac9b7)
  • Existing endpoint precedence contract: The model documentation says a nonempty authored models.json endpoint wins in merge mode, missing endpoints fall back to configuration, and replace mode uses configured providers. Public docs: docs/concepts/models.md. (docs/concepts/models.md:393, 822b45dac9b7)
  • Production behavior evidence: The captured PR body, sourceRevision a6da93d15caf1f6b77b5a3e2827a2d46aa3da6b1e9a8de06adab47c793231c43, records baseline locality failure and 12 authenticated candidate responses across four real Gateway scenarios: captured loopback route, explicit remote pin, absent capture, and case-distinct inventory. It records preserved metadata, unchanged persisted contents, and normal process shutdown. This is contributor-reported real-run evidence; no runtime was executed during this review. (c7719e2ae9b9)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • steipete: 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-09-10T03:13:14.467Z sha 978a589 :: needs changes before merge. :: [P2] [P2] Require an exact model identity before borrowing its route
  • reviewed 2026-09-10T03:32:43.289Z sha 1bfe136 :: blocked before merge. :: none
  • reviewed 2026-09-10T03:56:11.272Z sha 822b45d :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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: 🦐 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. labels Sep 10, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Sep 10, 2026
@obviyus
obviyus merged commit 46ed8fd into main Sep 10, 2026
193 of 195 checks passed
@obviyus
obviyus deleted the fix/configured-route-precedence branch September 10, 2026 05:56
@obviyus

obviyus commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @obviyus!

Proof: Ordinary Gateway startup and authenticated models.list reproduce the baseline locality error and verify captured-route, explicit-pin, absent-route and case-distinct controls across all/configured/default views. A separate accepted normal/error supplement records raw state boundaries, actual connection closes and clean Gateway shutdown. Evidence keeps its CI merge-build identity and stated limits.

  • Bug: Configured catalog views replaced an exact captured route with provider defaults.
  • Fix: One exact-identity composition rule gives model pins priority, then captured routes, then provider defaults. Visibility reuses that prepared result.
  • Validation: 91 focused checks, scoped independent acceptance, clean exact-head review with no findings, and successful CI including the 400-model/11-agent case. No rank-up moves remain.
Before After
Captured loopback model reported as remote Captured locality preserved
Missing exact donor could borrow a case sibling Case-distinct routes and metadata stay separate

This lands the configured-route contribution to #136257, not the remaining registry/native/auth work or whole original-area closure. No live-provider inference claim is made.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 11, 2026
…w#143643)

Preserve the exact captured model route below explicit model pins and above provider defaults. Reuse the configured policy across catalog, startup and visibility consumers.

Keep case-distinct identities, first physical donors, configured metadata, replace/empty-refresh behavior and config-only SDK compatibility. Index captured identities once per composition.

Verified with baseline regressions, 91 focused checks, ordinary Gateway public proof, scoped independent acceptance and exact-head CI. Public proof uses the matching CI merge build; prior failures and acceptance limits remain documented in the PR.

Related: openclaw#136257

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR 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