fix(sessions): clarify subsession waiting behavior

This commit is contained in:
Federico Jaramillo Martinez
2026-07-11 09:41:03 +02:00
parent 3df11e3eb0
commit a660ba8ef8
3 changed files with 20 additions and 2 deletions
@@ -52,6 +52,19 @@ describe("createSubsessionToolDefinitions", () => {
expect(firstText(result.content)).toContain("Started subsession child-1");
});
it("tells the parent to work independently or end its turn instead of polling", async () => {
const { spawn: spawnTool } = tools({
spawn: vi.fn(() => Promise.resolve({ sessionId: "child-1", cwd: "/repos/a-feature" })),
});
expect(spawnTool.description).toContain("Do not poll or sleep while waiting");
const result = await spawnTool.execute("call-guidance", { prompt: "do it" }, undefined, undefined, ctxFor("parent-1", undefined));
const message = firstText(result.content);
expect(message).toContain("Continue independent work or end this turn if blocked; do not poll");
expect(message).toContain("You will be resumed when it stops working");
});
it("spawn_subsession omits the inherited model when the dispatching session has no current model", async () => {
const spawn = vi.fn(() => Promise.resolve({ sessionId: "child-2", cwd: "/repos/a" }));
const { spawn: spawnTool } = tools({ spawn });