Skip to content

Relay Copilot SDK GitHub events #324815

Draft
amunger wants to merge 1 commit into
mainfrom
aamunger/relaySDKTelemetry
Draft

Relay Copilot SDK GitHub events #324815
amunger wants to merge 1 commit into
mainfrom
aamunger/relaySDKTelemetry

Conversation

@amunger

@amunger amunger commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

use the new sdk event surface to relay events into vscode stores

Update @github/copilot-sdk to 1.0.6-preview.0, which adds the
onGitHubTelemetry connection-global callback. Wire it up via a dedicated
CopilotGitHubTelemetryForwarder that owns ITelemetryService and re-emits
each forwarded event through publicLog so they land in our cluster.
Restricted events are only forwarded when restricted telemetry is enabled
for the current Copilot token.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 7, 2026 18:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR wires the Copilot SDK's new connection-global onGitHubTelemetry callback into the agent host so that GitHub-shaped telemetry events emitted by the Copilot CLI runtime are re-emitted through VS Code's ITelemetryService. A new CopilotGitHubTelemetryForwarder maps each GitHubTelemetryNotification into an ITelemetryData payload (event properties/metrics, contextual metadata, optional client fields, and features) and publishes it as copilotCli/${event.kind}. Restricted/enhanced events are dropped unless the current Copilot token has opted into restricted telemetry (rt=1), reusing the existing _restrictedTelemetryEnabled state on CopilotAgent.

Changes:

  • Add CopilotGitHubTelemetryForwarder that translates SDK GitHub telemetry notifications into ITelemetryService.publicLog calls, gating restricted events on the rt opt-in.
  • Instantiate the forwarder in CopilotAgent via DI (passing a () => this._restrictedTelemetryEnabled getter) and pass onGitHubTelemetry into the SDK client options.
Show a summary per file
File Description
src/vs/platform/agentHost/node/copilot/copilotGitHubTelemetryForwarder.ts New forwarder class mapping SDK telemetry notifications to VS Code telemetry, with restricted-event gating.
src/vs/platform/agentHost/node/copilot/copilotAgent.ts Imports the SDK notification type, creates the forwarder, and hooks onGitHubTelemetry into the Copilot client options.

Notes for the reviewer: the SDK type (@github/copilot-sdk) is not installed in this checkout, so the snake_case event.* field references could not be verified locally and rely on the TypeScript type check. Additionally, restricted/enhanced events (which may carry richer content) are routed through the standard publicLog path rather than the dedicated restricted-table sink used elsewhere in the agent host — this appears intentional per the class doc, but is a privacy-sensitive routing decision worth a human look.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment on lines +26 to +31
forward(notification: GitHubTelemetryNotification): void {
// The runtime marks enhanced/restricted events which must only be routed
// to first-party Microsoft stores and only when the user has opted in.
if (notification.restricted && !this._isRestrictedTelemetryEnabled()) {
return;
}
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.

2 participants