Repository navigation
refactor(auth): move Copilot OAuth ownership to plugin - #118063
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 1:35 PM ET / 17:35 UTC. ClawSweeper reviewWhat this changesMoves GitHub Copilot OAuth device login, refresh, tenant validation, and doctor guidance out of core and into the GitHub Copilot provider plugin, with core delegating through generic provider-runtime hooks. Merge readiness⛔ Blocked until real behavior proof is added - 6 items remain Keep open. The current head clears the prior Plugin SDK baseline blocker and implements a coherent generic-to-plugin OAuth dispatch path, but the new public provider hook still needs maintainer acceptance and the PR lacks after-fix real GitHub Copilot login-and-request proof. The existing Priority: P2 Review scores
Verification
How this fits together
flowchart LR
SDK[Session SDK AuthStorage] --> BuiltIn[Built-in OAuth registry]
BuiltIn --> Dispatch[Generic provider dispatch]
Dispatch --> Copilot[GitHub Copilot plugin]
Copilot --> Credential[OAuth credential and tenant metadata]
Credential --> Runtime[Authenticated Copilot model request]
Copilot --> Doctor[Operator repair guidance]
Decision needed
Why: The implementation is technically coherent, but a new public provider hook affects third-party plugin compatibility and future SDK maintenance; source inspection cannot choose that permanent API direction. Before merge
Agent review detailsSecurityNone. PR surfaceSource -307, Tests -333, Docs +1, Generated 0. Total -639 across 29 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Accept one narrow, documented provider-owned OAuth hook only if maintainers want it as a durable Plugin SDK contract, then add redacted proof of a real device login and successful Copilot request through the plugin path before merging. Do we have a high-confidence way to reproduce the issue? Not applicable as a defect reproduction: this is an ownership refactor. A high-confidence after-fix validation path exists, but the PR has not shown it: perform a real device login and make an authenticated Copilot request using the plugin-owned path. Is this the best way to solve the issue? Yes, conditionally. Moving GitHub-specific auth policy into its provider plugin while keeping generic dispatch in core fits the documented boundary, but maintainers must approve the new public hook and see real OAuth behavior proof. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 74f3ec1223ee. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
555038b to
f31fb0a
Compare
f31fb0a to
34a3a8a
Compare
|
Merged via squash.
|
* refactor(auth): move Copilot OAuth ownership to plugin * test(auth): cover plugin-owned Copilot OAuth * test(auth): align OAuth runtime mocks * refactor(auth): extract session OAuth adapter * refactor(auth): centralize session OAuth dispatch * test(auth): type OAuth refresh mock * chore(plugin-sdk): regenerate API baseline for provider oauth dispatch
…in provider openclaw#118063 moved GitHub Copilot's OAuth ownership out of BUILT_IN_OAUTH_PROVIDERS and into its own plugin, so the comment claiming this case covers "a second built-in provider" no longer describes the registry. The case still earns its place: it proves the repaired branch is generic over whatever getOAuthProviders() yields rather than special-cased to Anthropic. Comment only.
What Problem This Solves
GitHub Copilot OAuth still had two active owners: the bundled provider plugin already owned interactive device login and request-time authentication, while the session SDK continued seeding a 604-line core implementation. That duplicate also kept credential refresh, enterprise routing, model-policy side effects, and doctor copy in core.
This removes the parallel core implementation in
src/llm/utils/oauth/github-copilot.ts:1-604, its 628-line internal test atsrc/llm/utils/oauth/github-copilot.test.ts:1-628, and the orphaned types atsrc/llm/github-copilot-oauth-types.ts:1-36. It also removes the built-in registration formerly atsrc/llm/utils/oauth/index.ts:21,27.Why This Change Was Made
extensions/github-copilotis now the sole owner of active Copilot device login, legacy credential normalization, auth-doctor guidance, and enterprise request routing. Core retains only generic provider-plugin dispatch:ProviderPlugin.loginOAuthadapts the public callback-basedAuthStorage.loginAPI to an owning provider.refreshOAuthandformatApiKeyhooks own refresh and runtime credential formatting.formatApiKeyandprepareRuntimeAuth, avoiding a lossy migration into one provider-global config value.The local autoreview bundler refused the full deletion because
Iv1.b507a08c87ecfe98matched its secret-like heuristic in both the removed core copy and the surviving extension. Maintainer verification confirmed this is GitHub's public OAuth device-flowclient_id, public by OAuth protocol design, already present onorigin/main, and accepted by the repository's CI TruffleHog policy. No scanner configuration or identifier obfuscation is included.The dated compatibility shims listed under
plugin-sdk-provider-owned-helper-shimsremain untouched until their2026-10-01removal window.User Impact
Normal GitHub Copilot onboarding and request-time authentication continue through the extension. Legacy public OAuth profiles normalize to the durable GitHub token, and legacy enterprise profiles preserve their per-profile tenant routing.
AuthStorage.login("github-copilot", ...)now lazy-loads the registered provider. If the owning plugin is disabled, missing, or unavailable, it throws a typedOAuthProviderConfiguredUnavailableErrorwith an actionable enable/install/doctor message instead of silently returning no credential. Genuinely unowned provider ids retain the existing unknown-provider error.Two owner-approved semantic changes are explicit:
No config option, environment variable, CLI flag, SQLite schema, or protocol surface was added.
Evidence
origin/main:node scripts/run-vitest.mjs src/plugins/provider-runtime.test.ts src/agents/sessions/auth-storage.test.ts src/agents/auth-profiles/oauth.test.ts src/agents/auth-profiles.doctor.test.ts extensions/github-copilot/index.test.ts extensions/github-copilot/oauth.test.ts extensions/github-copilot/domain.test.tsoxfmtcompleted for every touched file.git diff --checkpassed before and after the final rebase.node scripts/check-changed.mjsclassified the change for remote proof but could not launch because no Crabbox/Testbox backend was ready; hosted PR CI is the heavy proof path.check-plugin-sdk-api-baselinemismatch described below. Security-fast also confirmed the public device-flow client id passes the repository TruffleHog policy.The
check-plugin-sdk-api-baselinecheck is expected to remain red because this PR adds the genericloginOAuthprovider hook. Baseline regeneration is intentionally pending an orchestrator follow-up; every other CI check should be green before review.