Tests/Typing: stabilize subagent completion routing changes

This commit is contained in:
Sahil Satralkar
2026-02-23 21:52:16 +05:30
committed by Peter Steinberger
parent 8796c78b3d
commit 420d8c663c

View File

@@ -245,7 +245,7 @@ describe("openclaw-tools: subagents (sessions_spawn lifecycle)", () => {
} }
| undefined; | undefined;
expect(second?.sessionKey).toBe("agent:main:discord:group:req"); expect(second?.sessionKey).toBe("agent:main:discord:group:req");
expect(second?.deliver).toBe(true); expect(second?.deliver).toBe(false);
expect(second?.message).toContain("subagent task"); expect(second?.message).toContain("subagent task");
const sendCalls = ctx.calls.filter((c) => c.method === "send"); const sendCalls = ctx.calls.filter((c) => c.method === "send");
@@ -297,7 +297,7 @@ describe("openclaw-tools: subagents (sessions_spawn lifecycle)", () => {
// Second call: main agent trigger // Second call: main agent trigger
const second = agentCalls[1]?.params as { sessionKey?: string; deliver?: boolean } | undefined; const second = agentCalls[1]?.params as { sessionKey?: string; deliver?: boolean } | undefined;
expect(second?.sessionKey).toBe("agent:main:discord:group:req"); expect(second?.sessionKey).toBe("agent:main:discord:group:req");
expect(second?.deliver).toBe(true); expect(second?.deliver).toBe(false);
// No direct send to external channel (main agent handles delivery) // No direct send to external channel (main agent handles delivery)
const sendCalls = ctx.calls.filter((c) => c.method === "send"); const sendCalls = ctx.calls.filter((c) => c.method === "send");
@@ -365,8 +365,8 @@ describe("openclaw-tools: subagents (sessions_spawn lifecycle)", () => {
const announceParams = agentCalls[1]?.params as const announceParams = agentCalls[1]?.params as
| { accountId?: string; channel?: string; deliver?: boolean } | { accountId?: string; channel?: string; deliver?: boolean }
| undefined; | undefined;
expect(announceParams?.deliver).toBe(true); expect(announceParams?.deliver).toBe(false);
expect(announceParams?.channel).toBe("whatsapp"); expect(announceParams?.channel).toBeUndefined();
expect(announceParams?.accountId).toBe("kev"); expect(announceParams?.accountId).toBeUndefined();
}); });
}); });