fix(mcp): don't capture external Claude/Codex config errors as wizard exceptions#456
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(mcp): don't capture external Claude/Codex config errors as wizard exceptions#456posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
The wizard shelled out to `claude plugin install posthog` and treated any
non-zero exit as a wizard exception. When a user's pre-existing ~/.claude
plugins config has invalid `source` entries, Claude rejects the whole
command up front with `Invalid schema: plugins.N.source: Invalid input` —
nine distinct users tripped this in ~12 days, each one polluting error
tracking with a non-actionable signal.
Add an `isExternalClientConfigError` helper that matches the schema
rejection pattern, and guard the Claude/Codex install + remove paths so
those errors return `{ success: false }` quietly via `debug()` instead of
firing `analytics.captureException`. Genuine failures (timeouts, missing
binaries, etc.) still capture as before.
Also switches Codex `removeServer` from `stdio: 'ignore'` to capturing
stderr, so the same guard applies symmetrically.
Generated-By: PostHog Code
Task-Id: 514b43e3-f2f5-464e-bc69-eeaa48ae0061
🧙 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.
Summary
Nine distinct users tripped the same error tracking signal over ~12 days:
Claude Code plugin install failed: Invalid schema: plugins.N.source: Invalid input. The root cause is outside the wizard's scope — the user's pre-existing~/.claudeplugins config has invalidsourcefields on unrelated plugin entries, soclaude plugin install posthogis rejected before it ever touches PostHog. The wizard thencaptureException'd the failure as if it were a bug we should fix.This change adds a small detector (
isExternalClientConfigError) for that error shape and guards the four affected paths so they fail quietly viadebug()instead of polluting error tracking:ClaudeCodeMCPClient.installPluginClaudeCodeMCPClient.removeServerCodexMCPClient.installPluginCodexMCPClient.removeServer(also switched fromstdio: 'ignore'to capturing stderr, so the guard applies symmetrically)Genuine failures (timeouts, missing binaries, real wizard bugs) still capture as before. The wizard already degrades gracefully when an
installPluginreturns{ success: false }— the affected client simply doesn't appear in the McpScreen "installed for" list, so no UI plumbing was needed.Test plan
pnpm build— passespnpm test— 619/619 passing (one unrelated flaky test inprovision-clithat times out under full-suite load and passes in isolation; verified the flake is pre-existing by re-running with my changes stashed)pnpm lint— 0 errors (pre-existing warnings only)Created with PostHog Code