Skip to content

Commit 3864a2b

Browse files
fix(server): Claude subagent results drop Claude Code's tools-used note (#30069)
Recent Claude Code versions open a foreground Agent tool result with a <tools-used-before-summary> note for the parent model. The adapter stored it as the subagent's result, so the subagent row and the child thread's final message showed it. Strip that leading note when reading the result. AI-assisted; verified with the tests and tools listed above.
1 parent 5fb90c5 commit 3864a2b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3579,7 +3579,15 @@ function claudeCommandOutputText(output: ClaudeNativeToolOutput): string {
35793579
return claudeNativeToolOutputText(output);
35803580
}
35813581

3582+
// Claude Code prefixes foreground Agent results with a note for the parent model, not the report.
3583+
const CLAUDE_TOOLS_USED_NOTE =
3584+
/^\s*<tools-used-before-summary>[^<]*<\/tools-used-before-summary>\s*/;
3585+
35823586
function claudeSubagentResultText(output: ClaudeNativeToolOutput): string {
3587+
return claudeSubagentRawResultText(output).replace(CLAUDE_TOOLS_USED_NOTE, "");
3588+
}
3589+
3590+
function claudeSubagentRawResultText(output: ClaudeNativeToolOutput): string {
35833591
const value = claudeNativeToolOutputValue(output);
35843592
const content = Array.isArray(value)
35853593
? value

0 commit comments

Comments
 (0)