You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(web): fix inflated MCP DAU by threading user identity through tool telemetry
captureEvent() relies on tryGetPostHogDistinctId() which reads cookies,
session, or API key headers. In the MCP server and ask agent contexts,
none of these are available, so every tool_used event got a random
distinct_id — inflating DAU counts (e.g., 8 tool calls = 8 "users").
Fix: add optional distinctId to ToolContext and captureEvent(). Thread
user.id from the auth context through:
- MCP route → createMcpServer(userId) → ToolContext.distinctId
- chat route / askCodebase → createMessageStream(distinctId) →
createAgentStream → createTools
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments