Relay Copilot SDK GitHub events #324815
Conversation
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>
There was a problem hiding this comment.
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
CopilotGitHubTelemetryForwarderthat translates SDK GitHub telemetry notifications intoITelemetryService.publicLogcalls, gating restricted events on thertopt-in. - Instantiate the forwarder in
CopilotAgentvia DI (passing a() => this._restrictedTelemetryEnabledgetter) and passonGitHubTelemetryinto 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
| 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; | ||
| } |
use the new sdk event surface to relay events into vscode stores