Initial AI-based research revealed a possible race condition that could cause the spamming behavior observed on the MCP server. Further investigation is required to confirm/deny and fix this issue.
AI Findings (to be verified):
There's a race condition in telemetry.ts that causes telemetry events to be sent multiple times (spammed). Root Cause: The emitEvents() method calls emit() without awaiting it (fire-and-forget pattern). When multiple tool calls happen in quick succession: 1. Each emit() call grabs all cached events from the cache 2. Before any emit() completes and removes its cached events, other concurrent emit() calls also grab the same cached events 3. All concurrent calls send the same cached events to the server 4. Result: cached events are sent multiple times