Skip to content

fix(providers): resolve ClawRouter auth-profile models#99759

Merged
steipete merged 1 commit into
mainfrom
fix/clawrouter-auth-profile-catalog
Jul 4, 2026
Merged

fix(providers): resolve ClawRouter auth-profile models#99759
steipete merged 1 commit into
mainfrom
fix/clawrouter-auth-profile-catalog

Conversation

@steipete

@steipete steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • resolve ClawRouter catalog models during agent runs when the proxy key lives in an auth profile
  • scope the refreshed runtime catalog by agent, workspace, auth profile, and router origin; clear it before refresh so revoked or missing credentials fail closed
  • document plugin and model allowlists on the standalone ClawRouter provider page

Why

ClawRouter model listing could resolve a stored auth-profile credential, but agent runtime resolution only saw persisted provider models. A catalog model selected from agents.defaults.models therefore failed as unknown unless the key was also present in the environment or the provider catalog had been written into config.

Validation

  • pnpm exec vitest run extensions/clawrouter/index.test.ts extensions/clawrouter/provider-catalog.test.ts
  • pnpm tsgo:extensions
  • pnpm tsgo:extensions:test
  • targeted extension lint on the changed TypeScript files
  • pnpm docs:check-mdx
  • pnpm format:docs:check
  • autoreview clean

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: clawrouter Extension: clawrouter size: S maintainer Maintainer-authored PR labels Jul 4, 2026
@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 3, 2026, 10:10 PM ET / 02:10 UTC.

Summary
Adds ClawRouter dynamic runtime model resolution for auth-profile-scoped catalog models, expands focused tests, and updates provider docs plus CHANGELOG.

PR surface: Source +65, Tests +59, Docs +5. Total +129 across 4 files.

Reproducibility: yes. from source, not from a live run: current main can discover ClawRouter models with an auth-profile credential, but runtime model resolution has no ClawRouter dynamic hook to refresh those catalog rows for an auth-profile-only setup.

Review metrics: 1 noteworthy metric.

  • Release-owned changelog edit: 1 entry added. CHANGELOG.md is generated for releases, so this hand-written entry should be removed before merge.

Stored data model
Persistent data-model change detected: serialized state: extensions/clawrouter/index.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted terminal/log proof from a real auth-profile ClawRouter agent run, including the fail-closed credential case.
  • Remove the hand-written CHANGELOG.md entry.
  • Have a maintainer explicitly review the auth-profile catalog cache scope before landing.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body lists targeted tests, typechecks, lint, and docs checks, but no redacted terminal output, logs, screenshot, recording, or artifact from an actual OpenClaw agent run using a ClawRouter auth profile. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The auth-profile runtime path is covered by unit-level mocked proof only; a redacted real agent run should show an auth-profile ClawRouter catalog model resolving and revoked or missing credentials failing closed.
  • [P1] The diff changes credential-scoped provider runtime resolution, so maintainer review should confirm the cache scope cannot reuse a model catalog across the wrong agent, workspace, auth profile, or ClawRouter origin.

Maintainer options:

  1. Prove the auth-profile runtime path (recommended)
    Before merge, require redacted terminal or log output from a real agent run selecting a ClawRouter catalog model through an auth profile, including the missing or revoked credential failure case.
  2. Accept unit-only auth risk
    Maintainers may intentionally merge with focused unit coverage only, but should own the remaining uncertainty around credential-scoped runtime catalog refresh.

Next step before merge

  • [P1] Protected maintainer label plus missing real behavior proof make this human-only; the branch also needs the release-owned changelog edit removed.

Security
Cleared: No concrete secret-handling or supply-chain regression was found; the remaining security-sensitive concern is proving the credential-scoped runtime path in a real setup.

Review findings

  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:30
Review details

Best possible solution:

Land the narrow ClawRouter plugin fix after removing the release-owned changelog entry and adding redacted real-run proof for auth-profile model resolution and fail-closed credential behavior.

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

Yes from source, not from a live run: current main can discover ClawRouter models with an auth-profile credential, but runtime model resolution has no ClawRouter dynamic hook to refresh those catalog rows for an auth-profile-only setup.

Is this the best way to solve the issue?

Yes, with one cleanup: using provider-local prepareDynamicModel/resolveDynamicModel is the narrowest maintainable seam for this bug, but the release-owned CHANGELOG edit should be dropped.

