The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 21:00 UTC
fix(server): Claude subagent results drop Claude Code's tools-used note (#34821)
Julius Marminge committed
Nov 11, 2026 at 23:39 UTC
ff599f0bef9c09398e6a08f03073426825c33e64
2 files changed
+30
-6
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
+22
-6
@@ -18160,7 +18160,26 @@ describe("ClaudeAdapterV2 background wake turns", () => {
18160
),
18161
);
18162
18163
- it.effect("extracts text from direct content-block subagent results", () =>
18163
+ it.effect.each([
18164
+ {
18165
+ label: "extracts text from direct content-block subagent results",
18166
+ content: [
18167
+ { type: "text", text: "First line." },
18168
+ { type: "text", text: "Second line." },
18169
+ ],
18170
+ expected: "First line.\nSecond line.",
18171
+ },
18172
+ {
18173
+ label: "drops Claude Code's tools-used note from a subagent result",
18174
+ content: [
18175
+ {
18176
+ type: "text",
18177
+ text: "<tools-used-before-summary>Read</tools-used-before-summary>\n\nadd (line 1)\nmean (line 6)",
18178
+ },
18179
+ ],
18180
+ expected: "add (line 1)\nmean (line 6)",
18181
+ },
18182
+ ])("$label", ({ content, expected }) =>
18183
Effect.scoped(
18184
Effect.gen(function* () {
18185
const SUBAGENT_TASK_ID = "task-direct-content-blocks";
@@ -18214,10 +18233,7 @@ describe("ClaudeAdapterV2 background wake turns", () => {
18233
{
18234
type: "tool_result",
18235
tool_use_id: SUBAGENT_TOOL_USE_ID,
18217
- content: [
18218
- { type: "text", text: "First line." },
18219
- { type: "text", text: "Second line." },
18220
- ],
18236
+ content,
18237
},
18238
],
18239
},
@@ -18228,7 +18244,7 @@ describe("ClaudeAdapterV2 background wake turns", () => {
18244
);
18245
yield* harness.until(() => subagentEvents().at(-1)?.subagent.status === "completed");
18246
18231
- assert.equal(subagentEvents().at(-1)?.subagent.result, "First line.\nSecond line.");
18247
+ assert.equal(subagentEvents().at(-1)?.subagent.result, expected);
18248
18249
yield* Queue.offer(
18250
harness.sdkMessages,
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
+8
@@ -3593,7 +3593,15 @@ function claudeCommandOutputText(output: ClaudeNativeToolOutput): string {
3593
return claudeNativeToolOutputText(output);
3594
}
3595
3596
+// Claude Code prefixes foreground Agent results with a note for the parent model, not the report.
3597
+const CLAUDE_TOOLS_USED_NOTE =
3598
+ /^\s*<tools-used-before-summary>[^<]*<\/tools-used-before-summary>\s*/;
3599
+
3600
function claudeSubagentResultText(output: ClaudeNativeToolOutput): string {
3601
+ return claudeSubagentRawResultText(output).replace(CLAUDE_TOOLS_USED_NOTE, "");
3602
+}
3603
+
3604
+function claudeSubagentRawResultText(output: ClaudeNativeToolOutput): string {
3605
const value = claudeNativeToolOutputValue(output);
3606
const content = Array.isArray(value)
3607
? value