Skip to content

MCP: fix stale 'NOT WIRED YET' comment in src/mcp/telemetry.ts (superseded by #6237) #6617

Description

@JSONbored

Context

src/mcp/telemetry.ts (added by #6235) carries this comment block at the top of the file (lines 14-15):

// NOT WIRED YET: per #6235 this module is deliberately NOT called from the tool-dispatch path — that (and the
// client lifecycle/flush strategy a live Worker needs) is the separate instrumentation issue's job.

This is now factually incorrect. Issue #6237 ("feat(mcp): instrument the remote MCP tool-dispatch chokepoint with PostHog events"), closed via merged PR #6358, wired recordMcpToolCall into the actual dispatch path. src/mcp/server.ts:1673-1683 now defines recordMcpToolTelemetry(env, tool, ok, durationMs) — explicitly documented as "Single chokepoint for the #6228 PostHog tool-call telemetry (#6237): every tools/call request that reaches handleMcpRequest routes through here exactly once, whether it succeeds or throws" — and that function calls recordMcpToolCall(env, { tool, callerType: "remote", ok, durationMs }) directly (src/mcp/server.ts:1679).

So recordMcpToolCall — the exact function the stale comment says is "NOT called from the tool-dispatch path" — IS called from the tool-dispatch path, and has been since PR #6358 merged. The comment in src/mcp/telemetry.ts was written when #6235 landed (before #6237 existed) and was never updated once #6237 shipped, leaving stale/misleading guidance at the top of the file for anyone reading this specific module in isolation.

Requirements

Deliverables

Test Coverage Requirements

This is a comment-only change with no new branches or logic, so no new test is required. Run the existing test/unit/mcp-telemetry.test.ts and test/unit/mcp-server-telemetry.test.ts suites unchanged to confirm the file still behaves identically (they must continue to pass without modification). Do not add a test that merely asserts a comment string — that is not meaningful coverage.

Expected Outcome

A future reader of src/mcp/telemetry.ts in isolation sees accurate, current information about where and how recordMcpToolCall is invoked, instead of a claim that was true under #6235 but has been false since #6237 / PR #6358 merged.

Links & Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions