From d13a3ad33094844ed2c0a23bcbf6ef951daba9ee Mon Sep 17 00:00:00 2001 From: Devin Foley Date: Mon, 16 Nov 2026 18:12:32 -0800 Subject: [PATCH] fix(ui): keep Pause available for errored agents Show Pause alongside Clear error in the inline actions and profile menu. Operators can disable an errored agent without clearing its error first. Verify both layouts and assert that Pause invokes neither Clear error nor Run. All 45 AgentActionButtons component tests pass. Co-Authored-By: Paperclip --- ui/src/components/AgentActionButtons.test.tsx | 31 +++++++++++++++++-- ui/src/components/AgentActionButtons.tsx | 12 ++++--- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/ui/src/components/AgentActionButtons.test.tsx b/ui/src/components/AgentActionButtons.test.tsx index e5d9b89f352..06bf2eea322 100644 --- a/ui/src/components/AgentActionButtons.test.tsx +++ b/ui/src/components/AgentActionButtons.test.tsx @@ -262,14 +262,22 @@ describe("AgentActionButtons", () => { } }); - it("replaces the pause slot with Clear error for error agents", async () => { + it("keeps Pause alongside Clear error for error agents", async () => { render(makeAgent({ status: "error" })); await flushReact(); expect(container.textContent).toContain("Clear error"); - expect(container.textContent).not.toContain("Pause"); + const pause = [...container.querySelectorAll("button")].find(button => button.textContent === "Pause"); + expect(pause).toBeDefined(); + expect(pause!.disabled).toBe(false); expect(container.textContent).toContain("Run Heartbeat"); + await act(async () => pause!.click()); + await flushReact(); + expect(mockAgentsApi.pause).toHaveBeenCalledWith("agent-1", "company-1"); + expect(mockAgentsApi.clearError).not.toHaveBeenCalled(); + expect(mockAgentsApi.invoke).not.toHaveBeenCalled(); + await act(async () => { container.querySelector('[aria-label="Open actions for Alpha Agent"]')?.click(); }); @@ -294,7 +302,7 @@ describe("AgentActionButtons", () => { }); await flushReact(); const items = [...document.body.querySelectorAll("[data-slot='popover-content'] button, [data-radix-popper-content-wrapper] button")].map((button) => button.textContent?.trim()); - expect(items).toEqual(["Run Heartbeat", "Clear error", "Agent history", "Duplicate agent", "Copy agent ID", "Reset sessions", "Terminate"]); + expect(items).toEqual(["Run Heartbeat", "Clear error", "Pause", "Agent history", "Duplicate agent", "Copy agent ID", "Reset sessions", "Terminate"]); await act(async () => { [...document.body.querySelectorAll("button")].find((button) => button.textContent?.trim() === "Agent history")?.click(); @@ -312,6 +320,23 @@ describe("AgentActionButtons", () => { expect(mockAgentsApi.clearError).toHaveBeenCalledWith("agent-1", "company-1"); }); + it("pauses an errored agent directly from the profile menu", async () => { + render(makeAgent({ status: "error" }), { workActionsInMenu: true }); + await flushReact(); + await act(async () => { + container.querySelector('[aria-label="Open actions for Alpha Agent"]')!.click(); + }); + await flushReact(); + const pause = [...document.body.querySelectorAll("button")].find(button => button.textContent?.trim() === "Pause"); + expect(pause).toBeDefined(); + expect(pause!.disabled).toBe(false); + await act(async () => pause!.click()); + await flushReact(); + expect(mockAgentsApi.pause).toHaveBeenCalledWith("agent-1", "company-1"); + expect(mockAgentsApi.clearError).not.toHaveBeenCalled(); + expect(mockAgentsApi.invoke).not.toHaveBeenCalled(); + }); + it("keeps Finish setup as the one button while setup is pending in menu mode", async () => { render(makeAgent({ status: "paused", lifecycleState: "paused", pauseReason: "setup" }), { assignLabel: "Assign task", diff --git a/ui/src/components/AgentActionButtons.tsx b/ui/src/components/AgentActionButtons.tsx index 3fe9514a580..ba202d2b4fe 100644 --- a/ui/src/components/AgentActionButtons.tsx +++ b/ui/src/components/AgentActionButtons.tsx @@ -454,7 +454,7 @@ export function AgentActionButtons({ {runLabel} ) : null} - {needsSetup ? null : isAgentError ? ( + {!needsSetup && isAgentError && ( - ) : isPaused ? ( + )} + {needsSetup ? null : isPaused ? (