



























@@ -722,6 +722,62 @@ describe("deliverSubagentAnnouncement completion delivery", () => {
722722);
723723});
724724725+it("keeps all grouped child results in direct completion fallback", async () => {
726+const callGateway = createGatewayMock({
727+result: {
728+payloads: [],
729+},
730+});
731+const sendMessage = createSendMessageMock();
732+const result = await deliverSlackThreadAnnouncement({
733+ callGateway,
734+ sendMessage,
735+sessionId: "requester-session-4",
736+isActive: false,
737+expectsCompletionMessage: true,
738+directIdempotencyKey: "announce-thread-fallback-grouped-results",
739+internalEvents: [
740+{
741+type: "task_completion",
742+source: "subagent",
743+childSessionKey: "agent:worker:subagent:first",
744+childSessionId: "child-session-1",
745+announceType: "subagent task",
746+taskLabel: "first task",
747+status: "ok",
748+statusLabel: "completed successfully",
749+result: "first child result",
750+replyInstruction: "Summarize the result.",
751+},
752+{
753+type: "task_completion",
754+source: "subagent",
755+childSessionKey: "agent:worker:subagent:second",
756+childSessionId: "child-session-2",
757+announceType: "subagent task",
758+taskLabel: "second task",
759+status: "ok",
760+statusLabel: "completed successfully",
761+result: "second child result",
762+replyInstruction: "Summarize the result.",
763+},
764+],
765+});
766+767+expect(result).toEqual(
768+expect.objectContaining({
769+delivered: true,
770+path: "direct-thread-fallback",
771+}),
772+);
773+expect(sendMessage).toHaveBeenCalledWith(
774+expect.objectContaining({
775+content: "first task:\nfirst child result\n\nsecond task:\nsecond child result",
776+idempotencyKey: "announce-thread-fallback-grouped-results",
777+}),
778+);
779+});
780+725781it("keeps concise requester rewrites primary even when child output is long", async () => {
726782const callGateway = createGatewayMock({
727783result: {
@@ -1265,4 +1321,33 @@ describe("extractThreadCompletionFallbackText", () => {
12651321]),
12661322).toBe("sample task");
12671323});
1324+1325+it("combines multiple task completion results for grouped announce fallback", () => {
1326+expect(
1327+extractThreadCompletionFallbackText([
1328+{
1329+type: "task_completion",
1330+source: "subagent",
1331+childSessionKey: "agent:worker:subagent:first",
1332+announceType: "subagent task",
1333+taskLabel: "first task",
1334+status: "ok",
1335+statusLabel: "completed successfully",
1336+result: "first child result",
1337+replyInstruction: "Summarize the result.",
1338+},
1339+{
1340+type: "task_completion",
1341+source: "subagent",
1342+childSessionKey: "agent:worker:subagent:second",
1343+announceType: "subagent task",
1344+taskLabel: "second task",
1345+status: "ok",
1346+statusLabel: "completed successfully",
1347+result: "second child result",
1348+replyInstruction: "Summarize the result.",
1349+},
1350+]),
1351+).toBe("first task:\nfirst child result\n\nsecond task:\nsecond child result");
1352+});
12681353});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。