Skip to content

Forward CAPI assignment context to core telemetry via internal command#327375

Open
jul-stevenson wants to merge 2 commits into
mainfrom
jul-stevenson/capi-flights-internal-command
Open

Forward CAPI assignment context to core telemetry via internal command#327375
jul-stevenson wants to merge 2 commits into
mainfrom
jul-stevenson/capi-flights-internal-command

Conversation

@jul-stevenson

Copy link
Copy Markdown
Contributor

New functionality related to issue reported in issue https://github.com/microsoft/vscode-internalbacklog/issues/5964#issuecomment-4127382406

Register a private _telemetry.setExperimentProperty command in the workbench that calls ITelemetryService.setExperimentProperty(). The Copilot extension calls this command when it receives CAPI flight assignments, so they appear on all core telemetry events from the current window (same scope as abexp.assignmentcontext).

Validation:
Manual validation done via examining raw telemetry

2026-07-24 15:35:54.134 [trace] [Telemetry (Not Sent)] telemetry/editorActionInvoked {"properties":{"name":"Find Next","id":"editor.action.nextMatchFindAction","capi.assignmentcontext":"e4hcf520:1109203;61623843:1255491;03fe5655:1267115;2350j567:1255909;","common.machineId":"e7225a67c...

Register a private '_telemetry.setExperimentProperty' command in the
workbench that calls ITelemetryService.setExperimentProperty(). The
Copilot extension calls this command when it receives CAPI flight
assignments, so they appear on all core telemetry events from the
current window (same scope as TAS abexp.assignmentcontext).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 24, 2026 20:16

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

Forwards Copilot CAPI flight assignments into core VS Code telemetry.

Changes:

  • Registers an internal telemetry command.
  • Forwards assignment context from both Copilot telemetry paths.
  • Extends the chat library telemetry sender interface.
Show a summary per file
File Description
mainThreadTelemetry.ts Registers the core telemetry bridge.
telemetryServiceImpl.ts Invokes the bridge for CAPI assignments.
chatLibMain.ts Propagates assignments through chat library senders.

Review details

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

Comment on lines +63 to +64
CommandsRegistry.registerCommand('_telemetry.setExperimentProperty', function (accessor, name: string, value: string) {
accessor.get(ITelemetryService).setExperimentProperty(name, value);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in bdfa0cf. I replaced the generic command with a narrowed _telemetry.setCapiAssignmentContext command, hard-coded the telemetry property name to capi.assignmentcontext, and added format/size validation (key:value entries separated by ;, control chars rejected, capped at 8KB) before calling setExperimentProperty. The Copilot side now only sends the assignment-context value to this narrowed command.

- Replace generic _telemetry.setExperimentProperty bridge with
  _telemetry.setCapiAssignmentContext
- Hardcode capi.assignmentcontext as the only settable property
- Validate assignment-context format and size before trusting input
- Update Copilot forwarding call to use the narrowed command

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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