Skip to content

Commit 6516219

Browse files
digitaraldCopilot
andauthored
Chronicle: fold search_subagent trajectory into parent session (#318491)
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>
1 parent 2e9dc7f commit 6516219

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

extensions/copilot/src/extension/tools/node/searchSubagentTool.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,15 @@ class SearchSubagentTool implements ICopilotTool<ISearchSubagentParams> {
141141
// Create a new capturing token to group this search subagent and all its nested tool calls
142142
// Similar to how DefaultIntentRequestHandler does it
143143
// Pass the subAgentInvocationId so the trajectory uses this ID for explicit linking
144-
const parentChatSessionId = getCurrentCapturingToken()?.chatSessionId;
144+
const parentChatSessionId = getCurrentCapturingToken()?.chatSessionId ?? parentSessionId;
145145
const searchSubagentToken = new CapturingToken(
146146
`Search: ${options.input.query.substring(0, 50)}${options.input.query.length > 50 ? '...' : ''}`,
147147
'search',
148148
subAgentInvocationId,
149149
'search', // subAgentName for trajectory tracking
150150
// Use invocation ID as chatSessionId so spans get their own log file
151151
subAgentInvocationId,
152-
// Link back to the parent session for debug log grouping
152+
// Link back to the parent session for debug log grouping and cloud session folding
153153
parentChatSessionId,
154154
'searchSubagent',
155155
);

0 commit comments

Comments
 (0)