Repository navigation
refactor(mcp): load OAuth only when credentials are needed - #147884
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 14, 2026, 12:32 AM ET / 04:32 UTC. ClawSweeper reviewWhat this changesDefers loading MCP OAuth code until credential operations are needed, while preserving requester sign-in timing and credential cleanup. Merge readiness✅ Ready for maintainer review Keep open: this remains a useful, focused refactor, and no introduced correctness defect was found. Current main retains the eager imports; the protected maintainer label also excludes automatic closure. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw’s MCP integration turns configured external servers into agent tools. These paths prepare requester sign-in, supply bearer credentials, and clean up credentials when server configuration changes. flowchart TD
A[MCP server configuration] --> B[Transport and authentication checks]
B --> C[No credential operation]
B --> D[Load OAuth on demand]
D --> E[Requester sign-in or bearer lookup]
D --> F[Credential cleanup]
E --> G[Authenticated agent tools]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -4, Tests +18. Total +14 across 5 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep OAuth loading at credential-demand boundaries while retaining the existing identity, retirement, and cleanup owners. Do we have a high-confidence way to reproduce the issue? Not applicable as a user-facing bug reproduction: current source establishes eager OAuth imports, and the PR reports a before/after startup comparison; this read-only review did not execute runtime code. Is this the best way to solve the issue? Yes. Moving imports behind existing eligibility checks is a narrow solution that preserves the credential owner and avoids introducing competing configuration or authentication paths. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 23ed4ec291f2. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* commit '4ddb9ed21245eaca9f243e555a5ec070aaaf0dad': (113 commits) fix: avoid Gateway stalls when renaming sessions (openclaw#147869) refactor(plugins): reuse worker optional-method validation (openclaw#147925) refactor(infra): remove unreachable firewall diagnostic fallback (openclaw#147882) fix(ui): open attached automations from session hovercards (openclaw#147749) refactor(reply): share usage-bar numeric coercion (openclaw#147863) fix(doctor): report warnings for keyed agent configs (openclaw#123058) perf(plugins): reuse complete registry comparisons (openclaw#147893) fix(workboard): await lifecycle sweep completion in tests (openclaw#147950) fix: reduce stalls when browsing large session inventories (openclaw#147911) refactor(onboard): share custom model definition (openclaw#147915) feat(ios): collapse completed chat work above replies (openclaw#148002) fix(voice-call): retain state runtime for deferred streams (openclaw#147689) test(qa): compare Telegram entities semantically (openclaw#147752) fix(plugins): preserve runtime scope for deferred CLI actions (openclaw#147688) test(qa): keep Slack progress marker visible (openclaw#147748) test(qa): finish channel picker prompts (openclaw#147730) test(tui): handle auth restriction prompt (openclaw#147729) fix(qa): retain onboarding prompts across redraw bursts (openclaw#147687) fix(qa): seed Teams ambiguous timeout deterministically (openclaw#147686) refactor(mcp): load OAuth only when credentials are needed (openclaw#147884) ...
What Problem This Solves
MCP setup and configuration paths eagerly load OAuth execution code even when no OAuth credential operation is needed.
User Impact
No intended user-visible behavior change. Requester sign-in, bearer projection, and credential cleanup retain their existing behavior. No configuration changes or migrations are required.
Why This Change Was Made
Load OAuth dependencies after transport and authentication eligibility checks, and only when configuration changes require credential cleanup.
Requester preparation captures the authorization callback so execution still starts authorization immediately after the existing validation, preserving requester isolation and retirement behavior.
Evidence
Local validation below used the same five file post-images before their mechanical replay onto current main. Current-head CI is separate.