Skip to content

Commit bc1f54b

Browse files
cameroncookeclaude
andcommitted
fix(sentry): Exclude peer anomalies from shutdown summary level escalation
Peer anomalies (peer-count-high, peer-age-high) are environmental observations common in multi-client setups, not indicators of a problem with the shutting-down process. Exclude them from the level escalation logic so normal shutdowns emit at info instead of warning. Peer anomaly data is still captured in the event snapshot extra data and tracked independently via recordMcpLifecycleAnomalyMetric. Only process-local anomalies (high-rss, long-lived-high-rss) and cleanup failures now escalate to warning. Fixes XCODEBUILDMCP-Z Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f996fb2 commit bc1f54b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/utils/sentry.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,10 @@ export function captureMcpShutdownSummary(summary: McpShutdownSummaryEvent): voi
402402

403403
try {
404404
const snapshotAnomalies = (summary.snapshot as { anomalies?: unknown }).anomalies;
405-
const anomalyCount = Array.isArray(snapshotAnomalies) ? snapshotAnomalies.length : 0;
405+
const PEER_ANOMALIES: ReadonlySet<string> = new Set(['peer-count-high', 'peer-age-high']);
406+
const localAnomalyCount = Array.isArray(snapshotAnomalies)
407+
? snapshotAnomalies.filter((a) => typeof a === 'string' && !PEER_ANOMALIES.has(a)).length
408+
: 0;
406409

407410
const isCrashReason =
408411
summary.reason === 'startup-failure' ||
@@ -412,7 +415,7 @@ export function captureMcpShutdownSummary(summary: McpShutdownSummaryEvent): voi
412415
let level: 'error' | 'warning' | 'info';
413416
if (isCrashReason) {
414417
level = 'error';
415-
} else if (summary.cleanupFailureCount > 0 || anomalyCount > 0) {
418+
} else if (summary.cleanupFailureCount > 0 || localAnomalyCount > 0) {
416419
level = 'warning';
417420
} else {
418421
level = 'info';

0 commit comments

Comments
 (0)