Repository navigation
feat(models): split sign out on this device from disconnect account - #205759
Conversation
Provider plugins can add an optional `revoke` hook, a disconnect label and an account-management link to an OAuth auth method. Settings then shows Sign out on this device, Disconnect account and the link. Disconnect asks the plugin to revoke the grant and deletes the saved sign-in only after it succeeds; a refused revoke keeps the sign-in and offers Try again. Co-authored-by: obviyus <[email protected]>
Co-authored-by: obviyus <[email protected]>
The failure toast stays until dismissed. Its Try again re-sent the request with the current agent and Gateway, so switching agents first could revoke another agent's sign-in with the same profile id. Retry now runs only while the original scope is current. Co-authored-by: obviyus <[email protected]>
|
🦞👀 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. |
|
A management-only auth method declared before the revoking one hid Disconnect and made revoke requests fail. Disconnect now comes from the first method with `revoke` and the manage link from the first method with an HTTPS account-management URL. Register the new real-Gateway Control UI test in both Gateway resource inventories so CI runs it in the serial real-Gateway lane. Co-authored-by: obviyus <[email protected]>
|
Codex review: needs maintainer review before merge. What this changesThis PR adds optional plugin-owned account revocation and management actions to Settings → Models. Example: Disconnect the saved Acme account [email protected].
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-directed feature adds a useful distinction between local sign-out and provider revocation, with no definite introduced code defect found. Reviewed head: Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Control UI sends an administrator-only model-auth request to the Gateway, which selects the saved OAuth profile, invokes the loaded provider plugin, and uses the existing credential-removal owner after successful revocation. flowchart LR
A[Models account row] --> B[Gateway authLogout]
B --> C[Selected OAuth profile]
C --> D[Provider revoke hook]
D --> E[Provider endpoint]
E --> F[Existing credential removal]
E --> G[Failure toast and retained account]
Technical reviewBest possible solution: Retain the optional provider hook and existing Gateway removal owner, preserving local-only sign-out as a separate action. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the feature gap: account sign-out removes saved credentials without invoking provider revocation; no target code was executed during this read-only review. Is this the best way to solve the issue? The implementation extends the existing plugin contract and logout owner without adding another persistence path, while keeping providers without account actions unchanged. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ea7f7431dc68. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +261, Tests +411, Docs +19, Other 0. Total +691 across 27 files. Added test files: 3. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 26, 2026, 12:24 AM ET / 05:24 UTC. |
|
Maintainer override:
|
…penclaw#205759) ## What Problem This Solves A saved OAuth sign-in in **Settings → Models** has one action: **Sign out**. It deletes the saved credential on this Gateway, but the grant stays active at the provider. A person who wants to remove OpenClaw's access to their account must find the provider's account page on their own, and nothing in Settings tells them that signing out and disconnecting are different. ## What Changed **Plugin SDK (optional fields on the OAuth `ProviderAuthMethod`):** - `revoke({ profileId, credential, config, signal })`: revoke this sign-in's grant at the provider. Resolve when the grant is revoked or already invalid; throw an `Error` with a user-facing message when it may still be active. - `disconnectLabel` (default **Disconnect account**), `accountManagementUrl` (HTTPS only) and `accountManagementLabel` (default **Manage connected apps**). **Gateway (existing owner `models-auth-status.ts`, no new method):** - `models.authStatus` adds `oauthAccountActions` to providers with a saved OAuth/token sign-in, read from the loaded plugin registry. A status read never loads a plugin. - `models.authLogout` accepts `revoke: true` with exactly one `profileIds` entry. The Gateway calls the plugin's `revoke` (30 s abort signal) and deletes the saved profile only after it resolves. If it throws, the profile is kept and the request fails with `UNAVAILABLE`: `<provider message> The sign-in is still saved on this device.` - `ModelsAuthLogoutParamsSchema` gains the optional `revoke: true` field. Additive, no protocol version change; no stored-row change. The `models.auth*` schemas move unchanged from `agents-models-skills.ts` (at its 700-line cap) to a sibling `schema/models-auth.ts`; the protocol registry owner count goes from 76 to 77. **Control UI (Models → Providers account row):** - When the provider declares account actions, the OAuth account shows text actions: **Sign out on this device** (the existing sign-out), the plugin's disconnect label, and the manage link. Other providers keep the existing sign-out icon. - Disconnect confirmation says that the provider revokes access and other devices that use this sign-in stop working, and points to **Sign out on this device** for a local-only removal. - Failure: a persistent error toast `Couldn’t disconnect <account>` with the provider's message and **Try again**. The account stays in the list. ## User Impact - Providers that implement `revoke` get a real disconnect; a refused revoke never shows as disconnected. - Providers without these fields look and work as before. ## Evidence **Gateway boundary tests** (`models-auth-status.test.ts`, 53 pass; protocol schema test accepts `revoke: true` and rejects `revoke: false`): status advertises the plugin's actions; revoke runs before removal (order recorded); a failed revoke keeps the profile and returns the provider message. **Control UI E2E on a real Gateway** (`model-provider-disconnect.real-gateway.e2e.test.ts`, dist-nodts build of this head): a synthetic `acme` provider plugin loaded through `plugins.load.paths`, a seeded `[email protected]` OAuth profile and a local revoke endpoint. Light and dark: the row shows both actions and the link; with the endpoint returning 503 the toast shows the error and **Try again**, and the profile stays saved on disk. After the endpoint returns 200, **Try again** removes the account from the UI and from the persisted store. Every revoke request was `POST`, `application/x-www-form-urlencoded`, `token=<refresh>`. Screenshots (before = base `d2a380d0f128`, after = this branch; synthetic `acme` plugin, `[email protected]`): see the images attached below. **Disconnect retry scope:** `model-providers-page.removal.test.ts` › retries a refused disconnect only for the agent that asked for it (red without the scope check, green with it; found by local review round 1). **Other checks:** touched UI unit suites (`profiles-view`, `view.provider-actions`, `data`, `model-providers-page.removal`, `model-providers-page.order`, `view`): 110 pass. ## Defaults recorded - A failed revoke keeps the saved sign-in. Deleting it anyway would make the UI imply the account is disconnected while the grant may still be active. The person can still use **Sign out on this device**, or the provider's account page link. - `revoke` takes one profile per request. Revoking several and removing only some would need a partial result shape; the UI never needs it. - Account actions come from the plugin registry the Gateway has already loaded. A provider plugin that is not loaded (for example, a provider whose models run only through a core API config) shows today's sign-out until it is loaded. - Disconnect (with its label) comes from the provider's first auth method that declares `revoke`; the manage link (with its label) comes from the first method with an HTTPS `accountManagementUrl`. They may be different methods (local review round 2). - The core default labels are localizable; plugin labels are shown as given. - `control-ui-performance` budget: `largest CSS gzip 57.3 KiB > 56.9 KiB` and the chat boot JS budgets fail identically on the merge base `d2a380d0f128` (same 58,659 B shared-styles file); this PR does not change that file.       Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
A saved OAuth sign-in in Settings → Models has one action: Sign out. It deletes the saved credential on this Gateway, but the grant stays active at the provider. A person who wants to remove OpenClaw's access to their account must find the provider's account page on their own, and nothing in Settings tells them that signing out and disconnecting are different.
What Changed
Plugin SDK (optional fields on the OAuth
ProviderAuthMethod):revoke({ profileId, credential, config, signal }): revoke this sign-in's grant at the provider. Resolve when the grant is revoked or already invalid; throw anErrorwith a user-facing message when it may still be active.disconnectLabel(default Disconnect account),accountManagementUrl(HTTPS only) andaccountManagementLabel(default Manage connected apps).Gateway (existing owner
models-auth-status.ts, no new method):models.authStatusaddsoauthAccountActionsto providers with a saved OAuth/token sign-in, read from the loaded plugin registry. A status read never loads a plugin.models.authLogoutacceptsrevoke: truewith exactly oneprofileIdsentry. The Gateway calls the plugin'srevoke(30 s abort signal) and deletes the saved profile only after it resolves. If it throws, the profile is kept and the request fails withUNAVAILABLE:<provider message> The sign-in is still saved on this device.ModelsAuthLogoutParamsSchemagains the optionalrevoke: truefield. Additive, no protocol version change; no stored-row change. Themodels.auth*schemas move unchanged fromagents-models-skills.ts(at its 700-line cap) to a siblingschema/models-auth.ts; the protocol registry owner count goes from 76 to 77.Control UI (Models → Providers account row):
Couldn’t disconnect <account>with the provider's message and Try again. The account stays in the list.User Impact
revokeget a real disconnect; a refused revoke never shows as disconnected.Evidence
Gateway boundary tests (
models-auth-status.test.ts, 53 pass; protocol schema test acceptsrevoke: trueand rejectsrevoke: false): status advertises the plugin's actions; revoke runs before removal (order recorded); a failed revoke keeps the profile and returns the provider message.Control UI E2E on a real Gateway (
model-provider-disconnect.real-gateway.e2e.test.ts, dist-nodts build of this head): a syntheticacmeprovider plugin loaded throughplugins.load.paths, a seeded[email protected]OAuth profile and a local revoke endpoint. Light and dark: the row shows both actions and the link; with the endpoint returning 503 the toast shows the error and Try again, and the profile stays saved on disk. After the endpoint returns 200, Try again removes the account from the UI and from the persisted store. Every revoke request wasPOST,application/x-www-form-urlencoded,token=<refresh>.Screenshots (before = base
427900b2d539, after = this branch; syntheticacmeplugin,[email protected]): see the images attached below.Disconnect retry scope:
model-providers-page.removal.test.ts› retries a refused disconnect only for the agent that asked for it (red without the scope check, green with it; found by local review round 1).Other checks: touched UI unit suites (
profiles-view,view.provider-actions,data,model-providers-page.removal,model-providers-page.order,view): 110 pass.Defaults recorded
revoketakes one profile per request. Revoking several and removing only some would need a partial result shape; the UI never needs it.revoke; the manage link (with its label) comes from the first method with an HTTPSaccountManagementUrl. They may be different methods (local review round 2).control-ui-performancebudget:largest CSS gzip 57.3 KiB > 56.9 KiBand the chat boot JS budgets fail identically on the merge base427900b2d539(same 58,659 B shared-styles file); this PR does not change that file.