Repository navigation
feat(mcp-analytics): define how SDKs derive $mcp_error_status - #212
Merged
Merged
Conversation
$mcp_error_status was a MAY with no derivation, so only PostHog's own server set it and every external SDK failure grouped as "unknown" in the failure views. Pin one rule: walk the cause chain from the thrown error inward and take the first integer 100-599 from status_code, statusCode or status on the error or its response. A caller's explicit value wins. Stays a MAY; posthog-python and posthog-js implement it next (posthog-python#1223). Tested: openspec validate mcp-analytics --type spec --strict (no errors; existing length warnings only).
Pre-PR review showed a chain built on read never ends. 50 matches the $exception_list bound the SDKs already apply.
This was referenced Nov 11, 2026
feat(mcp): set $mcp_error_status from the raised exception's cause chain
PostHog/posthog-python#1229
Merged
dustinbyrne
approved these changes
Nov 11, 2026
lucasheriques
added a commit
that referenced
this pull request
Nov 12, 2026
What: resolve the three conflicts in openspec/specs/mcp-analytics/spec.md and resync the archived delta with the merged requirement. - Configuration table: keep the error message capture row, drop the payload personal data row (main removed that option). - Failure capture: keep the option-off paragraph, reworded because Payload privacy no longer applies the personal data pass to error messages; take main's $mcp_error_status derivation rules. - Scenarios: keep both the option-off scenario and main's HTTP status one. - Archived change: MODIFIED Failure capture delta now mirrors the merged requirement; proposal and design no longer claim a personal data pass on error messages. Why: #192 conflicted with main after #212 and the payload personal data removal. #184's content is not part of this PR and is not depended on. Tested: openspec validate --specs --strict --no-interactive with @fission-ai/openspec@1.4.1 (CI's version): 69 passed, 0 failed. Unarchived changes check: none outside openspec/changes/archive.
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.
Why
MCP Analytics groups failed tool calls by
$mcp_error_status, but only PostHog's own MCP server sets it, so every failure from a server using the SDKs lands in "unknown". The spec lists the property as aMAYwith no derivation, so two SDKs could put different numbers on the same failure. Rootly asked for it in PostHog/posthog-python#1223.What changes
Failure capture.
$mcp_error_statusstays aMAY. An SDK that derives it from a thrown error follows one rule:__cause__, else__context__unless__suppress_context__. JavaScript followscause.status_code,statusCode,status, first on the error, then on itsresponse.One new scenario. The Property reference row now says integer, 100 to 599.
PostHog's own server reads
statusoff its API error found throughcause, so its values already fit the rule.Implementations
posthog.mcp@posthog/mcpValidation
openspec validate mcp-analytics --type spec --strictreports no errors (existing length warnings only). The acceptance feature is unchanged until the harness has a step binding (tasks 4.3).