improvement(mcp): let users re-open OAuth authorization anytime#5809
Conversation
A server stuck on 'OAuth Authorization required' had no discoverable way to re-trigger the auth popup once it was closed or abandoned: the connect button lived only in the server detail view and hard-disabled while 'Connecting…', a state cleared by polling popup.closed (unreliable under COOP), so it could stay locked until the 10-minute safety timeout. - Add an 'Authorize'/'Reopen authorization' action to the server list row menu for unconnected OAuth servers, so re-auth is reachable without drilling in. - Make the detail-view button always clickable (reopens a fresh popup) instead of locking on an unverifiable 'Connecting…' state.
PR SummaryLow Risk Overview Settings UI: Unconnected OAuth servers get Authorize / Reopen authorization in the list row
Adds Vitest coverage for double-start prevention, reopen-after-settle, query invalidation, and failed-reopen with a live prior flow. Reviewed by Cursor Bugbot for commit 778a534. Configure here. |
Greptile SummaryThis PR makes MCP OAuth authorization available again after a popup is closed or abandoned. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (5): Last reviewed commit: "refactor(mcp): make OAuth connecting sta..." | Re-trigger Greptile |
Now that the connect button stays clickable, block re-entry while the /oauth/start request is in flight; cleared once it settles so a later reopen still starts a fresh flow.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
…e new flow Addresses a stale-poll race: an abandoned attempt's popup.closed interval could fire mid-reopen and clear 'Connecting…' for the fresh flow.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c261cf5. Configure here.
… its poll Drop the previous attempt's pending-flow map entry and safety timeout up front too, so a late BroadcastChannel result (settleFlow) can't clear the reopened flow's connecting state during the new /oauth/start await.
|
@cursor review |
Reworks reopen concurrency so a superseded or failed reopen can't lose a real authorization: - Retire the prior flow only after the replacement /oauth/start succeeds; a failed reopen keeps it so its popup can still complete and be honored. - Guard the connecting-clear (settleFlow + popup poll) behind the in-flight start set, so a stale settle can't flicker the reopened flow's label. - Invalidate server queries on already_authorized so the UI reflects a server that authorized out from under the client. Adds a test for the already_authorized invalidation.
|
@cursor review |
…e counting Replaces the scattered, race-prone stopConnecting/set-based tracking with a per-server attempt count: each start increments once and clears exactly once (fail, already_authorized, settle, or supersede), so the 'Connecting…' / 'Reopen authorization' label can never get stuck or flicker across concurrent reopens. Retire prior flows whenever a replacement start succeeds (including already_authorized); a failed reopen keeps the prior flow so it can still complete. Drops the unreliable popup.closed poll entirely — the label already invites reopening and the safety timeout guarantees clearing. Adds a test for the failed-reopen-preserves-prior-flow case.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 778a534. Configure here.
Summary
popup.closed, which is unreliable under COOP (Gauge and many auth pages set it), so it could stay locked until the 10-minute safety timeout.⋯menu for unconnected OAuth servers, so re-auth is reachable without drilling into Details.Type of Change
Testing
Type-checks and biome clean. Manual: an OAuth server that needs auth now offers Authorize/Reopen from both the list menu and the detail button, and re-clicking after closing the popup opens a fresh window.
Checklist