Open
Conversation
Contributor
There was a problem hiding this comment.
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
parentToolCallIdtoIChatRequestTelemetryPropertiesand include it in model-call telemetry events. - Plumb
parentToolCallIdfrom tool invocation (chatStreamToolCallId) into the search/execution subagent request telemetry. - Ensure
headerRequestIdis always populated by falling back to the client-generated request id when headers don’t includex-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. |
roblourens
reviewed
Apr 4, 2026
|
|
||
| const modelRequestId = getRequestId(connection.responseHeaders); | ||
| // Preserve ourRequestId as headerRequestId if the server didn't echo x-request-id | ||
| modelRequestId.headerRequestId = modelRequestId.headerRequestId || ourRequestId; |
Member
There was a problem hiding this comment.
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
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.
Add persistent headerRequestId and parentToolCallId to the search and execute subagent telemetry for better tracking.