editTelemetry: unify long-term edit source tracking#326403
Draft
amunger wants to merge 1 commit into
Draft
Conversation
Track local model and Agent Host file edits in one canonical per-resource stream for editSources.details. Deduplicate reload observations, reconcile current disk content, preserve existing focus-window, stats, and ARC paths, and forward Copilot Agent Host rows through the existing GitHub channel. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Unifies long-term edit-source telemetry for local model and Agent Host file edits through a canonical per-resource stream.
Changes:
- Adds Agent Host snapshot ingestion, reconciliation, and deduplication.
- Projects unified transitions through the existing edit tracker.
- Adds shared telemetry emission and comprehensive unit coverage.
Show a summary per file
| File | Description |
|---|---|
src/vs/editor/common/textModelEditSource.ts |
Adds origin and harness metadata. |
src/vs/workbench/contrib/editTelemetry/browser/helpers/unifiedDocumentAdapters.ts |
Adapts model and agent edits. |
src/vs/workbench/contrib/editTelemetry/browser/helpers/unifiedDocumentReconciler.ts |
Reconciles edit observations. |
src/vs/workbench/contrib/editTelemetry/browser/helpers/unifiedDocumentRegistry.ts |
Manages canonical resource state. |
src/vs/workbench/contrib/editTelemetry/browser/telemetry/agentHostEditSourceTracking.ts |
Ingests Agent Host file edits. |
src/vs/workbench/contrib/editTelemetry/browser/telemetry/editSourceTelemetry.ts |
Centralizes telemetry emission. |
src/vs/workbench/contrib/editTelemetry/browser/telemetry/editSourceTrackingFeature.ts |
Wires unified tracking services. |
src/vs/workbench/contrib/editTelemetry/browser/telemetry/editSourceTrackingImpl.ts |
Routes long-term local telemetry. |
src/vs/workbench/contrib/editTelemetry/browser/telemetry/editTracker.ts |
Exposes pending-external-edit application. |
src/vs/workbench/contrib/editTelemetry/browser/telemetry/unifiedDocumentTrackerProjection.ts |
Projects canonical transitions. |
src/vs/workbench/contrib/editTelemetry/browser/telemetry/unifiedEditSourceTracking.ts |
Owns streams and telemetry windows. |
src/vs/workbench/contrib/editTelemetry/test/browser/agentHostEditSourceTracking.test.ts |
Tests Agent Host file tracking. |
src/vs/workbench/contrib/editTelemetry/test/browser/editSourceTrackingImpl.test.ts |
Updates constructor setup. |
src/vs/workbench/contrib/editTelemetry/test/browser/editTelemetry.test.ts |
Updates constructor setup. |
src/vs/workbench/contrib/editTelemetry/test/browser/unifiedDocumentAdapters.test.ts |
Tests adapter behavior. |
src/vs/workbench/contrib/editTelemetry/test/browser/unifiedDocumentReconciler.test.ts |
Tests reconciliation scenarios. |
src/vs/workbench/contrib/editTelemetry/test/browser/unifiedDocumentRegistry.test.ts |
Tests registry identity and transfer. |
src/vs/workbench/contrib/editTelemetry/test/browser/unifiedDocumentTrackerProjection.test.ts |
Tests tracker projection. |
src/vs/workbench/contrib/editTelemetry/test/browser/unifiedEditSourceTracking.test.ts |
Tests end-to-end unified telemetry. |
Review details
- Files reviewed: 19/19 changed files
- Comments generated: 4
- Review effort level: Medium
Comment on lines
+87
to
+88
| const edit = await computeDiff(transition.before, transition.after); | ||
| document.apply(edit, transition.source); |
Comment on lines
+296
to
+298
| const transition = this._createTransition(before, after, source, kind, correlation, agentKind); | ||
| this._transitions.push(transition); | ||
| return { kind: 'append', transition: { ...transition } }; |
Comment on lines
+93
to
+99
| if (result.transferResult) { | ||
| if (edit.previousResource) { | ||
| this._lastResults.delete(this._key(edit.previousResource)); | ||
| this._transferResourceState(edit.previousResource, edit.resource); | ||
| } | ||
| this._recordResult(result.transferResult); | ||
| } |
Comment on lines
+228
to
+236
| this._unifiedTracking.applyAgentEdit({ | ||
| resource, | ||
| previousResource: beforeResource, | ||
| before: beforeText, | ||
| after: afterText, | ||
| source, | ||
| correlation: `${session.toString()}:${toolCallId}:${contentIndex}`, | ||
| kind: normalized.kind, | ||
| }); |
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.
closes https://github.com/microsoft/vscode-internalbacklog/issues/8467
Overview
What
Unifies long-term
editTelemetry.editSources.detailstracking for local text-model edits and Agent Host file edits in one workbench-owned per-resource stream. Agent HostChatToolCallCompletefile snapshots are normalized, deduplicated against matchingreloadFromDiskobservations, reconciled with current disk content, and projected through the existingDocumentEditSourceTrackermechanics. The event kind and existing local source fields remain unchanged; Agent Host source rows addorigin=agentHostand the canonical provider inharness. Copilot Agent Host rows continue through the existing GitHub edit-telemetry channel.Follow-up work will evaluate moving
10minFocusWindowand20minFocusWindowdetails,editSources.stats, and ARC to the canonical stream. Those existing local paths are deliberately unchanged in this PR.Why
Tracked in https://github.com/microsoft/vscode-internalbacklog/issues/8247. SDK-driven Agent Host edits occur on disk without passing through
ITextModel, so the existing long-term tracker cannot attribute their inserted and retained characters. This restores commit/branch survival analysis for Agent Host edits while preventing duplicate attribution when an open editor later observes the same disk change.Property-by-property parity
Legend: ✅ = exact / verbatim match, ≈ = close analogue, ⊗ = omitted.
modelongtermsourceKeyTextModelEditSource.toKey(1)Chat.applyEditsplusoriginandharnessmetadatasourceKeyCleanedextensionIdextensionVersionmodelIdtriggerlanguageIdstatsUuidconversationIdrequestIdoriginagentHostharnesscopilotcli,claude,codex)Measurement-by-measurement parity
modifiedCountdeltaModifiedCounttotalModifiedCountRow-count and dashboard implications
statsUuidgroup as local sources for that resource.origin == "agentHost"and split providers withharness.Chat.applyEditsseries containingoriginandharness.Semantic-shift ledger
languageIdconversationIdrequestIdsourceKey