[codex] fix MCP OAuth popup close handling#735
Merged
RhysSullivan merged 6 commits intomainfrom May 9, 2026
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-cloud | 2e02d19 | May 09 2026, 07:51 AM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-marketing | 2e02d19 | Commit Preview URL Branch Preview URL |
May 09 2026, 07:51 AM |
@executor-js/cli
@executor-js/config
@executor-js/execution
@executor-js/sdk
@executor-js/storage-core
@executor-js/codemode-core
@executor-js/runtime-quickjs
@executor-js/plugin-file-secrets
@executor-js/plugin-google-discovery
@executor-js/plugin-graphql
@executor-js/plugin-keychain
@executor-js/plugin-mcp
@executor-js/plugin-onepassword
@executor-js/plugin-openapi
executor
commit: |
…rors The MCP detect path required RFC 9728/8414 OAuth metadata to confirm a 401 Bearer challenge was MCP, which rejected real servers that authenticate with static API keys (e.g. cubic.dev/api/mcp). Replace the OAuth gate with a JSON-RPC envelope check on the probe response: the body shape is what separates real MCP from unrelated OAuth-protected APIs (Railway-style GraphQL, etc.). Add a low-confidence URL-token fallback so non-canonical endpoints (e.g. servers that omit WWW-Authenticate entirely, like ref.tools) and unreachable hosts still surface as candidates when the path/host includes the protocol token. Replace the technical "Endpoint does not look like an MCP server: 401 without Bearer WWW-Authenticate" copy with actionable user-facing messages keyed on a new `category` discriminant (auth-required vs wrong-shape vs unreachable).
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes MCP OAuth popup handling for providers such as Sentry that can make a live cross-origin popup appear closed to the opener.
closedPollMs: null.popup.closedfires, result listeners stay active for a later callback.popup_closed_before_completeas a handled frontend warning so Sentry captures the signal with popup/session/provider metadata.popup.closedfires; only explicit cancel, callback completion/error, or TTL cleanup should end the session.Root Cause
The MCP OAuth UI cancelled the pending OAuth session as soon as
popup.closedread true. COOP redirects can make a live popup look closed to the opener, so the server deleted the OAuth session and the later callback failed withOAuthSessionNotFoundError. The previous hardening kept the server session alive but still removed frontend result listeners on close; this now keeps those listeners active and reports the advisory close to Sentry.Reference Notes
oidc-client-tstreats popup close as possibly “closed by user or isolated by redirect” and makes abort-on-close configurable.closePopup: false.Validation
bun run --cwd packages/react test src/api/oauth-popup.test.tsbun run --cwd packages/react typecheckbunx oxlint -c .oxlintrc.jsonc packages/react/src/api/oauth-popup.ts packages/react/src/api/oauth-popup.test.ts packages/react/src/plugins/oauth-sign-in.tsx packages/plugins/mcp/src/react/AddMcpSource.tsx packages/plugins/mcp/src/react/McpSignInButton.tsxbunx oxfmt --check packages/react/src/api/oauth-popup.ts packages/react/src/api/oauth-popup.test.ts packages/react/src/plugins/oauth-sign-in.tsx packages/plugins/mcp/src/react/AddMcpSource.tsx packages/plugins/mcp/src/react/McpSignInButton.tsx