fix(web): keep repository tasks on worktree defaults (#2136)

This commit is contained in:
Carlos Florêncio
2026-08-01 20:34:23 +01:00
committed by GitHub
parent 1e353fbbbc
commit b29ee5e6d2
13 changed files with 627 additions and 16 deletions
@@ -4,6 +4,8 @@ import type { StoreSelections } from "@/components/task-create-dialog-types";
const WORKTREE_EXECUTOR_ID = "exec-worktree";
const WORKTREE_PROFILE_ID = "profile-b";
const LOCAL_EXECUTOR_ID = "exec-local";
const LOCAL_PROFILE_ID = "profile-local";
function makeWorktreeExecutor(): StoreSelections["executors"][number] {
return {
@@ -13,6 +15,14 @@ function makeWorktreeExecutor(): StoreSelections["executors"][number] {
} as unknown as StoreSelections["executors"][number];
}
function makeLocalExecutor(): StoreSelections["executors"][number] {
return {
id: LOCAL_EXECUTOR_ID,
type: "local",
profiles: [{ id: LOCAL_PROFILE_ID, executor_id: LOCAL_EXECUTOR_ID, name: "Local" }],
} as unknown as StoreSelections["executors"][number];
}
describe("shouldWaitForLastUsedExecutorProfile", () => {
it("waits only while a valid last-used executor profile can restore", () => {
const worktreeExecutor = makeWorktreeExecutor();
@@ -36,4 +46,16 @@ describe("shouldWaitForLastUsedExecutorProfile", () => {
}),
).toBe(false);
});
it("does not wait for a valid profile from another resolved executor", () => {
expect(
shouldWaitForLastUsedExecutorProfile({
executors: [makeLocalExecutor(), makeWorktreeExecutor()],
workspaceDefaults: null,
lastUsedExecutorProfileId: LOCAL_PROFILE_ID,
noRepository: false,
preferLocalExecutor: false,
}),
).toBe(false);
});
});