



















@@ -2460,6 +2460,55 @@ describe("deliverSubagentAnnouncement completion delivery", () => {
24602460expect(sendMessage).not.toHaveBeenCalled();
24612461});
246224622463+it("directly delivers stale isolated cron run media failure completions", async () => {
2464+const callGateway = createGatewayMock({
2465+result: {
2466+payloads: [{ text: "Image generation failed. Provider timed out." }],
2467+},
2468+});
2469+const sendMessage = createSendMessageMock();
2470+const queueEmbeddedPiMessageWithOutcome = createQueueOutcomeMock(true);
2471+const result = await deliverSlackChannelAnnouncement({
2472+ callGateway,
2473+ sendMessage,
2474+ queueEmbeddedPiMessageWithOutcome,
2475+sessionId: "stale-cron-run-session",
2476+isActive: false,
2477+requesterSessionKey: "agent:main:cron:daily-media:run:run-123",
2478+expectsCompletionMessage: true,
2479+directIdempotencyKey: "announce-stale-cron-media-failure",
2480+sourceTool: "image_generate",
2481+internalEvents: [
2482+{
2483+type: "task_completion",
2484+source: "image_generation",
2485+childSessionKey: "image_generate:task-123",
2486+childSessionId: "task-123",
2487+announceType: "image generation task",
2488+taskLabel: "daily media",
2489+status: "error",
2490+statusLabel: "failed",
2491+result: "Provider timed out.",
2492+replyInstruction: "Tell the user image generation failed.",
2493+},
2494+],
2495+});
2496+2497+expectRecordFields(result, {
2498+delivered: true,
2499+path: "direct",
2500+});
2501+expect(queueEmbeddedPiMessageWithOutcome).not.toHaveBeenCalled();
2502+expectGatewayAgentParams(callGateway, {
2503+deliver: true,
2504+channel: "slack",
2505+accountId: "acct-1",
2506+to: "channel:C123",
2507+threadId: undefined,
2508+});
2509+expect(sendMessage).not.toHaveBeenCalled();
2510+});
2511+24632512it.each([
24642513{
24652514name: "legacy Discord channel",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。