Summary
The subagent gate in responsesApi.ts uses subType?.startsWith('subagent'), which never matches in practice. Producers set subType to 'execution_subagent' and 'search_subagent', so the check evaluates to false for every real subagent request.
Where
extensions/copilot/src/platform/endpoint/node/responsesApi.ts:69
const isAllowedConversationAgent = options.location === ChatLocation.Agent || options.location === ChatLocation.MessagesProxy;
const isSubagent = options.telemetryProperties?.subType?.startsWith('subagent') ?? false;
const shouldDeferTools = toolSearchEnabled && isAllowedConversationAgent && !isSubagent;
Why it's wrong
The producers emit:
| File |
Value |
extension/prompt/node/executionSubagentToolCallingLoop.ts:366 |
'execution_subagent' |
extension/prompt/node/searchSubagentToolCallingLoop.ts:172 |
'search_subagent' |
Commit 5e01ed5de06 ("rename agent type so it doesn't get redacted") renamed the values from subagent/execution and subagent/search to put subagent as a suffix rather than a prefix. The detection in responsesApi.ts was not updated to match, so shouldDeferTools ends up true for subagent runs even though the gate is supposed to exclude them.
Impact
Client-executed tool search defers tools for subagent requests today, contrary to the comment / gate intent. Behavior may or may not be desirable — needs a product call — but at minimum the code does not match the apparent design.
Suggested fix
const isSubagent = options.telemetryProperties?.subType?.includes('subagent') ?? false;
includes matches both current names (execution_subagent, search_subagent) and stays robust if new subagent types like explore_subagent are added later. Same fix was applied to the new extended-cache-ttl gate in messagesApi.ts (PR / branch dev/bhavyau/anthropic-extended-cache-ttl).
Optionally, extract a tiny shared helper near subType?: string in extensions/copilot/src/platform/networking/common/networking.ts so both API paths stay in sync.
Acceptance
cc @bhavyaus — found while implementing the Anthropic extended cache TTL gate.
Summary
The subagent gate in
responsesApi.tsusessubType?.startsWith('subagent'), which never matches in practice. Producers setsubTypeto'execution_subagent'and'search_subagent', so the check evaluates tofalsefor every real subagent request.Where
extensions/copilot/src/platform/endpoint/node/responsesApi.ts:69Why it's wrong
The producers emit:
extension/prompt/node/executionSubagentToolCallingLoop.ts:366'execution_subagent'extension/prompt/node/searchSubagentToolCallingLoop.ts:172'search_subagent'Commit
5e01ed5de06("rename agent type so it doesn't get redacted") renamed the values fromsubagent/executionandsubagent/searchto putsubagentas a suffix rather than a prefix. The detection inresponsesApi.tswas not updated to match, soshouldDeferToolsends uptruefor subagent runs even though the gate is supposed to exclude them.Impact
Client-executed tool search defers tools for subagent requests today, contrary to the comment / gate intent. Behavior may or may not be desirable — needs a product call — but at minimum the code does not match the apparent design.
Suggested fix
includesmatches both current names (execution_subagent,search_subagent) and stays robust if new subagent types likeexplore_subagentare added later. Same fix was applied to the new extended-cache-ttl gate inmessagesApi.ts(PR / branchdev/bhavyau/anthropic-extended-cache-ttl).Optionally, extract a tiny shared helper near
subType?: stringinextensions/copilot/src/platform/networking/common/networking.tsso both API paths stay in sync.Acceptance
responsesApi.tscorrectly identifiesexecution_subagentandsearch_subagentrequests as subagentscc @bhavyaus — found while implementing the Anthropic extended cache TTL gate.