Skip to content

fix(mcp): keep caller errors out of Sentry and tag what remains - #516

Merged
dodeja merged 1 commit into
mainfrom
claude/sentry-triage-fixes-6bfhu1
Nov 15, 2026
Merged

dodeja merged 1 commit into
mainfrom
claude/sentry-triage-fixes-6bfhu1

Conversation

@dodeja

@dodeja dodeja commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Summary

mcp-server sent every failed tool call to Sentry under one generic message, so unrelated errors merged into a few large issues.

  • Caller errors are no longer reported:

    • 400, 403, 404, 409, 410 and 422 responses;
    • ToolInputError, ContainerCheckDigitError and TrackContainerError;
    • a 401 on a credential the caller supplied (api_key, agent).

    These cover MCP-SERVER-F. MCP-SERVER-M and J were already fixed by fix(mcp): keep tracking validation out of exception reporting #457 and have had no events since.

  • Still reported:

    • a 401 on a token the gateway produced itself (user, shared_token);
    • 429, 408 and 5xx responses;
    • network errors, timeouts and errors with no status.
  • Reports now carry tags error.class, upstream.status_code, mcp.tool and mcp.credential_type, plus a fingerprint built from class and status. The message stays generic, so no upstream text or tokens are sent. Responses to clients are unchanged.

Open bug (not fixed here): MCP-SERVER-G

The API rejects tokens that the gateway resolves for a WorkOS user, about every 30 to 90 minutes. search_container fails with a 401, and then whoami fails with a 401 too. The gateway forwards the token correctly (auth_source: workos_mcp, credential_type: user), so the cause is between /v2/connected-clients/resolve and the V2 authenticator in tnt-api. Next step: check api_auth.rejection in the API logs around 2026-11-15 03:55 UTC.

Testing

vp run check passes, vp run --filter @terminal49/mcp test passes (998 tests), and npm run agent-verify passes.


Generated by Claude Code


Prove it works
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Every tool failure that was not a track_container rejection reached Sentry,
so an invalid key, a 404 and an SDK input check each raised an exception
event. They all carried one fixed message and stack, so Sentry also merged
unrelated failures (MCP-SERVER-F held both ValidationError and NotFoundError).

A tool failure now stays out of Sentry when the caller can fix it: a
ContainerCheckDigitError, TrackContainerError or ToolInputError from any
tool, or a Terminal49 answer of 400, 403, 404, 409, 410 or 422. A 401 counts
only for a credential the caller supplied (api_key, agent). The gateway
resolves user credentials and configures the shared token itself, so a 401
for those is a gateway/API disagreement and is still reported. The client
response and the mcp.tool.error log line are unchanged.

Reported failures keep the fixed message and now carry error.class,
upstream.status_code, mcp.tool and mcp.credential_type tags, with a
fingerprint of class and status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V8cPhjxmTweWGCzzfxM9ys
@vercel

vercel Bot commented Nov 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
api Ready Ready Preview Nov 15, 2026 5:37am UTC

Request Review

@github-actions github-actions Bot added the risk-shadow:high Shadow-only risk signal: high label Nov 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Shadow risk calibration

Signal Result Authority
Path classifier risk:high Deterministic advisory policy
heuristic fallback risk-shadow:high Shadow only

Calibration result: agreement.

Shadow risk never blocks or enables merge. Keep it in observation mode until roughly 50 pull requests have human-reviewed labels, then calibrate before considering any policy use.

@github-actions github-actions Bot added risk:unknown Advisory evidence unavailable or changed; no merge permission risk:high Advisory path risk; current-head human review needed and removed risk:unknown Advisory evidence unavailable or changed; no merge permission labels Nov 15, 2026
@dodeja
dodeja marked this pull request as ready for review November 15, 2026 22:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T22:50:52.272384Z 1d5bdd5 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dodeja
dodeja merged commit f0e6d68 into main Nov 15, 2026
33 checks passed
@dodeja
dodeja deleted the claude/sentry-triage-fixes-6bfhu1 branch November 15, 2026 23:33

This branch was successfully deployed

1 active deployment
Preview — 1d5bdd53 Deployed Nov 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high Advisory path risk; current-head human review needed risk-shadow:high Shadow-only risk signal: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants