fix(mcp): stop Codex MCP install hanging on OAuth callback - #1002
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(mcp): stop Codex MCP install hanging on OAuth callback#1002posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
`codex mcp add --url` falls into Codex's own interactive OAuth flow when no bearer token is supplied. In the non-interactive wizard run that browser handshake never completes, so the timeout-less spawnSync blocks until Codex's OAuth deadline elapses, then surfaces a captured "deadline has elapsed" error. - Skip the add entirely when no API key is available (that path is the only one that triggers OAuth), logging how to add it manually instead. - Bound every codex subprocess with a timeout so it can never hang, and treat a timeout/spawn failure as a graceful skip rather than a captured exception. Generated-By: PostHog Code Task-Id: 643a8483-17ac-418e-832a-8be6cd67da2a
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
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.
Problem
Users setting up the wizard with Codex installed hit a long hang and a captured error.
CodexMCPClient.addServershells out tocodex mcp add --url <url>via a timeout-lessspawnSyncand only passes--bearer-token-env-varwhen an API key is present — which is often undefined. With no bearer token, Codex falls into its own interactive OAuth flow against the remote MCP server, can't complete the browser handshake in a non-interactive run, and blocks until its OAuth deadline elapses, surfacingtimed out waiting for OAuth callback / deadline has elapsed.This has been hitting the onboarding flow steadily for weeks across many distinct users. It doesn't crash the wizard (
addServerreturnssuccess: false), but the user sits through a long hang, the exception is captured as error-tracking noise, and the Codex MCP server silently isn't installed.Changes
codex mcp addat all — that's the only path that falls into interactive browser OAuth. Log how to add it manually and return gracefully.result.error, incl.ETIMEDOUT) as a graceful skip with a diagnostic rather than a captured exception.Note: this addresses the wizard-side Codex install hang only. The separate
OAuthAuthorize"Redirecting…" spinner-without-timeout issue lives in the main webapp, not this repo.Test plan
pnpm test— 1558 passing, including newaddServercases covering the no-api-key skip (no shell-out, no captured exception) and the timeout path (gracefulsuccess: false, no captured exception).pnpm lint— 0 errors.Created with PostHog Desktop from this inbox report.