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.
This commit is contained in:
2026-08-18 14:51:19 +07:00
parent 1fa52d1bfc
commit f053051a5d
2 changed files with 17 additions and 3 deletions
@@ -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")));