Skip to content

Commit 1392847

Browse files
authored
Chronicle: fold execution_subagent trajectory into parent session (#318475)
1 parent bdaf044 commit 1392847

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { ChatFetchResponseType } from '../../../platform/chat/common/commonTypes
99
import { ConfigKey, IConfigurationService } from '../../../platform/configuration/common/configurationService';
1010
import { CapturingToken } from '../../../platform/requestLogger/common/capturingToken';
1111
import { IRequestLogger } from '../../../platform/requestLogger/common/requestLogger';
12+
import { getCurrentCapturingToken } from '../../../platform/requestLogger/node/requestLogger';
1213
import { IExperimentationService } from '../../../platform/telemetry/common/nullExperimentationService';
1314
import { ChatResponseStreamImpl } from '../../../util/common/chatResponseStreamImpl';
1415
import { generateUuid } from '../../../util/vs/base/common/uuid';
@@ -81,11 +82,17 @@ class ExecutionSubagentTool implements ICopilotTool<IExecutionSubagentParams> {
8182
// Create a new capturing token to group this execution subagent and all its nested tool calls
8283
// Similar to how DefaultIntentRequestHandler does it
8384
// Pass the subAgentInvocationId so the trajectory uses this ID for explicit linking
85+
const parentChatSessionId = getCurrentCapturingToken()?.chatSessionId;
8486
const executionSubagentToken = new CapturingToken(
8587
`Execution: ${options.input.query.substring(0, 50)}${options.input.query.length > 50 ? '...' : ''}`,
8688
'execution',
8789
subAgentInvocationId,
88-
'execution' // subAgentName for trajectory tracking
90+
'execution', // subAgentName for trajectory tracking
91+
// Use invocation ID as chatSessionId so spans get their own log file
92+
subAgentInvocationId,
93+
// Link back to the parent session for debug log grouping and cloud session folding
94+
parentChatSessionId,
95+
'executionSubagent',
8996
);
9097

9198
// Wrap the loop execution in captureInvocation with the new token

0 commit comments

Comments
 (0)