Skip to content

feat(models): split sign out on this device from disconnect account - #205759

Merged
obviyus merged 4 commits into
mainfrom
feat/provider-signout-disconnect
Nov 26, 2026
Merged

obviyus merged 4 commits into
mainfrom
feat/provider-signout-disconnect

Conversation

@obviyus

@obviyus obviyus commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

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 427900b2d539, 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 427900b2d539 (same 58,659 B shared-styles file); this PR does not change that file.

Before (light): one sign-out icon

Before (dark): one sign-out icon

After (light): Sign out on this device, Disconnect Acme Account, Manage connected apps

After (dark): Sign out on this device, Disconnect Acme Account, Manage connected apps

Revoke refused (light): sign-in kept, error with Try again

Revoke refused (dark): sign-in kept, error with Try again

obviyus and others added 3 commits November 26, 2026 09:55
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]>
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]>
@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts commands Command implementations size: L labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 36f44775315537ce8feba9fcfb92ab26d1a974e3
  • Maintainer: @obviyus
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/server-methods/models-auth-status.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-methods/models-auth-status.types.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. impact:security Security boundary, credential, authz, sandbox, or sensitive-data risk. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 26, 2026
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]>
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 26, 2026
@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds optional plugin-owned account revocation and management actions to Settings → Models.

Example: Disconnect the saved Acme account [email protected].

  • Before: Sign out deletes the Gateway’s saved credential while leaving the provider grant active.
  • After: Disconnect asks Acme to revoke the grant before removing the credential; a refusal preserves the account and offers Try again.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Source review found a coherent implementation, but required evidence for the complete network mutation remains incomplete.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Users cannot distinguish removing a saved Gateway sign-in from revoking OpenClaw’s access at the provider.
Reason: Maintainer authorship approves the direction, and an optional plugin capability provides the distinction without changing unsupported providers.

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: 36f44775315537ce8feba9fcfb92ab26d1a974e3

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Attach a redacted real-Gateway and revoke-endpoint trace showing refusal preserves the saved profile and successful retry removes it; redact tokens, IPs, and non-public endpoints.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Account sign-out and provider removal keeps the original intent (fix: remove configured providers from the Control UI #201317: Separate deleting provider configuration from removing saved credentials, keeping individual account sign-out credential-only.)
  • Models UI mutation presentation keeps the original intent (8127bab: Migrate model settings to Solid while preserving Gateway ownership, existing actions, routes, and selectors.)
  • Model-auth protocol schemas keeps the original intent (fix(protocol): declare model API-key editing contracts #148093: Provide canonical typed API-key editing contracts for clients and request validation; the schema move retains those definitions and public aggregate exports.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vyctor H. Brzezowski: Raw commit 37f6f4e adds ui/src/pages/model-providers/profiles-view.tsx:551 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: low; commits: 37f6f4ec7322; files: ui/src/pages/model-providers/profiles-view.tsx)

PR surface

Source +261, Tests +411, Docs +19, Other 0. Total +691 across 27 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 13 350 89 +261
Tests 11 420 9 +411
Docs 2 20 1 +19
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 2 0
Total 27 792 101 +691

Preflight source

Source 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

Metric Value Why it matters
Public contract additions 1 optional RPC parameter; 4 optional ProviderAuthMethod fields Revocation is opt-in, and existing plugin declarations and local sign-out requests remain valid.

Labels

Label changes:

No label changes.

Label justifications:

  • merge-risk: 🚨 compatibility: This PR extends the public provider-auth contract; the maintainer-directed design uses optional fields and preserves existing callers.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Supply the redacted runtime trace identified in the proof assessment.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 26, 2026, 12:24 AM ET / 05:24 UTC.

@obviyus

obviyus commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Maintainer override: checks-ui-e2e (7/10) is red on main too.

ci-triage 205759 (head 36f447753155)
checks-ui-e2e (7/10)  ui/src/e2e/meetings.e2e.test.ts  fails on main

@obviyus
obviyus merged commit 1a660f8 into main Nov 26, 2026
246 of 253 checks passed
@obviyus
obviyus deleted the feat/provider-signout-disconnect branch November 26, 2026 06:09
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 27, 2026
…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.

![Before (light): one sign-out icon](https://github.com/user-attachments/assets/df329a1d-4fea-4f90-8315-d7be7aa2eeba)

![Before (dark): one sign-out icon](https://github.com/user-attachments/assets/ebf96545-8e5e-43cd-8a5b-1b4a0c103a44)

![After (light): Sign out on this device, Disconnect Acme Account, Manage connected apps](https://github.com/user-attachments/assets/b11c9db3-baab-4f15-8f23-8dabf33ade60)

![After (dark): Sign out on this device, Disconnect Acme Account, Manage connected apps](https://github.com/user-attachments/assets/02c57271-3e98-4124-9c28-d487f4f68ead)

![Revoke refused (light): sign-in kept, error with Try again](https://github.com/user-attachments/assets/f336ee0b-d52d-44d5-9804-1dcb13a33837)

![Revoke refused (dark): sign-in kept, error with Try again](https://github.com/user-attachments/assets/953fe78e-1a78-4863-b404-005a68234e1c)

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. impact:security Security boundary, credential, authz, sandbox, or sensitive-data risk. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts security-sensitive-changed size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant