test(qa): accept completed agent wait status · openclaw/openclaw@5822e80
vincentkoc
·
2026-06-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -679,6 +679,33 @@ describe("qa suite runtime agent process helpers", () => {
|
679 | 679 | ).rejects.toThrow("agent.wait returned error: boom"); |
680 | 680 | }); |
681 | 681 | |
| 682 | +it("accepts completed agent wait status as a successful terminal run", async () => { |
| 683 | +const gatewayCall = vi |
| 684 | +.fn() |
| 685 | +.mockResolvedValueOnce({ runId: "run-completed" }) |
| 686 | +.mockResolvedValueOnce({ status: "completed" }); |
| 687 | +const env = { |
| 688 | +gateway: { call: gatewayCall }, |
| 689 | +transport: { |
| 690 | +buildAgentDelivery: vi.fn(() => ({ |
| 691 | +channel: "qa-channel", |
| 692 | +replyChannel: "reply-channel", |
| 693 | +replyTo: "reply-target", |
| 694 | +})), |
| 695 | +}, |
| 696 | +} as never; |
| 697 | + |
| 698 | +await expect( |
| 699 | +runAgentPrompt(env, { |
| 700 | +sessionKey: "session-completed", |
| 701 | +message: "hello", |
| 702 | +}), |
| 703 | +).resolves.toEqual({ |
| 704 | +started: { runId: "run-completed" }, |
| 705 | +waited: { status: "completed" }, |
| 706 | +}); |
| 707 | +}); |
| 708 | + |
682 | 709 | it("waits for a specific agent run id", async () => { |
683 | 710 | const gatewayCall = vi.fn(async () => ({ status: "ok" })); |
684 | 711 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -481,7 +481,7 @@ async function runAgentPrompt(
|
481 | 481 | ) { |
482 | 482 | const started = await startAgentRun(env, params); |
483 | 483 | const waited = await waitForAgentRun(env, started.runId!, params.timeoutMs ?? 30_000); |
484 | | -if (waited.status !== "ok") { |
| 484 | +if (waited.status === "error" || waited.status === "timeout" || waited.status === "pending") { |
485 | 485 | throw new Error( |
486 | 486 | `agent.wait returned ${waited.status ?? "unknown"}: ${waited.error ?? "no error"}`, |
487 | 487 | ); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。