From 01f6d2911c33680935f00537f07ec5b580bcd331 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 7 Jul 2026 02:02:06 -0700 Subject: [PATCH] Clear VCS action presentation state on finish - Reset running UI state when a VCS action completes - Add regression coverage for finished action cleanup --- .../src/state/vcsAction.test.ts | 40 +++++++++++++++++++ .../client-runtime/src/state/vcsAction.ts | 4 +- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/packages/client-runtime/src/state/vcsAction.test.ts b/packages/client-runtime/src/state/vcsAction.test.ts index 7e618535ad8..dac852c166c 100644 --- a/packages/client-runtime/src/state/vcsAction.test.ts +++ b/packages/client-runtime/src/state/vcsAction.test.ts @@ -155,6 +155,46 @@ describe("vcsActionState", () => { }); }); + it("clears running presentation state once the action finishes", () => { + const initial = beginVcsActionState({ + operation: "run_change_request", + label: "Running source control action", + actionId, + }); + const pushing = applyVcsActionProgressEvent( + initial, + progress({ + actionId, + action, + cwd, + kind: "phase_started", + phase: "push", + label: "Pushing...", + }), + ); + const finished = applyVcsActionProgressEvent( + pushing, + progress({ + actionId, + action, + cwd, + kind: "action_finished", + result, + }), + ); + + expect(finished).toMatchObject({ + isRunning: false, + operation: "run_change_request", + actionId, + action, + currentLabel: null, + currentPhaseLabel: null, + lastOutputLine: null, + error: null, + }); + }); + it("retains a terminal action error for presentation", () => { const initial = beginVcsActionState({ operation: "run_change_request", diff --git a/packages/client-runtime/src/state/vcsAction.ts b/packages/client-runtime/src/state/vcsAction.ts index 8ae3219a243..f2cba39cf9d 100644 --- a/packages/client-runtime/src/state/vcsAction.ts +++ b/packages/client-runtime/src/state/vcsAction.ts @@ -386,12 +386,10 @@ export function applyVcsActionProgressEvent( }; case "action_finished": return { - ...current, - isRunning: false, + ...EMPTY_VCS_ACTION_STATE, actionId: event.actionId, action: event.action, operation: "run_change_request", - error: null, }; case "action_failed": return {