Repository navigation
agentHost: Attribute telemetry to initiating window - #327417
Merged
roblourens merged 5 commits intoJul 25, 2026
Merged
Conversation
Identify editor and Agents window AHP clients and propagate the initiating client type onto existing Agent Host and Copilot CTS telemetry. Preserve attribution for queued turns and reconnect with a fresh initialize when the host no longer remembers the client.\n\n(Written by Copilot) Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds per-interaction “initiating window” attribution by propagating client identity (clientInfo) through Agent Host protocol initialization/reconnect and decorating existing telemetry with initiatorClientType.
Changes:
- Introduces
agentHostClientInfoutilities and threadsclientInfothrough local/remote/tunnel/WSL/SSH protocol clients and sessions. - Persists
clientInfoon the protocol server across reconnects, derivesAgentHostClientType, and forwards it through action dispatch + queued-message consumption. - Extends Agent Host + CTS/GitHub telemetry routing to include
initiatorClientType, plus reconnect fallback to re-initializewhen the server forgets the client.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/services/agentHost/test/browser/editorRemoteAgentHostServiceClient.test.ts | Asserts RemoteAgentHostProtocolClient is created with editor-window client info. |
| src/vs/workbench/services/agentHost/electron-browser/agentHostService.ts | Passes correct clientInfo when creating the local agent host client. |
| src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.ts | Supplies clientInfo to remote protocol client based on sessions vs editor window. |
| src/vs/sessions/sessions.web.main.ts | Registers agents-window remote agent host service implementation. |
| src/vs/sessions/sessions.desktop.main.ts | Registers agents-window remote agent host service and removes legacy remote service import. |
| src/vs/sessions/contrib/providers/remoteAgentHost/electron-browser/tunnelAgentHostServiceImpl.ts | Identifies tunnel protocol clients as agents-window clients. |
| src/vs/sessions/contrib/providers/remoteAgentHost/browser/webTunnelAgentHostService.ts | Identifies web tunnel protocol clients as agents-window clients. |
| src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts | Adds reconnect/not-found + client attribution across reconnect test coverage. |
| src/vs/platform/agentHost/test/node/mockAgent.ts | Extends mock agent messaging to carry clientType for assertions. |
| src/vs/platform/agentHost/test/node/agentSideEffects.test.ts | Verifies clientId/clientType forwarding + queued-message attribution + telemetry prop. |
| src/vs/platform/agentHost/test/node/agentHostTelemetryReporter.test.ts | Updates telemetry reporter tests for initiatorClientType on restricted events. |
| src/vs/platform/agentHost/test/node/agentHostGitHubTelemetryRouter.test.ts | Verifies additional properties are merged into routed GitHub telemetry. |
| src/vs/platform/agentHost/test/electron-browser/remoteAgentHostService.test.ts | Ensures protocol clients get correct clientInfo for editor vs agents window. |
| src/vs/platform/agentHost/test/electron-browser/remoteAgentHostProtocolClient.test.ts | Covers initialize including clientInfo and reconnect NotFound fallback to initialize. |
| src/vs/platform/agentHost/node/protocolServerHandler.ts | Stores clientInfo, rejects unknown reconnects, and attributes dispatched actions by client type. |
| src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts | Persists per-turn clientType for telemetry attribution. |
| src/vs/platform/agentHost/node/copilot/copilotAgent.ts | Routes GitHub telemetry with added initiatorClientType derived from current turn. |
| src/vs/platform/agentHost/node/agentSideEffects.ts | Threads clientType through action handling, queued messages, and agent send calls. |
| src/vs/platform/agentHost/node/agentService.ts | Propagates clientType into side effects and clears queued-message sender attribution on disposal. |
| src/vs/platform/agentHost/node/agentHostTelemetryReporter.ts | Adds initiatorClientType to public + restricted telemetry payloads. |
| src/vs/platform/agentHost/node/agentHostGitHubTelemetryRouter.ts | Allows routing with additional merged telemetry properties. |
| src/vs/platform/agentHost/electron-browser/wslRemoteAgentHostServiceImpl.ts | Tags WSL protocol clients with agents-window client info. |
| src/vs/platform/agentHost/electron-browser/sshRemoteAgentHostServiceImpl.ts | Tags SSH protocol clients with agents-window client info. |
| src/vs/platform/agentHost/electron-browser/localAgentHostService.ts | Requires clientInfo and passes it into the protocol client handshake. |
| src/vs/platform/agentHost/common/agentService.ts | Updates agent service interfaces to accept optional clientType. |
| src/vs/platform/agentHost/common/agentHostClientInfo.ts | New helper defining client-info constants + AgentHostClientType mapping. |
| src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.ts | Adds an agents-window subclass to supply clientInfo into protocol clients. |
| src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.ts | Sends clientInfo on initialize and falls back to initialize after reconnect NotFound. |
Review details
- Files reviewed: 28/28 changed files
- Comments generated: 3
- Review effort level: Low
Share initialize-result application, index Copilot SDK sessions for constant-time telemetry attribution, and clarify the protocol server test parameter.\n\n(Written by Copilot) Co-authored-by: Copilot <[email protected]>
Resolve the Copilot agent conflict by preserving the telemetry client lookup alongside the new model refresh scheduler.\n\n(Written by Copilot) Co-authored-by: Copilot <[email protected]>
Document the root AHP session ownership map separately from the flat SDK session telemetry index.\n\n(Written by Copilot) Co-authored-by: Copilot <[email protected]>
roblourens
marked this pull request as ready for review
July 25, 2026 18:45
roblourens
enabled auto-merge (squash)
July 25, 2026 18:45
Vijay Upadya (vijayupadya)
approved these changes
Jul 25, 2026
Anthony Kim (anthonykim1)
pushed a commit
that referenced
this pull request
Jul 26, 2026
* agentHost: Attribute telemetry to initiating window Identify editor and Agents window AHP clients and propagate the initiating client type onto existing Agent Host and Copilot CTS telemetry. Preserve attribution for queued turns and reconnect with a fresh initialize when the host no longer remembers the client.\n\n(Written by Copilot) Co-authored-by: Copilot <[email protected]> * agentHost: Address telemetry attribution feedback Share initialize-result application, index Copilot SDK sessions for constant-time telemetry attribution, and clarify the protocol server test parameter.\n\n(Written by Copilot) Co-authored-by: Copilot <[email protected]> * agentHost: Clarify Copilot session maps Document the root AHP session ownership map separately from the flat SDK session telemetry index.\n\n(Written by Copilot) Co-authored-by: Copilot <[email protected]> * tweak names --------- Co-authored-by: Copilot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
initialize.clientInfoinitiatorClientTypeWhy
An Agent Host process and session can be shared by multiple VS Code windows. Session identity and process-wide common properties therefore cannot reliably identify which window initiated a turn. This adds per-interaction attribution without introducing a new telemetry event.
Validation
npm run typecheck-clientnpm run valid-layers-checkReview notes
Please pay particular attention to the existing CTS event property name, SDK telemetry callback routing, queued-message attribution lifetime, and reconnect fallback behavior.
(Written by Copilot)