Skip to content

Yemohyle/subagent telem#4916

Open
yemohyleyemohyle wants to merge 11 commits intomicrosoft:mainfrom
yemohyleyemohyle:yemohyle/subagent_telem
Open

Yemohyle/subagent telem#4916
yemohyleyemohyle wants to merge 11 commits intomicrosoft:mainfrom
yemohyleyemohyle:yemohyle/subagent_telem

Conversation

@yemohyleyemohyle
Copy link
Copy Markdown
Contributor

Add persistent headerRequestId and parentToolCallId to the search and execute subagent telemetry for better tracking.

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 improves telemetry correlation for search/execution subagent runs by (1) persisting a usable headerRequestId even when the service doesn’t echo x-request-id, and (2) propagating parentToolCallId so subagent model calls can be linked back to the parent agent tool invocation.

Changes:

  • Add parentToolCallId to IChatRequestTelemetryProperties and include it in model-call telemetry events.
  • Plumb parentToolCallId from tool invocation (chatStreamToolCallId) into the search/execution subagent request telemetry.
  • Ensure headerRequestId is always populated by falling back to the client-generated request id when headers don’t include x-request-id.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/platform/networking/node/chatStream.ts Includes parentToolCallId in per-model-call telemetry so subagent calls can be linked to the invoking tool call.
src/platform/networking/common/networking.ts Extends request telemetry properties with parentToolCallId.
src/extension/tools/vscode-node/toolsService.ts Broadens the span-context storage behavior to cover subagent tools beyond only runSubagent.
src/extension/tools/node/searchSubagentTool.ts Passes the parent tool call id into the search subagent loop options.
src/extension/tools/node/executionSubagentTool.ts Passes the parent tool call id into the execution subagent loop options.
src/extension/prompt/node/searchSubagentToolCallingLoop.ts Adds requestId and parentToolCallId to subagent chat-request telemetry properties.
src/extension/prompt/node/executionSubagentToolCallingLoop.ts Adds requestId and parentToolCallId to subagent chat-request telemetry properties.
src/extension/prompt/node/chatMLFetcher.ts Persists headerRequestId by setting it up-front and falling back to the client request id when the response header is missing.

@sbatten sbatten assigned bhavyaus and unassigned benvillalobos Apr 2, 2026

const modelRequestId = getRequestId(connection.responseHeaders);
// Preserve ourRequestId as headerRequestId if the server didn't echo x-request-id
modelRequestId.headerRequestId = modelRequestId.headerRequestId || ourRequestId;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the impact of using modelRequestId.headerRequestId though? It's confusing when we use that vs our ID and I don't want to mess up this telemetry

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.

6 participants