Full review comments:

  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:30
    CHANGELOG.md is release-generated and repository policy says normal PRs should not edit it. Keeping this hand-written entry can drift from release generation; keep the release-note context in the PR body or squash message instead.
    Confidence: 0.91

Overall correctness: patch is correct
Overall confidence: 0.82

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P2: This fixes a real provider/auth runtime bug with limited blast radius and no evidence of an active production-wide outage.
  • add merge-risk: 🚨 auth-provider: The PR changes runtime model resolution based on auth profiles and ClawRouter credentials, where incorrect scoping could affect provider routing or credential behavior.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body lists targeted tests, typechecks, lint, and docs checks, but no redacted terminal output, logs, screenshot, recording, or artifact from an actual OpenClaw agent run using a ClawRouter auth profile. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This fixes a real provider/auth runtime bug with limited blast radius and no evidence of an active production-wide outage.
  • merge-risk: 🚨 auth-provider: The PR changes runtime model resolution based on auth profiles and ClawRouter credentials, where incorrect scoping could affect provider routing or credential behavior.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body lists targeted tests, typechecks, lint, and docs checks, but no redacted terminal output, logs, screenshot, recording, or artifact from an actual OpenClaw agent run using a ClawRouter auth profile. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +65, Tests +59, Docs +5. Total +129 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 70 5 +65
Tests 1 59 0 +59
Docs 2 16 11 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 145 16 +129

What I checked:

  • Repository policy applied: Root, extensions, and docs AGENTS.md were read; the release-owned changelog rule and provider/auth compatibility guidance are directly relevant. (AGENTS.md:234, a1063aa4c83f)
  • Current main behavior: Current main's ClawRouter catalog path resolves a profile-scoped credential for discovery, but the provider has no dynamic runtime model hooks, so runtime resolution cannot refresh auth-profile-only catalog rows. (extensions/clawrouter/index.ts:84, a1063aa4c83f)
  • Runtime hook contract: The existing plugin SDK already supports async prepareDynamicModel followed by resolveDynamicModel for network-backed model resolution, which makes this a narrow provider-owned fix rather than a new core seam. (src/plugins/types.ts:501, a1063aa4c83f)
  • Async caller path: resolveModelAsync calls prepareProviderDynamicModel before retrying model resolution, passing config, agent/workspace directories, provider config, and auth profile context to the provider hook. (src/agents/embedded-agent-runner/model.ts:1745, a1063aa4c83f)
  • PR diff evidence: The PR adds provider-local dynamic model cache/refresh code and a focused auth-profile test, but also adds a hand-written CHANGELOG entry. (extensions/clawrouter/index.ts:113, 791103dc74ae)
  • Related work: The broader ClawRouter canonical-provider routing PR remains open and draft with review blockers; it overlaps conceptually but does not supersede this narrower provider-id fix. (2d22ef440732)

Likely related people:

  • steipete: Merged current-main ClawRouter routing, quota, docs, and tests in feat(providers): add ClawRouter routing and quotas #99658, which this PR directly extends. (role: introduced behavior and recent feature owner; confidence: high; commits: 4a354f76c1bf; files: extensions/clawrouter/index.ts, extensions/clawrouter/provider-catalog.ts, docs/providers/clawrouter.md)
  • Dallin Romney: Blame and history on the dynamic model hook/caller surfaces point to recent work consolidating the async model resolution and plugin runtime files used by this fix. (role: recent adjacent contributor; confidence: medium; commits: c7aca4f02938; files: src/agents/embedded-agent-runner/model.ts, src/plugins/types.ts, src/plugins/provider-runtime.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 791103dc74

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CHANGELOG.md

### Fixes

- **ClawRouter auth profiles:** resolve credential-scoped catalog models during agent runs when the proxy key is stored in an auth profile, and document plugin and model allowlists.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the non-release changelog entry

Root AGENTS.md says CHANGELOG.md is release-only and release generation owns it, but this normal provider fix adds a new bullet to the already dated 2026.7.1 section. That makes the hand-edited release notes diverge from the generated release flow and can misattribute post-release fixes, so leave this out of CHANGELOG.md unless this is the release-generation commit.

Useful? React with 👍 / 👎.

@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 4, 2026
@steipete
steipete merged commit 8250b8d into main Jul 4, 2026
203 of 216 checks passed
@steipete
steipete deleted the fix/clawrouter-auth-profile-catalog branch July 4, 2026 02:27
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: clawrouter Extension: clawrouter maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S 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.

1 participant