fix: Task tool subagent spawn and isolated block labels (#561)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-01-15 22:39:53 -08:00
committed by GitHub
parent 4e8f99497c
commit c9fab34706
5 changed files with 50 additions and 6 deletions

View File

@@ -453,4 +453,38 @@ describe("input-format stream-json", () => {
},
{ timeout: 200000 },
);
test(
"Task tool with explore subagent works",
async () => {
// Prescriptive prompt to ensure Task tool is used
const objects = (await runBidirectional(
[
JSON.stringify({
type: "user",
message: {
role: "user",
content:
"You MUST use the Task tool with subagent_type='explore' to find TypeScript files (*.ts) in the src directory. " +
"Return only the subagent's report, nothing else.",
},
}),
],
[],
300000, // 5 min timeout - subagent spawn + execution can be slow
)) as WireMessage[];
// Should have a successful result
const result = objects.find(
(o): o is ResultMessage => o.type === "result",
);
expect(result).toBeDefined();
expect(result?.subtype).toBe("success");
// Should have auto_approval events (Task tool was auto-approved via --yolo)
const autoApprovals = objects.filter((o) => o.type === "auto_approval");
expect(autoApprovals.length).toBeGreaterThan(0);
},
{ timeout: 320000 },
);
});