Repository navigation
agentHost: retain Copilot identity for edit-survival telemetry - #345691
Merged
Merged
Conversation
Capture the originating account tracking ID for file tools and preserve it in host edit-source state until delayed telemetry emission. Keep different accounts separate without exposing identity in protocol markers or source keys. Fixes microsoft/vscode-internalbacklog#10569 Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change preserving originating account identity in edit-survival telemetry.
No open issues 🎉
What changed in this PR
This PR preserves the originating Copilot account identity in Agent Host edit-survival telemetry, so delayed commit reporting remains correctly attributed after an account switch.
Changes:
- Captures the tracking ID at tool start from the root turn or spawning subagent and carries it through edit tracking.
- Keeps account-specific statistics separate and emits the captured ID without adding it to protocol data or source-key strings.
- Adds regression coverage for account changes, delayed and retried flushes, missing IDs, and non-Copilot providers.
Live telemetry ingestion remains unvalidated until deployment.
| File | Description |
|---|---|
src/vs/platform/agentHost/test/node/fileEditTracker.test.ts |
Verifies tracking-ID forwarding to edit attribution. |
src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts |
Tests account capture across root, peer, and subagent tool execution. |
src/vs/platform/agentHost/test/node/agentEditAttributionService.test.ts |
Tests delayed attribution, flush retries, identity omission, and protocol exclusion. |
src/vs/platform/agentHost/node/shared/fileEditTracker.ts |
Passes the captured identity into attribution records. |
src/vs/platform/agentHost/node/shared/agentEditAttributionService.ts |
Separates statistics by account and emits the retained tracking ID. |
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts |
Captures identity at tool start and forwards it at completion. |
src/vs/platform/agentHost/common/fileEditAttribution.ts |
Adds the optional host-only tracking ID to the attribution interface. |
Review effort: Balanced
Preserve both account-isolation regressions and the new upstream attribution helper. Add the Bravo-requested regression assertion for account capture on Fusion phase edits. Co-authored-by: Copilot <[email protected]>
Aaron Munger (amunger)
marked this pull request as ready for review
November 3, 2026 18:13
Bhavya U (bhavyaus)
approved these changes
Nov 3, 2026
This was referenced Nov 5, 2026
Aaron Munger (amunger)
added a commit
that referenced
this pull request
Nov 5, 2026
* agentHost: retain Copilot identity for edit-survival telemetry (#345691) Capture the originating account tracking ID for file tools and preserve it in host edit-source state until delayed telemetry emission. Keep different accounts separate without exposing identity in protocol markers or source keys. Fixes microsoft/vscode-internalbacklog#10569 Co-authored-by: Copilot <[email protected]> * Bump version to 1.145.1 Update Copilot Chat's VS Code engine requirement while retaining its 0.73.0 package version. Co-authored-by: Copilot <[email protected]> * Revert "Bump version to 1.145.1" This reverts commit 2dac9e3. * test: bound and retry apt in the WSL smoke setup (#345598) * test: bound and retry apt in the WSL smoke setup The Azure Ubuntu mirror usually serves the WSL smoke packages in 2-17 seconds, but a connection to it can fail or crawl for minutes. apt has no minimum transfer speed, so a crawling download ran past the 300 second command timeout (2 PR CI failures in 48h), and apt-get update only warns when it can't fetch the indexes, so the install then failed to find docker.io (main CI 491631). Bound the index update (now failing on any fetch error) and the package download, and retry each on fresh connections. A retried download resumes partial files. Co-authored-by: Copilot <[email protected]> * test: allow a slow mirror to finish the WSL smoke apt download across attempts This PR's own CI hit the slow case: the indexes came at 8 MB/s, but packages came at about 250 KB/s on every connection, so fresh connections alone don't help. Each bounded attempt keeps completed packages and resumes the partial one, so allow 5 download attempts and a 720 second budget for the step. Co-authored-by: Copilot <[email protected]> * test: let a slow but progressing WSL smoke apt download use the whole budget Instead of a hard per-attempt wall clock, which restarted a download that was progressing at about 250 KB/s, fail only a connection that stops sending data (Acquire::http::Timeout 30) and retry the download on error. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Bryan Chen <[email protected]>
Aaron Munger (amunger)
added a commit
that referenced
this pull request
Nov 9, 2026
…346295) * agentHost: preserve account identity across discovery cache expiry Keep the tracking ID in the existing credential-scoped cell independently of endpoint and SKU freshness. Preserve identity on transient discovery failures while retaining authoritative replacement and invalidation behavior. Follow-up to #345691. Co-authored-by: Copilot <[email protected]> * agentHost: preserve identity provenance through refresh failures Keep the last published CAPI client separately from expiring discovery data so delayed credential rejection invalidates the correct account context without clearing newer discovery. Retain known identity even before a telemetry reader is captured. Co-authored-by: Copilot <[email protected]> --------- 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes microsoft/vscode-internalbacklog#10569.
What and why
Copilot Agent Host commit-survival records now carry the originating account's
common.copilotTrackingId, allowing tracking-ID-based analytics to admit and attribute those records. The issue's audit found the field missing from all qualifying records.Capture the resolved tracking ID when the file tool starts, using the root turn or spawning subagent's account context, and retain it with the host's edit-source statistics until emission. If the user switches accounts before the commit, the earlier edit remains attributed to its original account rather than the account active at flush time.
Sources with different captured account IDs remain separate within the same reporting group. The existing telemetry helper supplies the common property; the ID is not included in protocol markers, flush responses, source-key strings, or persisted file snapshots. Missing IDs remain omitted, and other providers do not inherit Copilot identity.
How to test
The focused regression selection covers account changes during tools, root/peer/subagent dispatch, delayed standalone Git and client-coordinated commit flushes, cancelled/retried flushes, missing identity, non-Copilot providers, and protocol-data exclusion.
Result after merging main: 76 passing.
Bravo review identified a missing identity assertion on the distinct Fusion-phase routing branch. The existing fixture now switches the exposed account between tool start and completion and verifies the originating ID:
Result: 1 passing.
Manual OSS validation
On November 3, launched the merged full Code OSS Agents build in an isolated profile, signed in to Copilot, and used its built-in
edittool in a disposable repository. Real Git commits triggeredhashChangereporting; no synthetic event injection or production probes were used.pendingtocompleted, then commitagentHost.turnCompletedcompletedtoverified; overwrite withXXXXXXXXbefore commitBoth
editTelemetry.editSources.detailsrows hadorigin=agentHost,provider=copilotcli,mode=longterm, andtrigger=hashChange. Public source keys did not contain the tracking ID. No matching attribution errors appeared in the run's logs.The live test used one account; account switching and subagents are covered by regression tests rather than live multi-account exercises. OSS telemetry was logging-only, so deployed ingestion and downstream scorecard inclusion still require post-deployment verification.