Repository navigation
fix(mcp): retry typed OAuth client metadata errors - #160243
Patrick-Erichsen wants to merge 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 3:41 AM ET / 07:41 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch makes OpenClaw retry MCP OAuth client registration with its existing localhost callback when the SDK returns a typed metadata error, and extends the coordinator test. Merge readiness✅ Ready for maintainer review Current main and the latest release still miss SDK client-metadata errors with an empty description. This focused PR addresses that gap, and the review found no discrete introduced defect. Priority: P2 Review scores
Verification
How this fits togetherThe MCP OAuth coordinator takes a configured server and SDK registration result, then prepares a browser authorization URL and stores the pending login session. The CLI or Gateway later completes the callback and token exchange. flowchart LR
A[MCP server config] --> B[OAuth coordinator]
B --> C[SDK client registration]
C --> D{Metadata rejected?}
D -->|Eligible retry| E[Localhost callback retry]
D -->|Accepted| F[Browser authorization URL]
E --> F
F --> G[Stored login session]
G --> H[Callback and token exchange]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +5, Tests +2. Total +7 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one coordinator-owned registration retry, with the explicit-callback and code-exchange exclusions preserved and covered at the OAuth boundary. Do we have a high-confidence way to reproduce the issue? Yes. Current main has a text-only matcher while SDK 1.30.0 creates an empty-message typed registration error when error_description is absent; the reviewer did not execute the provider flow. Is this the best way to solve the issue? Yes. Extending the existing coordinator retry recognizes the SDK result without creating a second OAuth flow or changing configuration and storage contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ff8c752d852f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
This pull request has been automatically marked as stale due to inactivity. |
What Problem This Solves
Fixes MCP OAuth login stopping before browser authorization when a provider rejects the default loopback callback with a typed SDK error but omits
error_description.User Impact
Calendly registration now retries the existing localhost callback once. Explicit callbacks and failed authorization-code exchanges keep their existing behavior.
Why This Change Was Made
Calendly returned
invalid_client_metadatawith a nestederrors.redirect_urifield. The SDK preserves its error class but produces an empty message, so OpenClaw’s text-only matcher missed the existing fallback. Recognize the SDK class as well as the established textual errors.Evidence
Stack-head validation
node scripts/check-changed.mjs --base 1fe560c198c2917154e2e1b130b0df3352ac5114passed: static guards, dependency/lock checks, generated metadata, all typecheck graphs, dead-code scans, lint and runtime import cycles.pnpm test src/agents/mcp-oauth.test.ts src/plugins/bundle-mcp.test.ts src/agents/bundle-mcp-config.test.ts src/cli/mcp-cli.test.ts src/cli/mcp-cli.plugins.test.ts src/cli/mcp-cli.oauth.test.ts src/plugins/contracts/package-manifest.contract.test.ts src/plugins/contracts/extension-runtime-dependencies.contract.test.ts --maxWorkers=1passed: 729 tests / 8 files / 5 routed shards in 420.34s. The new CLI plugin suite took 54.31s including cold transformation (3 tests); the infra suite took 200.74s (67 tests). Hosted CI timing was not yet available.Package and upgrade proof
Validated stack head
5859d7c3d184e80cfed01304a93681ff69d64036on macOS arm64 / Node 24.19.0:node scripts/package-openclaw-for-docker.mjs --allow-unreleased-changelog --output-dir .artifacts/claw-723/packagepassed (19m47.6s), including declaration builds, UI build, package inventory and extracted runtime import-graph checks.openclaw-2026.9.6.tgz, 99,082,240 bytes, SHA-2560ee3ab0c8d43e777431ce557797c9609dbeb10bef9fbaf40a0d5dcf4954bcb04. All 35 compiled entries are present; packed manifests match source exactly.plugins list --jsonfinds all 35 under the installed package, originbundled, disabled. Enabling GoDaddy/Excalidraw exposes native MCP servers without manual config; livemcp probereturns 2/5 tools. Authenticated GitHub returns 45 tools; output is redacted. Missing-key fail-closed behavior and regional endpoint overrides pass. npm lifecycle-script approvals are limited to this disposable fixture; no user/global npm policy changed.[email protected]ranupdate --tag <candidate.tgz> --yes --json --no-restart --timeout 900. Resultstatus: ok, installed build2026.9.6-5859d7c3d184-2026-09-28T06-43-34.310Z; maintained upgrade-survivor helper verified baseline, candidate and installed application-byte identities. Existing disabled MCP config and enabledmemory-coresurvived unchanged; all 35 additions remain disabled.An earlier package attempt correctly refused a namespace change caused by concurrent generated-doc work. The final build ran after generation and checks finished, on stable inputs. OAuth consent/account tools and ten additional key-service accounts remain unverified; discovery-only inclusion is the approved milestone.
Stack order
Review only; no merge or release is authorized.
Hosted CI follow-up
Hosted CI is not green. Local validation above passed on the pinned stack; GitHub's later merge-ref/stack runs reported:
service-operation-lock.retained-custody.test.tscases (missing,unknown-phase,unknown-version,relative-source); sibling jobs were cancelled. The newer merge base includes upstream b107d4af, whose handoff-store refactor makesrelease()throw for malformed custody where the unchanged test expectsfalse. The OAuth PR changes neither that owner nor its tests. A local replay of the same test-group order on pure upstreamc136ec631464reproduced all four failures with no CLAW-723 code present: 900 passed, 4 failed, 5 skipped across the same 18-file group in 112.43s (macOS; hosted run was Linux). The first archive attempt stopped before tests because scoped dependency links were missing; the corrected prerequisite setup is the reproducing run.These hosted outcomes remain review/landing context, not passing evidence. No merge is authorized.