From f777a3d13d7c6019cbcb8d8f32663d9b8ccb1656 Mon Sep 17 00:00:00 2001 From: Junchao Yan Date: Wed, 12 Aug 2026 17:00:08 -0700 Subject: [PATCH] fix(desktop): drop the Restart-Agent label distinction from the primary action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #5574 added an E2E test expecting the primary action to always read "Start agent" after stopping a local agent, but never updated getManagedAgentPrimaryActionLabel's status-aware ternary to match — its accidental full collapse happened to satisfy the new E2E test while breaking the old unit test. #42 restored the old ternary, which flipped the failure back onto the E2E test. Per JC, standardize on the simpler 2-way UX the E2E test expects: Stop / Start agent, no separate "Restart Agent" wording on the primary button (the dedicated Restart quick-action, shown only while live, already covers that case). Signed-off-by: Junchao Yan --- .../features/agents/lib/managedAgentControlActions.test.mjs | 6 +++--- .../src/features/agents/lib/managedAgentControlActions.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop/src/features/agents/lib/managedAgentControlActions.test.mjs b/desktop/src/features/agents/lib/managedAgentControlActions.test.mjs index 3d6d5d97d5d..ba05b86b1b7 100644 --- a/desktop/src/features/agents/lib/managedAgentControlActions.test.mjs +++ b/desktop/src/features/agents/lib/managedAgentControlActions.test.mjs @@ -450,18 +450,18 @@ test("a dead remote agent offers Deploy, a live one offers Shutdown", () => { assert.equal(getManagedAgentPrimaryActionLabel(remote(), "away"), "Shutdown"); }); -test("local agent labels are unchanged", () => { +test("local agent labels are Stop/Start agent regardless of prior status", () => { assert.equal( getManagedAgentPrimaryActionLabel(agent({ status: "running" })), "Stop", ); assert.equal( getManagedAgentPrimaryActionLabel(agent({ status: "stopped" })), - "Restart Agent", + "Start agent", ); assert.equal( getManagedAgentPrimaryActionLabel(agent({ status: "idle" })), - "Start Agent", + "Start agent", ); }); diff --git a/desktop/src/features/agents/lib/managedAgentControlActions.ts b/desktop/src/features/agents/lib/managedAgentControlActions.ts index 4d4caabb4ce..3ea90f04c61 100644 --- a/desktop/src/features/agents/lib/managedAgentControlActions.ts +++ b/desktop/src/features/agents/lib/managedAgentControlActions.ts @@ -83,7 +83,7 @@ export function getManagedAgentPrimaryActionLabel( return "Stop"; } - return agent.status === "stopped" ? "Restart Agent" : "Start Agent"; + return "Start agent"; } export function resolveManagedAgentChannelId(