Skip to content

feat(telemetry): add auth_success, mcp_connect, and mcp_oauth events - #1206

Closed
TheGreatAxios wants to merge 3 commits into
mainfrom
cl-9017-telemetry-auth-mcp
Closed

TheGreatAxios wants to merge 3 commits into
mainfrom
cl-9017-telemetry-auth-mcp

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Enum-only product telemetry for provider sign-in and MCP outcomes.

  • auth_success carries auth_provider (codex|xai|anthropic|other) and fires once on /connect completion via connectProviderInline; cancelled flows and failed submits stay silent.
  • mcp_connect carries transport (stdio|http) plus result (ok|auth|timeout|fail), one per server in connectMCPServers; server name, URL, and error text never leave the process.
  • mcp_oauth carries result (completed|cancelled|timeout), exactly one per browser attempt around the browser wait in driveRecovery; abort maps to cancelled, every other failure to timeout.
  • All three ride the existing allowlist + kill-switch path and always ship like auth_failure; stripping and kill-switch coverage in tests/unit/telemetry-product-events.test.ts.

mcp_connect wiring map (singular path is the live one):

  • Singular connectMCPServer (src/mcp/client.ts) now captures one mcp_connect {transport, result} per outward connection outcome via options.telemetry, using the existing classifyMcpConnectOutcome + isHttpServer discriminator. Internal HTTP auth-recovery re-dials stay inside connectHttp, so exactly one event fires per call; no new classifier, no new props.
  • Toolset path (src/agent/tools.ts publicConnectMCPServer) threads args.telemetry into the singular connect; exec (src/exec/runner.ts) and TUI (src/tui/runner/session.ts) runners supply liveTelemetry, so prod connects emit.
  • Web-search path (src/tools/web-search.ts) passes getTelemetry() into the singular connect, so lazy provider connects emit.
  • tui/runner/mcp.ts: N/A — no direct mcp/client.js call; late/persisted connects go through services.toolset.connectMCPServer and ride the toolset path above.
  • connectMCPServers (batch): intentional no-emit — it delegates to the singular connect (which captures), so its own emit was removed to keep exactly-once; zero prod callers, kept for tests.

Fixes CL-9017

@linear-code

linear-code Bot commented Sep 28, 2026

Copy link
Copy Markdown

CL-9017

…nial

Prod MCP connects never received a telemetry handle, so mcp_oauth
stayed silent outside tests; the browser-auth attempt cap also threw
before a flow existed, skipping the instrumented recovery path. The
toolset now forwards its telemetry to each connect and web-search
uses the ambient singleton, and the cap throw emits a terminal
timeout like every other non-abort browser-wait end.
@TheGreatAxios

Copy link
Copy Markdown
Collaborator Author

Closing as telemetry-only: does not improve operator-facing output, and the PR is not CI-green + trivial after the 0333 merge wave. Reopen if product telemetry is prioritized separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant