From f053051a5d2ba4dbde8cd1921e149b97e56dfd67 Mon Sep 17 00:00:00 2001 From: nntrivi2001 Date: Tue, 18 Aug 2026 14:51:19 +0700 Subject: [PATCH] fix(run): scope resume session picker to the typed cwd when no lane is selected Without a lane, the picker had no cwd filter and listed every session across every repo. Fall back to the free-typed cwd field so resume suggestions stay scoped to the working directory in view. --- client/src/components/run/RunSetup.tsx | 4 +++- .../components/run/__tests__/RunSetup.test.tsx | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/client/src/components/run/RunSetup.tsx b/client/src/components/run/RunSetup.tsx index 3c6b94d..df1d6ad 100644 --- a/client/src/components/run/RunSetup.tsx +++ b/client/src/components/run/RunSetup.tsx @@ -163,7 +163,9 @@ export function RunSetup(props: RunSetupProps) { // props.resumeSession here would resume nothing. if (s && !props.busy) handleStart(props, s); }} - cwd={props.laneCwd} + // Fall back to the typed cwd when no lane is selected — otherwise + // an unfiltered picker lists every session from every repo. + cwd={props.laneCwd || props.cwd.trim() || undefined} /> )} diff --git a/client/src/components/run/__tests__/RunSetup.test.tsx b/client/src/components/run/__tests__/RunSetup.test.tsx index e979700..0aee7c0 100644 --- a/client/src/components/run/__tests__/RunSetup.test.tsx +++ b/client/src/components/run/__tests__/RunSetup.test.tsx @@ -227,9 +227,21 @@ describe("RunSetup — resume picker scopes sessions to the selected lane", () = ); }); - it("lists everything when no lane is selected", async () => { + it("falls back to the typed cwd when no lane is selected", async () => { const { api } = await import("../../../lib/api"); - renderSetup({ laneCwd: undefined }); + renderSetup({ laneCwd: undefined, cwd: "/Users/tester" }); + fireEvent.click(screen.getByText(i18n.t("run:resume.resumeOption"))); + fireEvent.click(screen.getByText(i18n.t("run:resume.pickSession"))); + + await new Promise((r) => setTimeout(r, 0)); + expect(api.sessions.list).toHaveBeenCalledWith( + expect.objectContaining({ cwd: "/Users/tester" }) + ); + }); + + it("lists everything when no lane is selected and cwd is empty", async () => { + const { api } = await import("../../../lib/api"); + renderSetup({ laneCwd: undefined, cwd: "" }); fireEvent.click(screen.getByText(i18n.t("run:resume.resumeOption"))); fireEvent.click(screen.getByText(i18n.t("run:resume.pickSession")));