From 27e705f7cd56f79b5299fe63f5f13f329d196585 Mon Sep 17 00:00:00 2001 From: Shakker Date: Mon, 11 May 2026 18:02:25 +0100 Subject: [PATCH] test: check auto-reply diagnostics --- src/auto-reply/reply/agent-runner.misc.runreplyagent.test.ts | 2 +- src/auto-reply/reply/bash-command.stop.test.ts | 5 +++-- src/auto-reply/reply/pending-tool-task-drain.test.ts | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/auto-reply/reply/agent-runner.misc.runreplyagent.test.ts b/src/auto-reply/reply/agent-runner.misc.runreplyagent.test.ts index 0b6e518fbfb..362b05889c2 100644 --- a/src/auto-reply/reply/agent-runner.misc.runreplyagent.test.ts +++ b/src/auto-reply/reply/agent-runner.misc.runreplyagent.test.ts @@ -2591,7 +2591,7 @@ describe("runReplyAgent transient HTTP retry", () => { expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(2); expect(runtimeErrorMock).toHaveBeenCalledWith( - expect.stringContaining("Transient HTTP provider error before reply"), + 'Transient HTTP provider error before reply (521 Web server is downCloudflare). Retrying once in 2500ms.', ); const payload = Array.isArray(result) ? result[0] : result; diff --git a/src/auto-reply/reply/bash-command.stop.test.ts b/src/auto-reply/reply/bash-command.stop.test.ts index 36cb711036e..aad5e1204bf 100644 --- a/src/auto-reply/reply/bash-command.stop.test.ts +++ b/src/auto-reply/reply/bash-command.stop.test.ts @@ -155,10 +155,11 @@ describe("handleBashChatCommand stop", () => { }, }); - const result = await handleBashChatCommand(buildElevatedDeniedParams("/bash pwd")); + const params = buildElevatedDeniedParams("/bash pwd"); + const result = await handleBashChatCommand(params); expect(resolveSandboxRuntimeStatusSpy).toHaveBeenCalledWith({ - cfg: expect.any(Object), + cfg: params.cfg, sessionKey: "agent:target:telegram:direct:target-session", }); expect(result.text).toContain( diff --git a/src/auto-reply/reply/pending-tool-task-drain.test.ts b/src/auto-reply/reply/pending-tool-task-drain.test.ts index 75695d78c10..9e920922fc3 100644 --- a/src/auto-reply/reply/pending-tool-task-drain.test.ts +++ b/src/auto-reply/reply/pending-tool-task-drain.test.ts @@ -75,7 +75,9 @@ describe("drainPendingToolTasks", () => { await vi.advanceTimersByTimeAsync(100); await expect(drain).resolves.toEqual({ kind: "timeout", remaining: 1 }); - expect(onTimeout).toHaveBeenCalledWith(expect.stringContaining("1 task(s) still pending")); + expect(onTimeout).toHaveBeenCalledWith( + "pending tool tasks made no progress within 100ms; proceeding with 1 task(s) still pending to avoid session deadlock", + ); expect(tasks.size).toBe(1); });