Skip to content

Chronicle: fold search_subagent trajectory into parent session#318491

Merged
digitarald merged 1 commit into
mainfrom
digitarald/fold-search-subagent-session
May 27, 2026
Merged

Chronicle: fold search_subagent trajectory into parent session#318491
digitarald merged 1 commit into
mainfrom
digitarald/fold-search-subagent-session

Conversation

@digitarald
Copy link
Copy Markdown
Contributor

Follow-up fix for #318463.

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, search subagent spans lacked PARENT_CHAT_SESSION_ID and were uploaded as independent cloud sessions instead of folding into the parent.

Same pattern as #318475 (which fixes execution_subagent).

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>
Copilot AI review requested due to automatic review settings May 27, 2026 02:32
@digitarald digitarald requested a review from vijayupadya May 27, 2026 02:33
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

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(
@digitarald digitarald merged commit 6516219 into main May 27, 2026
26 checks passed
@digitarald digitarald deleted the digitarald/fold-search-subagent-session branch May 27, 2026 04:41
@vs-code-engineering vs-code-engineering Bot added this to the 1.123.0 milestone May 27, 2026
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.

3 participants