Chronicle: fold search_subagent trajectory into parent session#318491
Merged
Conversation
Ensures the search subagent's parentChatSessionId is always set by falling back to the conversation's sessionId when the capturing token's chatSessionId is unavailable. Without this fallback the search subagent spans lacked PARENT_CHAT_SESSION_ID and were uploaded as independent cloud sessions instead of folding into the parent. Follow-up fix for #318463. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Chronicle session folding for the search_subagent by ensuring parentChatSessionId is always populated, falling back to the conversation’s sessionId when the current capturing token lacks a chatSessionId. This prevents search subagent spans from being uploaded as independent cloud sessions.
Changes:
- Add fallback logic for
parentChatSessionId(capturingToken.chatSessionId ?? parentSessionId). - Clarify comment to reflect both debug log grouping and cloud session folding.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/tools/node/searchSubagentTool.ts | Ensures search_subagent spans consistently link back to the parent session for Chronicle folding. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
Comment on lines
141
to
145
| // Create a new capturing token to group this search subagent and all its nested tool calls | ||
| // Similar to how DefaultIntentRequestHandler does it | ||
| // Pass the subAgentInvocationId so the trajectory uses this ID for explicit linking | ||
| const parentChatSessionId = getCurrentCapturingToken()?.chatSessionId; | ||
| const parentChatSessionId = getCurrentCapturingToken()?.chatSessionId ?? parentSessionId; | ||
| const searchSubagentToken = new CapturingToken( |
vijayupadya
approved these changes
May 27, 2026
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.
Follow-up fix for #318463.
Ensures the search subagent's
parentChatSessionIdis always set by falling back to the conversation'ssessionIdwhen the capturing token'schatSessionIdis unavailable. Without this fallback, search subagent spans lackedPARENT_CHAT_SESSION_IDand were uploaded as independent cloud sessions instead of folding into the parent.Same pattern as #318475 (which fixes execution_subagent).