You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clear a server's OAuth state from a header icon (#3065) - #3091
You no longer have to open Settings → Authorization to clear a server's OAuth state. A Clear OAuth icon (TbBrandOauth, tooltip "Clear OAuth") now sits in the connected header's right-hand group, beside the Disconnect icon. Clicking it opens a Clear OAuth confirmation modal ("Are you sure? …"). Confirming runs the existing clear.
Same action as Connection Info. The header reuses handleClearConnectionOAuth, so it shares runClear's per-server in-flight guard, error toast and revoke-on-clear setting. What a clear does is unchanged, which the issue puts out of scope.
Shown only when the connected server has stored OAuth credentials. The gate is Connection Info's connectionInfoCanClearOAuth (connected, a live client, an HTTP transport), narrowed to a session whose stored OAuth state carries an access token. That is the same getOAuthState() read Connection Info displays. A server that never used OAuth shows no icon, and neither does a stdio session.
Confirmation first. The icon sits one slip away from Disconnect, so it asks first, which the Settings and Connection Info controls do not. The new ClearOAuthConfirmModal (in components/groups/) names the server. If the session ends while the prompt is open, the prompt is dropped. Its open state is reset during render, so a later session can't bring it back.
Docs: docs/mcp-server-configuration.md now mentions the header icon next to the Settings path.
Tests
ViewHeader.test.tsx covers:
the icon asks for confirmation before clearing
Cancel clears nothing
the icon sits beside Disconnect, in the same group
the icon is absent when no handler is passed
an open prompt is dropped when the clear stops being offered
ClearOAuthConfirmModal.test.tsx covers the closed and open states, confirm, and cancel.
New stories: ViewHeader/ConnectedWithOAuth, ClearOAuthConfirmModal/Open.
npm run local:gate passes.
Screenshots (1280×900, Chromium)
Connected to oauth-revocation-http.json after authorizing. The icon sits beside Disconnect:
Confirmation modal. Updated after #3100: the prompt now says the grant is also revoked at the authorization server before the session disconnects:
After confirming, the session disconnects and the "OAuth state cleared" toast appears:
Connected to a server with no OAuth (web-tabs-http.json). There is no icon:
Adds a Clear OAuth icon (TbBrandOauth, tooltip "Clear OAuth") to the
connected header's right-hand group, shown while connected over an HTTP
transport. It opens a "Clear OAuth" confirmation modal and, on confirm,
runs the same clear as Connection Info and Settings -> Authorization.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
…als (#3065)
Narrows the header icon's gate from "connected over HTTP" to a session
whose stored OAuth state (the same read Connection Info shows) carries an
access token, so a server that never used OAuth shows no icon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
Copilot round 1 was clean: no inline comments, no headline finding, and no suppressed comments. Since then, 2b78426 narrows the header icon to sessions with stored OAuth credentials, as the maintainer asked. Requesting another round for that change.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Stale OAuth state persists across server switches, allowing Clear OAuth to incorrectly clear and disconnect a non-OAuth server while its state is still loading.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Prevent stale OAuth state from appearing during session changes
clients/web/src/App.tsx:1907
After disconnecting from OAuth server A and connecting to non-OAuth HTTP server B, useOAuthRecovery exposes A's cached access token until B's asynchronous getOAuthState() finishes. This temporarily offers Clear OAuth for B, and confirming while that read is pending clears/disconnects B despite it having no stored credentials. Key the OAuth snapshot by client/session, return undefined until the current session's read completes, and add a regression test with B's read held pending.
The cached OAuth details outlived the session that read them, so a new
connection showed the previous session's access token until its own
getOAuthState() settled. With the header's Clear OAuth gated on that value,
the icon could be offered (and confirmed) for a server with nothing stored.
Key the snapshot by the client it was read through and read undefined
until the current client's read lands.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
Copilot round 2. It posted no inline comments and one finding in the body's previously missed block. That finding has no thread, so I'm answering it here.
Stale OAuth state across server switches (useOAuthRecovery / App.tsx). Fixed in f12a224.connectionInfoOAuth was cached without recording which session read it, so a new session showed the previous session's access token until its own getOAuthState() returned. The header icon is gated on that value, so this is a defect in what this PR added, not scope creep. The snapshot is now keyed by the InspectorClient it was read through, and it reads undefined until the current client's read lands. New regression test: hides the previous client's details until the new client's read settles. It holds the second client's read pending. local:gate passes.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because existing tests bypass the OAuth-clear visibility gate and App callback wiring, leaving credential-dependent visibility and active-server clearing behavior unverified.
Copilot review loop closed after round 3. Round 3 posted no inline comments, no suppressed comments and no open issues. Its headline only notes that the App.tsx wiring isn't unit-tested. App.tsx is the composition root that AGENTS.md documents as outside the coverage gate. The gate there is two terms (connectionInfoCanClearOAuth && connectionInfoOAuth?.accessToken). Both halves are covered where they're computed: useOAuthRecovery.test.tsx for the per-client snapshot and ViewHeader.test.tsx for the icon and confirmation. The screenshots above show both cases end to end. So round 3 counts as the clean round and the loop stops.
Rounds: 1 clean. 2 had one in-scope finding, fixed in f12a224. 3 clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3065
What changed
You no longer have to open Settings → Authorization to clear a server's OAuth state. A Clear OAuth icon (
TbBrandOauth, tooltip "Clear OAuth") now sits in the connected header's right-hand group, beside the Disconnect icon. Clicking it opens a Clear OAuth confirmation modal ("Are you sure? …"). Confirming runs the existing clear.handleClearConnectionOAuth, so it sharesrunClear's per-server in-flight guard, error toast and revoke-on-clear setting. What a clear does is unchanged, which the issue puts out of scope.connectionInfoCanClearOAuth(connected, a live client, an HTTP transport), narrowed to a session whose stored OAuth state carries an access token. That is the samegetOAuthState()read Connection Info displays. A server that never used OAuth shows no icon, and neither does a stdio session.ClearOAuthConfirmModal(incomponents/groups/) names the server. If the session ends while the prompt is open, the prompt is dropped. Its open state is reset during render, so a later session can't bring it back.docs/mcp-server-configuration.mdnow mentions the header icon next to the Settings path.Tests
ViewHeader.test.tsxcovers:ClearOAuthConfirmModal.test.tsxcovers the closed and open states, confirm, and cancel.ViewHeader/ConnectedWithOAuth,ClearOAuthConfirmModal/Open.npm run local:gatepasses.Screenshots (1280×900, Chromium)
Connected to
oauth-revocation-http.jsonafter authorizing. The icon sits beside Disconnect:Confirmation modal. Updated after #3100: the prompt now says the grant is also revoked at the authorization server before the session disconnects:
After confirming, the session disconnects and the "OAuth state cleared" toast appears:
Connected to a server with no OAuth (
web-tabs-http.json). There is no icon:🤖 Generated with Claude Code