Skip to content

Cannot cancel the browser OAuth wait on the MCP connect modal #5032

Description

@yh928

Summary

On the MCP connect modal (ConnectAuthModal), after starting browser OAuth ("Sign in with browser"), there is no way to cancel — the modal is stuck in "Waiting for sign-in…" until the poll times out, ~3 minutes later.

Problem

The browser-OAuth flow polls /oauth/mcp/callback for up to 3 minutes via a recursive setTimeout. During that wait the modal is busy, and every dismissal path — the Cancel button, and the backdrop click — is gated on busy. So a user who starts the sign-in and then abandons it in the browser (closes the tab, changes their mind, picks the wrong account) is trapped in the modal with no way out until the 180s timeout fires.

Starting the browser sign-in is not a committed action — it can be abandoned — so the wait should be abortable.

  • Platform: desktop.
  • File: app/src/components/channels/mcp/ConnectAuthModal.tsx.

Solution (optional)

Make the wait abortable: track the pending poll setTimeout and a "cancelled" flag so Cancel / backdrop can stop the pending tick and bail any in-flight request, reset busy/waiting, and drop the timer on unmount. Enable Cancel and backdrop-dismiss during the wait.

Acceptance criteria

  • Cancel (and backdrop click) close the modal while it is waiting on the OAuth sign-in
  • The pending poll stops and does not fire state updates after close/unmount
  • Idle-state dismissal behavior is unchanged
  • Diff coverage ≥ 80% — the fix meets the changed-lines coverage gate (Vitest, enforced by .github/workflows/ci-lite.yml).

Related

Fix is ready on the same fork branch as the custom-servers feature; the PR closes both.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions