Skip to content

Yemohyle/add to ext telemetrey#313159

Merged
roblourens merged 27 commits intomicrosoft:mainfrom
yemohyleyemohyle:yemohyle/add_to_ext_telemetrey
May 1, 2026
Merged

Yemohyle/add to ext telemetrey#313159
roblourens merged 27 commits intomicrosoft:mainfrom
yemohyleyemohyle:yemohyle/add_to_ext_telemetrey

Conversation

@yemohyleyemohyle
Copy link
Copy Markdown
Contributor

@yemohyleyemohyle yemohyleyemohyle commented Apr 29, 2026

New fields in VSCodeExt telemetry event response.success:

modelCallId -- unique ID for this model call (surfaced from the fetcher)
subType -- "subagent/search" / "subagent/search" / absent
parentRequestId -- parent's requestId (enables child.parentRequestId = parent.requestId joins)
parentModelCallId -- parent's modelCallId (links to exact model call that spawned subagent)
iterationNumber -- 0-based tool-calling loop iteration

New fields in VSCode internal telemetry event model.modelCall.input/output:

parentModelCallId -- parent's modelCallId
iterationNumber -- 0-based tool-calling loop iteration

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends Copilot extension and internal model-call telemetry to better correlate subagent requests and tool-calling iterations by propagating a modelCallId plus new parent/iteration linking fields through the request/response pipeline.

Changes:

  • Adds modelCallId to successful fetch results and forwards it into response.success telemetry.
  • Propagates parentModelCallId and iterationNumber through tool-calling loops and subagent tool invocations.
  • Enriches internal model.modelCall.input/output telemetry with parentModelCallId and iterationNumber.
Show a summary per file
File Description
extensions/copilot/src/platform/networking/node/chatStream.ts Adds parentModelCallId and iterationNumber to internal model.modelCall.* telemetry events.
extensions/copilot/src/platform/networking/common/networking.ts Extends IChatRequestTelemetryProperties with parentModelCallId and iterationNumber.
extensions/copilot/src/platform/chat/common/commonTypes.ts Adds optional modelCallId to success fetch results.
extensions/copilot/src/extension/tools/node/searchSubagentTool.ts Passes parentModelCallId into subagent invocation telemetry context.
extensions/copilot/src/extension/tools/node/executionSubagentTool.ts Passes parentModelCallId into subagent invocation telemetry context.
extensions/copilot/src/extension/prompt/node/searchSubagentToolCallingLoop.ts Threads parentModelCallId and iterationNumber into subagent requests’ telemetry properties.
extensions/copilot/src/extension/prompt/node/executionSubagentToolCallingLoop.ts Threads parentModelCallId and iterationNumber into subagent requests’ telemetry properties.
extensions/copilot/src/extension/prompt/node/defaultIntentRequestHandler.ts Adds iterationNumber to main request telemetry properties.
extensions/copilot/src/extension/prompt/node/chatMLFetcherTelemetry.ts Adds new response.success telemetry fields (including modelCallId, parent linking, iteration).
extensions/copilot/src/extension/prompt/common/intents.ts Extends prompt context to carry parentModelCallId for downstream subagent tools.
extensions/copilot/src/extension/intents/node/toolCallingLoop.ts Tracks last headerRequestId and modelCallId from successful fetches and passes them via prompt context; threads iterationNumber through fetch options.

Copilot's findings

  • Files reviewed: 12/12 changed files
  • Comments generated: 3

Comment thread extensions/copilot/src/extension/intents/node/toolCallingLoop.ts Outdated
Comment on lines +171 to +175
modelCallId,
...(baseTelemetry?.properties.subType ? { subType: baseTelemetry.properties.subType } : {}),
...(baseTelemetry?.properties.parentHeaderRequestId ? { parentRequestId: baseTelemetry.properties.parentHeaderRequestId } : {}),
...(baseTelemetry?.properties.parentModelCallId ? { parentModelCallId: baseTelemetry.properties.parentModelCallId } : {}),
...(baseTelemetry?.properties.iterationNumber ? { iterationNumber: baseTelemetry.properties.iterationNumber } : {}),
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

PR description says response.success.subType should be one of "subagent" / "system-initiated" / absent, but this code forwards baseTelemetry.properties.subType verbatim. Existing callers set more specific values like subagent/search and subagent/execution, which will now surface in response.success and may violate the intended schema. If the event needs a stable, low-cardinality enum, consider normalizing here (e.g. map any subagent/* to subagent).

Copilot uses AI. Check for mistakes.
Comment on lines +1407 to 1414
// Store the server-echoed headerRequestId from the fetch response for subagent telemetry linking.
// Prefer serverRequestId (the server's x-request-id response header) because it matches
// chatCompletion.requestId.headerRequestId which is reported as `requestId` in response.success.
// Fall back to requestId (client-generated UUID) if the server didn't echo the header.
if (fetchResult.type === ChatFetchResponseType.Success) {
this.lastHeaderRequestId = fetchResult.requestId;
this.lastHeaderRequestId = fetchResult.serverRequestId ?? fetchResult.requestId;
this.lastModelCallId = fetchResult.modelCallId;
}
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

The new propagation/storage of lastModelCallId and the revised parent header request id selection are not covered by existing ToolCallingLoop unit tests. Adding a focused test that runs two iterations and asserts that createPromptContext() exposes parentHeaderRequestId/parentModelCallId from the previous successful fetch (including the fallback behavior) would help prevent regressions in subagent telemetry linking.

Copilot uses AI. Check for mistakes.
@yemohyleyemohyle yemohyleyemohyle force-pushed the yemohyle/add_to_ext_telemetrey branch from 774d100 to 681fab1 Compare April 30, 2026 00:07
@roblourens roblourens enabled auto-merge (squash) May 1, 2026 20:38
@roblourens roblourens merged commit 7bf921d into microsoft:main May 1, 2026
26 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.119.0 milestone May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants