{error}
diff --git a/apps/web/components/task-create-dialog-repository-sets.test.ts b/apps/web/components/task-create-dialog-repository-sets.test.ts
index 3a7a657366..c62071d604 100644
--- a/apps/web/components/task-create-dialog-repository-sets.test.ts
+++ b/apps/web/components/task-create-dialog-repository-sets.test.ts
@@ -5,6 +5,7 @@ import { repositoryId, workspaceId } from "@/lib/types/ids";
import {
applyRepositorySet,
selectedRepositoryIdsForSet,
+ selectedRepositoryMembersForSet,
} from "@/components/task-create-dialog-repository-sets";
import type { TaskRepoRow } from "@/components/task-create-dialog-types";
@@ -18,13 +19,21 @@ const REPO_ORDERS = "repo-orders";
const ROW_0 = "row-0";
const AVAILABLE = [repository(REPO_WEB), repository(REPO_GATEWAY), repository(REPO_ORDERS)];
-function repositorySet(ids: string[], name = "Full-stack"): RepositorySet {
+function repositorySet(
+ ids: string[],
+ name = "Full-stack",
+ bases: Record = {},
+): RepositorySet {
return {
id: "set-1",
workspace_id: workspaceId("ws-1"),
name,
description: "",
- repositories: ids.map((id, position) => ({ repository_id: repositoryId(id), position })),
+ repositories: ids.map((id, position) => ({
+ repository_id: repositoryId(id),
+ position,
+ base_branch: bases[id] ?? "",
+ })),
created_at: "2026-08-17T09:00:00Z",
updated_at: "2026-08-17T09:00:00Z",
};
@@ -60,6 +69,30 @@ describe("applyRepositorySet", () => {
expect(result.rows[0].branch).toBe("");
});
+ it("copies a saved base into new row state without using it as the row checkout", () => {
+ const result = applyRepositorySet({
+ rows: [],
+ set: repositorySet([REPO_WEB], "Full-stack", { [REPO_WEB]: "develop" }),
+ repositories: AVAILABLE,
+ });
+
+ expect(result.rows[0]).toMatchObject({
+ repositoryId: REPO_WEB,
+ branch: "",
+ baseBranch: "develop",
+ });
+ });
+
+ it("keeps an empty saved base on normal task defaulting", () => {
+ const result = applyRepositorySet({
+ rows: [],
+ set: repositorySet([REPO_WEB]),
+ repositories: AVAILABLE,
+ });
+
+ expect(result.rows[0]).not.toHaveProperty("baseBranch");
+ });
+
it("consumes a single blank placeholder row instead of leaving it behind", () => {
const result = applyRepositorySet({
rows: [row(ROW_0)],
@@ -234,3 +267,46 @@ describe("selectedRepositoryIdsForSet", () => {
expect(ids).toEqual([REPO_WEB]);
});
});
+
+describe("selectedRepositoryMembersForSet", () => {
+ // Reviewer-requested coverage of the existing first-row-wins contract.
+ it.each([
+ { isLocalExecutor: false, freshBranchEnabled: false, expected: "saved-base" },
+ { isLocalExecutor: true, freshBranchEnabled: false, expected: "saved-base" },
+ { isLocalExecutor: true, freshBranchEnabled: true, expected: "develop" },
+ ])("keeps the first duplicate's effective base: %o", (mode) => {
+ const rows = [
+ { ...row(ROW_0, REPO_WEB, "develop"), baseBranch: "saved-base" },
+ row("row-1", REPO_WEB, "feature/x"),
+ row("row-2", REPO_GATEWAY, "develop"),
+ ];
+ expect(
+ selectedRepositoryMembersForSet(rows, [], mode.isLocalExecutor, mode.freshBranchEnabled),
+ ).toEqual([
+ { repositoryId: REPO_WEB, baseBranch: mode.expected },
+ {
+ repositoryId: REPO_GATEWAY,
+ baseBranch: mode.isLocalExecutor && !mode.freshBranchEnabled ? "" : "develop",
+ },
+ ]);
+ });
+
+ it("captures the selected fork base while fresh-branch mode is enabled", () => {
+ const repository = {
+ ...AVAILABLE[0],
+ default_branch: "main",
+ } as Repository;
+ const rows: TaskRepoRow[] = [
+ {
+ key: ROW_0,
+ repositoryId: REPO_WEB,
+ branch: "develop",
+ baseBranch: "main",
+ },
+ ];
+
+ expect(selectedRepositoryMembersForSet(rows, [repository], true, true)).toEqual([
+ { repositoryId: REPO_WEB, baseBranch: "develop" },
+ ]);
+ });
+});
diff --git a/apps/web/components/task-create-dialog-repository-sets.ts b/apps/web/components/task-create-dialog-repository-sets.ts
index c74b347a48..27105aa02a 100644
--- a/apps/web/components/task-create-dialog-repository-sets.ts
+++ b/apps/web/components/task-create-dialog-repository-sets.ts
@@ -12,8 +12,9 @@ import type { TaskRepoRow } from "@/components/task-create-dialog-types";
* - a row the user configured is never discarded or reordered;
* - a member that no longer resolves to a live workspace repository is skipped
* and counted, so the UI can say how many were dropped and why;
- * - branches are left empty for the dialog's per-row branch defaulting, because
- * branch choice belongs to the task rather than to the set.
+ * - a saved base is copied to baseBranch on the new row. The ordinary branch
+ * field stays empty so a local executor can still autoselect the current
+ * checkout branch without using the saved base as checkout state.
*
* Kept as a pure function so those rules are testable without rendering the
* dialog.
@@ -63,7 +64,13 @@ export function applyRepositorySet({
continue;
}
present.add(id);
- added.push({ key: nextAppliedRowKey(takenKeys), repositoryId: id, branch: "" });
+ const savedBase = member.base_branch || undefined;
+ added.push({
+ key: nextAppliedRowKey(takenKeys),
+ repositoryId: id,
+ branch: "",
+ ...(savedBase ? { baseBranch: savedBase } : {}),
+ });
}
return {
@@ -128,3 +135,28 @@ export function selectedRepositoryIdsForSet(rows: TaskRepoRow[]): string[] {
}
return ids;
}
+
+/**
+ * Projects the current task rows into the ordered member shape used by the
+ * repository-set API. Local rows use the repository default as their effective
+ * base because their row branch is the checkout branch on disk.
+ */
+export function selectedRepositoryMembersForSet(
+ rows: TaskRepoRow[],
+ repositories: Repository[] = [],
+ isLocalExecutor = false,
+ freshBranchEnabled = false,
+): Array<{ repositoryId: string; baseBranch: string }> {
+ const byId = new Map(repositories.map((repository) => [repository.id as string, repository]));
+ const seen = new Set();
+ return rows.flatMap((row) => {
+ const repositoryId = row.repositoryId;
+ if (!repositoryId || seen.has(repositoryId)) return [];
+ seen.add(repositoryId);
+ const repositoryDefault = byId.get(repositoryId)?.default_branch ?? "";
+ const baseBranch = freshBranchEnabled
+ ? row.branch
+ : row.baseBranch || (isLocalExecutor ? repositoryDefault : row.branch) || "";
+ return [{ repositoryId, baseBranch }];
+ });
+}
diff --git a/apps/web/components/task-create-dialog-setup.test.ts b/apps/web/components/task-create-dialog-setup.test.ts
index 925896a647..2af491f5ea 100644
--- a/apps/web/components/task-create-dialog-setup.test.ts
+++ b/apps/web/components/task-create-dialog-setup.test.ts
@@ -2,6 +2,7 @@ import { renderHook } from "@testing-library/react";
import type { FormEvent } from "react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { TaskCreateDialogProps } from "./task-create-dialog";
+import type { RepositoryBranchesState } from "@/lib/state/slices/workspace/types";
const mocks = vi.hoisted(() => ({
agentGeneratedTaskTitles: false,
@@ -146,7 +147,7 @@ vi.mock("@/components/task-create-dialog-state", () => ({
useSessionRepoName: () => null,
}));
-import { useTaskCreateDialogSetup } from "./task-create-dialog-setup";
+import { hasUnavailableSavedBase, useTaskCreateDialogSetup } from "./task-create-dialog-setup";
const props: TaskCreateDialogProps = {
open: true,
@@ -207,3 +208,25 @@ describe("compatibility submit guard", () => {
},
);
});
+
+it("validates saved bases against qualified branch option values", () => {
+ const repositoryBranches = {
+ itemsByRepositoryId: {
+ "repo-1": [{ name: "main", type: "remote", remote: "origin" }],
+ },
+ loadedByRepositoryId: { "repo-1": true },
+ } as unknown as RepositoryBranchesState;
+
+ expect(
+ hasUnavailableSavedBase(
+ [{ key: "r0", repositoryId: "repo-1", branch: "", baseBranch: "main" }],
+ repositoryBranches,
+ ),
+ ).toBe(true);
+ expect(
+ hasUnavailableSavedBase(
+ [{ key: "r0", repositoryId: "repo-1", branch: "", baseBranch: "origin/main" }],
+ repositoryBranches,
+ ),
+ ).toBe(false);
+});
diff --git a/apps/web/components/task-create-dialog-setup.ts b/apps/web/components/task-create-dialog-setup.ts
index 793572a593..1720abf61e 100644
--- a/apps/web/components/task-create-dialog-setup.ts
+++ b/apps/web/components/task-create-dialog-setup.ts
@@ -4,6 +4,8 @@ import { FormEvent, useCallback, useState } from "react";
import type { JiraTicket } from "@/lib/types/jira";
import type { LinearIssue } from "@/lib/types/linear";
import type { Repository } from "@/lib/types/http";
+import type { RepositoryBranchesState } from "@/lib/state/slices/workspace/types";
+import { branchOptionValue } from "@/components/branch-picker-options";
import { SHORTCUTS } from "@/lib/keyboard/constants";
import { useIsUtilityConfigured } from "@/hooks/use-is-utility-configured";
import { useKeyboardShortcutHandler } from "@/hooks/use-keyboard-shortcut";
@@ -126,10 +128,6 @@ function useEditDialogDependencies(
});
}
-function isFreshBranchAvailable(fs: DialogFormState, isLocalExecutor: boolean): boolean {
- return !fs.useRemote && isLocalExecutor && fs.repositories.length === 1;
-}
-
type SubmitWiringArgs = {
props: TaskCreateDialogProps;
fs: ReturnType;
@@ -230,6 +228,65 @@ function resolveSingleRowLocalPath(fs: DialogFormState, repositories: Repository
return "";
}
+function resolveDialogMode(
+ mode: TaskCreateDialogProps["mode"],
+ editingTask: TaskCreateDialogProps["editingTask"],
+) {
+ const isSessionMode = mode === "session";
+ const isEditMode = mode === "edit";
+ return {
+ isSessionMode,
+ isEditMode,
+ isTaskStarted: computeIsTaskStarted(isEditMode, editingTask),
+ };
+}
+
+function canUseFreshBranch(fs: DialogFormState, isLocalExecutor: boolean): boolean {
+ return !fs.useRemote && isLocalExecutor && fs.repositories.length === 1;
+}
+
+export function hasUnavailableSavedBase(
+ rows: DialogFormState["repositories"],
+ repositoryBranches: RepositoryBranchesState,
+): boolean {
+ return rows.some((row) => {
+ if (!row.repositoryId || !row.baseBranch) return false;
+ if (!repositoryBranches.loadedByRepositoryId[row.repositoryId]) return false;
+ const branches = repositoryBranches.itemsByRepositoryId[row.repositoryId] ?? [];
+ return !branches.some((branch) => branchOptionValue(branch) === row.baseBranch);
+ });
+}
+
+function hasPendingSavedBaseValidation(
+ rows: DialogFormState["repositories"],
+ repositoryBranches: RepositoryBranchesState,
+): boolean {
+ return rows.some(
+ (row) =>
+ Boolean(row.repositoryId && row.baseBranch) &&
+ !repositoryBranches.loadedByRepositoryId[row.repositoryId as string],
+ );
+}
+
+function savedBaseSubmitBlockedReason(
+ hasPendingValidation: boolean,
+ hasUnavailableBase: boolean,
+): string | null {
+ if (hasPendingValidation) return t("task:loadingBranches2");
+ if (hasUnavailableBase) return t("task:repositorySetBaseUnavailable");
+ return null;
+}
+
+function savedBaseSubmitBlockedReasonForRows(
+ rows: DialogFormState["repositories"],
+ repositoryBranches: RepositoryBranchesState,
+): string | null {
+ return savedBaseSubmitBlockedReason(
+ hasPendingSavedBaseValidation(rows, repositoryBranches),
+ hasUnavailableSavedBase(rows, repositoryBranches),
+ );
+}
+
function useDialogSetupData(
props: TaskCreateDialogProps,
fs: ReturnType,
@@ -238,6 +295,7 @@ function useDialogSetupData(
const { toast } = useToast();
const storeApi = useAppStoreApi();
const upsertWorkspaceRepository = useAppStore((state) => state.upsertRepository);
+ const repositoryBranches = useAppStore((state) => state.repositoryBranches);
const setRepositoryBranchPolicies = useAppStore((state) => state.setRepositoryBranchPolicies);
const setRepositoryBranchPoliciesLoading = useAppStore(
(state) => state.setRepositoryBranchPoliciesLoading,
@@ -290,6 +348,10 @@ function useDialogSetupData(
executors,
upsertWorkspaceRepository,
});
+ const savedBaseSubmitBlockedReasonValue = savedBaseSubmitBlockedReasonForRows(
+ fs.repositories,
+ repositoryBranches,
+ );
const refreshBranchPolicies = useCallback(async () => {
const repositoryIds = [
...new Set(
@@ -323,6 +385,7 @@ function useDialogSetupData(
handlers,
refreshBranchPolicies,
repositoryLocalPath: resolveSingleRowLocalPath(fs, repositories),
+ savedBaseSubmitBlockedReason: savedBaseSubmitBlockedReasonValue,
};
}
@@ -339,9 +402,7 @@ export function useTaskCreateDialogSetup(
editingTask,
initialValues,
} = resolvedProps;
- const isSessionMode = mode === "session";
- const isEditMode = mode === "edit";
- const isTaskStarted = computeIsTaskStarted(isEditMode, editingTask);
+ const { isSessionMode, isEditMode, isTaskStarted } = resolveDialogMode(mode, editingTask);
const agentGeneratedTaskTitles = useAppStore(
(state) => state.userSettings.agentGeneratedTaskTitles,
);
@@ -361,7 +422,14 @@ export function useTaskCreateDialogSetup(
);
const sessionRepoName = useSessionRepoName(isSessionMode);
const data = useDialogSetupData(resolvedProps, fs);
- const { computed, handlers, repositoryLocalPath, refreshBranchPolicies } = data;
+ const {
+ repositories,
+ userSettingsLoaded,
+ computed,
+ repositoryLocalPath,
+ refreshBranchPolicies,
+ savedBaseSubmitBlockedReason,
+ } = data;
const submitHandlers = useSubmitHandlersWiring({
props: resolvedProps,
fs,
@@ -377,7 +445,7 @@ export function useTaskCreateDialogSetup(
});
const guardedHandleSubmit = useGuardedSubmit(
submitHandlers.handleSubmit,
- resolvedProps.submitBlockedReason,
+ resolvedProps.submitBlockedReason ?? savedBaseSubmitBlockedReason,
!isTaskStarted && computed.noCompatibleAgent,
);
const handleKeyDown = useKeyboardShortcutHandler(SHORTCUTS.SUBMIT, (event) => {
@@ -386,16 +454,14 @@ export function useTaskCreateDialogSetup(
const enhance = useEnhanceForDialog(fs, resolvedProps.taskId, resolvedProps.open);
const handleJiraImport = useJiraImportHandler(fs, data.handlers.handleTaskNameChange);
const handleLinearImport = useLinearImportHandler(fs, data.handlers.handleTaskNameChange);
- const freshBranchAvailable = isFreshBranchAvailable(fs, computed.isLocalExecutor);
- const repositorySets = useRepositorySetsForDialog({
- workspaceId: resolvedProps.workspaceId ?? null,
- open: resolvedProps.open,
- rows: fs.repositories,
- repositories: data.repositories,
- setRepositories: fs.setRepositories,
- setRepositoriesDirty: fs.setRepositoriesDirty,
- userSettingsLoaded: data.userSettingsLoaded,
- });
+ const freshBranchAvailable = canUseFreshBranch(fs, computed.isLocalExecutor);
+ const repositorySets = useDialogRepositorySets(
+ resolvedProps,
+ fs,
+ repositories,
+ computed,
+ userSettingsLoaded,
+ );
return {
...data,
fs,
@@ -406,7 +472,6 @@ export function useTaskCreateDialogSetup(
isTaskStarted,
sessionRepoName,
computed,
- handlers,
submitHandlers,
handleKeyDown,
freshBranchAvailable,
@@ -416,9 +481,30 @@ export function useTaskCreateDialogSetup(
handleJiraImport,
handleLinearImport,
editDependencies,
+ savedBaseSubmitBlockedReason,
};
}
+function useDialogRepositorySets(
+ resolvedProps: TaskCreateDialogProps,
+ fs: DialogFormState,
+ repositories: Repository[],
+ computed: ReturnType["computed"],
+ userSettingsLoaded: boolean,
+) {
+ return useRepositorySetsForDialog({
+ workspaceId: resolvedProps.workspaceId ?? null,
+ open: resolvedProps.open,
+ rows: fs.repositories,
+ repositories,
+ setRepositories: fs.setRepositories,
+ setRepositoriesDirty: fs.setRepositoriesDirty,
+ userSettingsLoaded,
+ isLocalExecutor: computed.isLocalExecutor,
+ freshBranchEnabled: fs.freshBranchEnabled,
+ });
+}
+
type RepositorySetsForDialogArgs = {
workspaceId: string | null;
open: boolean;
@@ -427,6 +513,8 @@ type RepositorySetsForDialogArgs = {
setRepositories: DialogFormState["setRepositories"];
setRepositoriesDirty: DialogFormState["setRepositoriesDirty"];
userSettingsLoaded: boolean;
+ isLocalExecutor: boolean;
+ freshBranchEnabled: boolean;
};
/**
@@ -445,6 +533,8 @@ function useRepositorySetsForDialog({
setRepositories,
setRepositoriesDirty,
userSettingsLoaded,
+ isLocalExecutor,
+ freshBranchEnabled,
}: RepositorySetsForDialogArgs) {
const { sets } = useRepositorySets(workspaceId, open);
const onApply = useApplyRepositorySet({
@@ -462,7 +552,17 @@ function useRepositorySetsForDialog({
sets,
onApply,
save:
- canSave && workspaceId ? { workspaceId, rows, open: saveOpen, setOpen: setSaveOpen } : null,
+ canSave && workspaceId
+ ? {
+ workspaceId,
+ rows,
+ repositories,
+ isLocalExecutor,
+ freshBranchEnabled,
+ open: saveOpen,
+ setOpen: setSaveOpen,
+ }
+ : null,
};
}
diff --git a/apps/web/components/task-create-dialog-types.ts b/apps/web/components/task-create-dialog-types.ts
index 60780ea1a9..ef4be95b03 100644
--- a/apps/web/components/task-create-dialog-types.ts
+++ b/apps/web/components/task-create-dialog-types.ts
@@ -119,6 +119,8 @@ export type TaskRepoRow = {
/** On-machine repo path, when the user picked from discovered repos. */
localPath?: string;
branch: string;
+ /** Explicit effective base copied from a repository set or chosen in the form. */
+ baseBranch?: string;
/** Saved repository policy selected for this row. */
branchPolicyId?: string;
};
@@ -636,6 +638,9 @@ export type DialogFormBodyProps = {
save?: {
workspaceId: string;
rows: TaskRepoRow[];
+ repositories: Repository[];
+ isLocalExecutor: boolean;
+ freshBranchEnabled: boolean;
open: boolean;
setOpen: (open: boolean) => void;
} | null;
diff --git a/apps/web/components/task-create-dialog-workspace-repo-chips.test.tsx b/apps/web/components/task-create-dialog-workspace-repo-chips.test.tsx
index dd4bc265f1..6ad2c79db9 100644
--- a/apps/web/components/task-create-dialog-workspace-repo-chips.test.tsx
+++ b/apps/web/components/task-create-dialog-workspace-repo-chips.test.tsx
@@ -155,6 +155,49 @@ describe("WorkspaceRepoChips branch policy preview", () => {
});
});
+describe("WorkspaceRepoChips saved base display", () => {
+ it("shows the saved base separately from a local executor checkout branch", () => {
+ renderChips({
+ rows: [
+ row({
+ key: "r0",
+ repositoryId: FRONTEND_ID,
+ branch: "feature/task",
+ baseBranch: "develop",
+ }),
+ ],
+ isLocalExecutor: true,
+ });
+
+ expect(screen.getByTestId("repo-chip-base-branch").textContent).toContain("develop");
+ expect(screen.getByTestId("branch-chip-trigger").textContent).toContain("feature/task");
+ });
+
+ it("edits the local executor saved base without changing checkout state", () => {
+ const onRowBaseBranchChange = vi.fn();
+ const onRowBranchChange = vi.fn();
+ renderChips({
+ rows: [
+ row({
+ key: "r0",
+ repositoryId: FRONTEND_ID,
+ branch: "feature/task",
+ baseBranch: "develop",
+ }),
+ ],
+ isLocalExecutor: true,
+ onRowBaseBranchChange,
+ onRowBranchChange,
+ });
+
+ fireEvent.click(screen.getByTestId("repo-chip-base-branch"));
+ fireEvent.click(screen.getByRole("option", { name: /Task default/ }));
+
+ expect(onRowBaseBranchChange).toHaveBeenCalledWith("r0", "");
+ expect(onRowBranchChange).not.toHaveBeenCalledWith("r0", "");
+ });
+});
+
describe("WorkspaceRepoChips workspace markers", () => {
it("marks another task row's workspace repository while keeping it selectable", () => {
const onRowRepositoryChange = vi.fn();
diff --git a/apps/web/components/task-create-dialog-workspace-repo-chips.tsx b/apps/web/components/task-create-dialog-workspace-repo-chips.tsx
index e269543254..0ab6b71a10 100644
--- a/apps/web/components/task-create-dialog-workspace-repo-chips.tsx
+++ b/apps/web/components/task-create-dialog-workspace-repo-chips.tsx
@@ -1,15 +1,19 @@
"use client";
import { useMemo } from "react";
-import { IconPlus, IconX, IconCheck } from "@tabler/icons-react";
-import { Badge } from "@kandev/ui/badge";
+import { IconX } from "@tabler/icons-react";
import { Tooltip, TooltipContent, TooltipTrigger } from "@kandev/ui/tooltip";
import { useBranches, type BranchSource } from "@/hooks/domains/workspace/use-repository-branches";
import type { LocalRepository, Repository, RepositoryBranchPolicy } from "@/lib/types/http";
import type { TaskRepoRow } from "@/components/task-create-dialog-types";
-import { cn, formatUserHomePath } from "@/lib/utils";
import { type PillOption } from "@/components/task-create-dialog-pill";
import { branchToOption, sortBranches } from "@/components/branch-picker-options";
+import { buildRepoBaseBranchData } from "@/components/task-create-dialog-repo-base-branch";
+import {
+ buildRepoOptions,
+ computeRepoChipDisplay,
+ normalizeRepoPath,
+} from "@/components/task-create-dialog-repo-chip-utils";
import {
computeBranchIntent,
type BranchIntent,
@@ -17,12 +21,13 @@ import {
import { useRepoBranchAutoselect } from "@/components/task-create-dialog-repo-branch-autoselect";
import { useRepositoryBranchPolicies } from "@/hooks/domains/workspace/use-repository-branch-policies";
import {
+ RepoChipBaseBranchPill,
RepoChipBranchPill,
RepoChipRepositoryPill,
useRepoChipBranchPicker,
} from "@/components/task-create-dialog-repo-chip-parts";
+import { AddRepositoryButton } from "@/components/task-create-dialog-add-repository-button";
import { useTranslation } from "react-i18next";
-import { t } from "@/lib/i18n";
import { RepositoryDiscoveryControls } from "@/components/repository-discovery-controls";
type WorkspaceRepoChipsProps = {
@@ -47,6 +52,7 @@ type WorkspaceRepoChipsProps = {
onRemove: (key: string) => void;
onRowRepositoryChange: (key: string, value: string) => void;
onRowBranchChange: (key: string, value: string) => void;
+ onRowBaseBranchChange?: (key: string, value: string) => void;
onRowPolicyChange?: (key: string, policyId: string, baseBranch: string) => void;
onPolicySelected?: () => void;
onCreateRepository?: (key: string) => void;
@@ -83,6 +89,7 @@ export function WorkspaceRepoChips({
onRemove,
onRowRepositoryChange,
onRowBranchChange,
+ onRowBaseBranchChange,
onRowPolicyChange,
onPolicySelected,
onCreateRepository,
@@ -91,7 +98,6 @@ export function WorkspaceRepoChips({
lastUsedBranch,
userSettingsLoaded,
}: WorkspaceRepoChipsProps) {
- const { t } = useTranslation();
return (
<>
{rows.map((row) => (
@@ -114,15 +120,19 @@ export function WorkspaceRepoChips({
preferredDefaultBranchLoading={isLocalExecutor ? currentLocalBranchLoading : false}
lastUsedBranch={lastUsedBranch}
userSettingsLoaded={userSettingsLoaded}
+ isLocalExecutor={!!isLocalExecutor}
+ branchValue={isLocalExecutor ? row.branch : row.baseBranch || row.branch}
+ savedBaseBranch={row.baseBranch}
branchIntent={computeBranchIntent({
isLocalExecutor: !!isLocalExecutor,
- rowBranch: row.branch,
+ rowBranch: isLocalExecutor ? row.branch : row.baseBranch || row.branch,
currentLocalBranch: currentLocalBranch ?? "",
freshBranchEnabled: !!freshBranchEnabled,
})}
branchPolicyDisabledReason={branchPolicyDisabledReason}
onRepositoryChange={(value) => onRowRepositoryChange(row.key, value)}
onBranchChange={(value) => onRowBranchChange(row.key, value)}
+ onBaseBranchChange={(value) => onRowBaseBranchChange?.(row.key, value)}
onPolicyChange={
onRowPolicyChange
? (policyId, baseBranch) => onRowPolicyChange(row.key, policyId, baseBranch)
@@ -140,30 +150,12 @@ export function WorkspaceRepoChips({
/>
))}
{freshBranchToggle}
-
-
-
-
-
-
- {addHint ?? t("task:addAnotherRepository")}
-
+
>
);
}
@@ -246,6 +238,9 @@ type RepoChipProps = {
preferredDefaultBranch?: string;
lastUsedBranch?: string | null;
userSettingsLoaded?: boolean;
+ isLocalExecutor?: boolean;
+ branchValue?: string;
+ savedBaseBranch?: string;
/**
* True while preferredDefaultBranch is being resolved. Renders a
* "Loading branch…" placeholder so the chip doesn't briefly show an empty
@@ -263,6 +258,7 @@ type RepoChipProps = {
branchIntent?: BranchIntent;
onRepositoryChange: (value: string) => void;
onBranchChange: (value: string) => void;
+ onBaseBranchChange?: (value: string) => void;
onPolicyChange?: (policyId: string, baseBranch: string) => void;
onPolicySelected?: () => void;
branchPolicyDisabledReason?: string;
@@ -278,6 +274,7 @@ function useRepoChipBranchData({
row,
workspaceId,
onBranchChange,
+ branchValue,
preferredDefaultBranch,
preferredDefaultBranchLoading,
lastUsedBranch,
@@ -287,10 +284,13 @@ function useRepoChipBranchData({
| "row"
| "workspaceId"
| "onBranchChange"
+ | "branchValue"
| "preferredDefaultBranch"
| "preferredDefaultBranchLoading"
| "lastUsedBranch"
| "userSettingsLoaded"
+ | "savedBaseBranch"
+ | "isLocalExecutor"
>) {
const branchSource = useMemo(() => {
if (!workspaceId) return null;
@@ -306,19 +306,20 @@ function useRepoChipBranchData({
branches,
isLoading: branchesLoading,
refresh: refreshBranches,
+ isLoaded: branchesLoaded,
} = useBranches(branchSource, !!branchSource);
useRepoBranchAutoselect({
branchSource,
branchesLoading,
branches,
- rowBranch: row.branch,
+ rowBranch: branchValue,
onBranchChange,
preferredDefaultBranch,
preferredDefaultBranchLoading,
lastUsedBranch,
userSettingsLoaded,
});
- return { branches, branchesLoading, refreshBranches };
+ return { branches, branchesLoading, branchesLoaded, refreshBranches };
}
function useRepoChipData({
@@ -333,6 +334,9 @@ function useRepoChipData({
preferredDefaultBranchLoading,
lastUsedBranch,
userSettingsLoaded,
+ branchValue,
+ savedBaseBranch,
+ isLocalExecutor,
}: Pick<
RepoChipProps,
| "row"
@@ -346,6 +350,9 @@ function useRepoChipData({
| "preferredDefaultBranchLoading"
| "lastUsedBranch"
| "userSettingsLoaded"
+ | "branchValue"
+ | "savedBaseBranch"
+ | "isLocalExecutor"
>) {
const filteredRepos = useMemo(
() => repositories.filter((r) => !excludedRepoIds.has(r.id) || r.id === row.repositoryId),
@@ -364,10 +371,11 @@ function useRepoChipData({
(!excludedRepoIds.has(r.path) || r.path === row.localPath),
);
}, [filteredRepos, discoveredRepositories, excludedRepoIds, row.localPath]);
- const { branches, branchesLoading, refreshBranches } = useRepoChipBranchData({
+ const { branches, branchesLoading, branchesLoaded, refreshBranches } = useRepoChipBranchData({
row,
workspaceId,
onBranchChange,
+ branchValue,
preferredDefaultBranch,
preferredDefaultBranchLoading,
lastUsedBranch,
@@ -375,50 +383,34 @@ function useRepoChipData({
});
const repoOptions: PillOption[] = useMemo(
- () => [
- ...filteredRepos.map((r) => ({
- value: r.id,
- label: r.name,
- keywords: [r.name, r.local_path, formatUserHomePath(r.local_path)].filter(
- (s): s is string => !!s,
- ),
- renderLabel: () =>
- renderWorkspaceRepoOption(
- r,
- selectedElsewhere.has(repoIdIdentity(r.id)) ||
- (!!r.local_path && selectedElsewhere.has(repoPathIdentity(r.local_path))),
- ),
- })),
- ...filteredDiscovered.map((r) => ({
- value: r.path,
- label: leafSegment(r.path),
- keywords: [r.path, formatUserHomePath(r.path)],
- renderLabel: () =>
- renderDiscoveredRepoOption(r.path, selectedElsewhere.has(repoPathIdentity(r.path))),
- })),
- ],
+ () => buildRepoOptions(filteredRepos, filteredDiscovered, selectedElsewhere),
[filteredRepos, filteredDiscovered, selectedElsewhere],
);
- const branchOptions: PillOption[] = useMemo(
- () => sortBranches(branches).map(branchToOption),
- [branches],
+ const { baseBranchOptions, defaultBranch } = useMemo(
+ () =>
+ buildRepoBaseBranchData({
+ branches,
+ branchesLoaded,
+ savedBaseBranch,
+ row,
+ repositories,
+ discoveredRepositories,
+ }),
+ [branches, branchesLoaded, discoveredRepositories, repositories, row, savedBaseBranch],
);
- return { repoOptions, branchOptions, branches, branchesLoading, refreshBranches };
-}
-
-function computeRepoChipDisplay(
- row: TaskRepoRow,
- repositories: Repository[],
- discoveredRepositories: LocalRepository[],
-) {
- const workspaceRepo = repositories.find((r) => r.id === row.repositoryId);
- const discoveredRepo = discoveredRepositories.find((r) => r.path === row.localPath);
- const repoLabel = workspaceRepo?.name ?? (discoveredRepo ? leafSegment(discoveredRepo.path) : "");
- const repoPath = workspaceRepo?.local_path || discoveredRepo?.path || "";
- const repoTooltip = repoPath
- ? t("task:repositoryWithPath", { path: formatUserHomePath(repoPath) })
- : t("task:repository2");
- return { repoLabel, repoTooltip };
+ const branchOptions: PillOption[] = useMemo(() => {
+ if (!isLocalExecutor && savedBaseBranch) return baseBranchOptions;
+ return sortBranches(branches).map(branchToOption);
+ }, [baseBranchOptions, branches, isLocalExecutor, savedBaseBranch]);
+ return {
+ repoOptions,
+ branchOptions,
+ baseBranchOptions,
+ defaultBranch,
+ branches,
+ branchesLoading,
+ refreshBranches,
+ };
}
type RepoChipData = ReturnType;
@@ -437,6 +429,9 @@ function RepoChip(props: RepoChipProps) {
preferredDefaultBranchLoading,
lastUsedBranch,
userSettingsLoaded,
+ isLocalExecutor,
+ branchValue,
+ savedBaseBranch,
} = props;
const data = useRepoChipData({
row,
@@ -446,6 +441,9 @@ function RepoChip(props: RepoChipProps) {
excludedRepoIds,
selectedElsewhere,
onBranchChange,
+ isLocalExecutor,
+ branchValue: branchValue ?? row.branch,
+ savedBaseBranch,
preferredDefaultBranch,
preferredDefaultBranchLoading,
lastUsedBranch,
@@ -473,10 +471,14 @@ function RepoChipContent({
repositories,
discoveredRepositories,
branchLocked,
+ branchValue,
+ isLocalExecutor,
+ savedBaseBranch,
preferredDefaultBranchLoading,
branchIntent,
onRepositoryChange,
onBranchChange,
+ onBaseBranchChange,
onPolicyChange,
onPolicySelected,
branchPolicyDisabledReason,
@@ -487,7 +489,15 @@ function RepoChipContent({
showDiscoveryControls,
workspaceId,
}: RepoChipProps & { data: RepoChipData; branchPolicies: RepositoryBranchPolicy[] }) {
- const { repoOptions, branchOptions, branches, branchesLoading, refreshBranches } = data;
+ const {
+ repoOptions,
+ branchOptions,
+ baseBranchOptions,
+ defaultBranch,
+ branches,
+ branchesLoading,
+ refreshBranches,
+ } = data;
const { repoLabel, repoTooltip } = computeRepoChipDisplay(
row,
repositories,
@@ -499,6 +509,7 @@ function RepoChipContent({
branches,
branchOptions,
branchesLoading,
+ branchValue: branchValue ?? row.branch,
preferredDefaultBranchLoading,
policyDisabledReason: branchPolicyDisabledReason,
onBranchChange,
@@ -534,6 +545,17 @@ function RepoChipContent({
branchesLoading={branchesLoading}
refreshBranches={refreshBranches}
/>
+ {isLocalExecutor && savedBaseBranch ? (
+ undefined)}
+ refreshBranches={refreshBranches}
+ />
+ ) : null}
);
@@ -558,61 +580,3 @@ function RepoChipRemoveButton({ onRemove }: { onRemove: () => void }) {
);
}
-
-function normalizeRepoPath(path: string): string {
- return path.replace(/\\/g, "/").replace(/\/+$/g, "");
-}
-
-function renderWorkspaceRepoOption(repo: Repository, alreadyAdded: boolean) {
- const display = repo.local_path ? formatUserHomePath(repo.local_path) : "";
- return (
-
-
- {repo.name}
- {display ? (
- {display}
- ) : null}
-
- {alreadyAdded ? : null}
-
- );
-}
-
-function renderDiscoveredRepoOption(path: string, alreadyAdded: boolean) {
- const display = formatUserHomePath(path);
- return (
-
-
- {leafSegment(path)}
- {display}
-
-
- {t("task:onDisk")}
-
- {alreadyAdded ? : null}
-
- );
-}
-
-function AlreadyAddedMarker() {
- const { t } = useTranslation();
- return (
-
-
-
- );
-}
-
-function leafSegment(path: string): string {
- const cleaned = path.replace(/\\/g, "/").replace(/\/+$/g, "");
- const idx = cleaned.lastIndexOf("/");
- return idx >= 0 ? cleaned.slice(idx + 1) : cleaned;
-}
diff --git a/apps/web/e2e/README.md b/apps/web/e2e/README.md
index ee60dcb3cd..b249dab741 100644
--- a/apps/web/e2e/README.md
+++ b/apps/web/e2e/README.md
@@ -95,7 +95,7 @@ Same as `chromium` but on Playwright's Pixel-5 viewport, gated on `tests/**/mobi
This project:
- **Skips entirely** when no Docker daemon is reachable. Contributors without Docker can still run `chromium` + `mobile-chrome`.
-- **Builds container images on demand.** First run builds `kandev-agent:e2e` (slim Node base + git), `kandev-sshd:e2e` (Alpine + openssh-server + git + pre-baked mock-agent), and the Kubernetes runtime/backend image. Subsequent runs hit Docker's layer cache.
+- **Builds container images on demand.** First run builds `kandev-agent:e2e` (slim Node base + git), `kandev-sshd:e2e` (Alpine + openssh-server + git + pre-baked mock-agent), and a Kubernetes runtime/backend image derived from its pinned CI runtime base. Subsequent runs hit Docker's layer cache.
- **Has a longer per-test timeout** (180s vs 60s) because container starts + agent setup are slow.
How to run it locally (requires Docker running):
@@ -166,6 +166,11 @@ KANDEV_E2E_CONTAINERS=1 \
pnpm e2e:run --host --project kubernetes-compat tests/kubernetes-compat
```
+The fixture application image uses the immutable `KUBERNETES_E2E_BASE_IMAGE`
+pin from `kubernetes-pins.ts`. CI pre-pulls this prebuilt GHCR runtime image
+with bounded retries. The per-run image build only copies the current backend
+and web artifacts, so it does not contact an Ubuntu package mirror.
+
The compatibility fixture uses the same exact-name ownership marker, narrow
teardown, foreign-image refusal, and credential-redacted diagnostics as the full
suite. Unsupported version selectors fail before provisioning.
diff --git a/apps/web/e2e/fixtures/kubernetes-pins.ts b/apps/web/e2e/fixtures/kubernetes-pins.ts
index 5c03c2102b..fe71f85519 100644
--- a/apps/web/e2e/fixtures/kubernetes-pins.ts
+++ b/apps/web/e2e/fixtures/kubernetes-pins.ts
@@ -17,7 +17,7 @@ export type KubernetesFixtureVersion = keyof typeof KUBERNETES_FIXTURE_PINS;
export const KUBERNETES_VERSION: KubernetesFixtureVersion = "v1.36.1";
export const KIND_NODE_IMAGE = KUBERNETES_FIXTURE_PINS[KUBERNETES_VERSION].nodeImage;
export const KUBERNETES_E2E_BASE_IMAGE =
- "ubuntu:24.04@sha256:33ceb71981b602c1a7443a53469e4dba065f7503eab3078a2d7a57a2ab987517";
+ "ghcr.io/kdlbs/kandev-ci:runtime-sha-6f288a23c526@sha256:b9636e1c20adb0fcce1c65858a767fb1b0fe48a15ac5688b9c623163575efb8d";
export const KIND_SHA256_AMD64 = "50030de23cf40a18505f20426f6a8506bedf13c6e509244bd1fa9463721b0f54";
export const KUBECTL_SHA256_AMD64 = KUBERNETES_FIXTURE_PINS[KUBERNETES_VERSION].kubectlSha256Amd64;
diff --git a/apps/web/e2e/fixtures/kubernetes-tools.ts b/apps/web/e2e/fixtures/kubernetes-tools.ts
index e35a8775be..4d20807302 100644
--- a/apps/web/e2e/fixtures/kubernetes-tools.ts
+++ b/apps/web/e2e/fixtures/kubernetes-tools.ts
@@ -211,9 +211,6 @@ function buildRuntimeImage(tag: string): void {
requireBuildArtifacts();
const context = fs.mkdtempSync(path.join(os.tmpdir(), "kandev-kubernetes-e2e-image-"));
const dockerfile = `FROM ${KUBERNETES_E2E_BASE_IMAGE}
-RUN apt-get update \\
- && apt-get install -y --no-install-recommends ca-certificates curl git \\
- && rm -rf /var/lib/apt/lists/*
COPY kandev /usr/local/bin/kandev
COPY agentctl-linux-amd64 /usr/local/bin/agentctl-linux-amd64
COPY mock-agent-linux-amd64 /usr/local/bin/mock-agent
diff --git a/apps/web/e2e/helpers/api-client.ts b/apps/web/e2e/helpers/api-client.ts
index f6ca85bef2..0879a1890d 100644
--- a/apps/web/e2e/helpers/api-client.ts
+++ b/apps/web/e2e/helpers/api-client.ts
@@ -899,19 +899,30 @@ export class ApiClient {
}
/**
- * Creates a repository set. `repositoryIds` is ordered and is the order the set
- * fills the task-creation picker.
+ * Creates a repository set. The member list is ordered and is the order the
+ * set fills the task-creation picker. String ids keep the compatibility
+ * payload available for older scenarios; member objects exercise saved bases.
*/
async createRepositorySet(
workspaceId: string,
name: string,
- repositoryIds: string[],
+ repositoryIds: string[] | Array<{ repositoryId: string; baseBranch?: string }>,
description = "",
): Promise<{ id: string; name: string }> {
+ const members = repositoryIds.filter(
+ (entry): entry is { repositoryId: string; baseBranch?: string } => typeof entry !== "string",
+ );
return this.request("POST", `/api/v1/workspaces/${workspaceId}/repository-sets`, {
name,
description,
- repository_ids: repositoryIds,
+ ...(members.length === repositoryIds.length
+ ? {
+ repositories: members.map((member) => ({
+ repository_id: member.repositoryId,
+ base_branch: member.baseBranch ?? "",
+ })),
+ }
+ : { repository_ids: repositoryIds }),
});
}
@@ -970,7 +981,7 @@ export class ApiClient {
id: string;
name: string;
description: string;
- repositories: Array<{ repository_id: string; position: number }>;
+ repositories: Array<{ repository_id: string; position: number; base_branch?: string }>;
}>;
total: number;
}> {
diff --git a/apps/web/e2e/scripts/kubernetes-pins.test.ts b/apps/web/e2e/scripts/kubernetes-pins.test.ts
index 6804bad39b..eb8e5ba64c 100644
--- a/apps/web/e2e/scripts/kubernetes-pins.test.ts
+++ b/apps/web/e2e/scripts/kubernetes-pins.test.ts
@@ -7,6 +7,7 @@ import {
KIND_VERSION,
KUBECTL_SHA256_AMD64,
KUBERNETES_FIXTURE_PINS,
+ KUBERNETES_E2E_BASE_IMAGE,
KUBERNETES_VERSION,
resolveKubernetesFixturePin,
} from "../fixtures/kubernetes-pins";
@@ -22,6 +23,8 @@ const CURRENT_KUBECTL_SHA256_AMD64 =
"629d3f410e09bf49b64ae7079f7f0bda1191efed311f7d37fdbab0ad5b0ec2b7";
const CURRENT_KIND_NODE_IMAGE =
"kindest/node:v1.36.1@sha256:3489c7674813ba5d8b1a9977baea8a6e553784dab7b84759d1014dbd78f7ebd5";
+const KUBERNETES_E2E_RUNTIME_IMAGE =
+ "ghcr.io/kdlbs/kandev-ci:runtime-sha-6f288a23c526@sha256:b9636e1c20adb0fcce1c65858a767fb1b0fe48a15ac5688b9c623163575efb8d";
describe("Kubernetes E2E version pins", () => {
it("uses the current supported Kubernetes release for the full lifecycle fixture", () => {
@@ -49,6 +52,17 @@ describe("Kubernetes E2E version pins", () => {
expect(() => resolveKubernetesFixturePin("v1.33.0")).toThrow(/unsupported/);
});
+ it("uses a prebuilt immutable runtime image for Kubernetes fixture containers", () => {
+ const tools = fs.readFileSync(
+ path.join(REPOSITORY_ROOT, "apps/web/e2e/fixtures/kubernetes-tools.ts"),
+ "utf8",
+ );
+
+ expect(KUBERNETES_E2E_BASE_IMAGE).toBe(KUBERNETES_E2E_RUNTIME_IMAGE);
+ expect(tools).toContain("FROM ${KUBERNETES_E2E_BASE_IMAGE}");
+ expect(tools).not.toContain("RUN apt-get update");
+ });
+
it("keeps CI tool installation aligned with the fixture", () => {
const workflow = fs.readFileSync(
path.join(REPOSITORY_ROOT, ".github/workflows/e2e-tests.yml"),
@@ -61,6 +75,7 @@ describe("Kubernetes E2E version pins", () => {
KUBERNETES_VERSION,
KUBECTL_SHA256_AMD64,
KIND_NODE_IMAGE,
+ KUBERNETES_E2E_BASE_IMAGE,
]) {
expect(workflow).toContain(pin);
}
@@ -94,6 +109,8 @@ describe("Kubernetes E2E version pins", () => {
expect(workflow).toContain("KANDEV_E2E_KUBERNETES_VERSION");
expect(workflow).toContain("KANDEV_E2E_BUILD_IDENTITY");
expect(workflow).toContain("KANDEV_E2E_EXPECTED_SOURCE_REVISION");
+ expect(workflow).toContain("Pull pinned Kubernetes fixture base image");
+ expect(workflow).toMatch(/for attempt in 1 2 3; do[\s\S]*docker pull/);
expect(workflow).not.toContain("KANDEV_E2E_SKIP_FRESHNESS");
for (const pin of [
OLDEST_KUBERNETES_VERSION,
diff --git a/apps/web/e2e/tests/settings/mobile-workspace-repository-sets.spec.ts b/apps/web/e2e/tests/settings/mobile-workspace-repository-sets.spec.ts
index d511c95767..688945d5f7 100644
--- a/apps/web/e2e/tests/settings/mobile-workspace-repository-sets.spec.ts
+++ b/apps/web/e2e/tests/settings/mobile-workspace-repository-sets.spec.ts
@@ -1,7 +1,162 @@
+import { execSync } from "node:child_process";
+import fs from "node:fs";
+import path from "node:path";
import { test, expect } from "../../fixtures/test-base";
import { assertNoDocumentHorizontalOverflow } from "../../helpers/layout-assertions";
+import { makeGitEnv } from "../../helpers/git-helper";
test.describe("Mobile workspace repository sets", () => {
+ test("scrolls a long branch list by touch without dismissing the editor", async ({
+ testPage,
+ apiClient,
+ seedData,
+ backend,
+ prCapture,
+ }) => {
+ const dir = path.join(backend.tmpDir, "repos", "mobile-set-scroll");
+ fs.mkdirSync(dir, { recursive: true });
+ const gitEnv = makeGitEnv(backend.tmpDir);
+ execSync('git init -b main && git commit --allow-empty -m "init"', { cwd: dir, env: gitEnv });
+ for (let index = 0; index < 40; index++) {
+ execSync(`git branch scroll-test-${index}`, { cwd: dir, env: gitEnv });
+ }
+ const repository = await apiClient.createRepository(seedData.workspaceId, dir, "main", {
+ name: "Mobile branch scrolling",
+ });
+ const set = await apiClient.createRepositorySet(seedData.workspaceId, "Touch scroll", [
+ repository.id,
+ ]);
+ try {
+ await testPage.goto(`/settings/workspaces/${seedData.workspaceId}/repositories`);
+ await testPage.getByTestId(`repository-set-edit-${set.id}`).tap();
+ await testPage.getByTestId(`repository-set-base-${repository.id}`).tap();
+ const dropdown = testPage.getByTestId(`repository-set-base-dropdown-${repository.id}`);
+ const list = dropdown.getByRole("listbox");
+ await expect(list.getByRole("option", { name: /scroll-test-39/ })).toBeAttached();
+ const box = await list.boundingBox();
+ expect(box).not.toBeNull();
+ const cdp = await testPage.context().newCDPSession(testPage);
+ try {
+ const x = box!.x + box!.width / 2;
+ const y = box!.y + box!.height - 20;
+ await cdp.send("Input.dispatchTouchEvent", { type: "touchStart", touchPoints: [{ x, y }] });
+ for (let step = 1; step <= 6; step++) {
+ await cdp.send("Input.dispatchTouchEvent", {
+ type: "touchMove",
+ touchPoints: [{ x, y: y - step * 30 }],
+ });
+ }
+ await cdp.send("Input.dispatchTouchEvent", { type: "touchEnd", touchPoints: [] });
+ await expect.poll(() => list.evaluate((element) => element.scrollTop)).toBeGreaterThan(0);
+ } finally {
+ await cdp.detach();
+ }
+ await expect(testPage.getByTestId("repository-set-editor-surface")).toBeVisible();
+ await expect(dropdown).toBeVisible();
+ await assertNoDocumentHorizontalOverflow(testPage, "mobile branch scroll");
+ await prCapture.screenshot("mobile-repository-set-branch-scroll", {
+ caption:
+ "Touch scrolling moves the branch list without dismissing the repository set editor.",
+ });
+ await dropdown.getByPlaceholder("Search branches...").fill("scroll-test-39");
+ await dropdown.getByRole("option", { name: /scroll-test-39/ }).tap();
+ await expect(testPage.getByTestId(`repository-set-base-${repository.id}`)).toContainText(
+ "scroll-test-39",
+ );
+ } finally {
+ await apiClient.deleteRepositorySet(set.id);
+ await apiClient.rawRequest("DELETE", `/api/v1/repositories/${repository.id}`);
+ }
+ });
+
+ test("opens the inline editor as a contained full-height drawer", async ({
+ testPage,
+ apiClient,
+ seedData,
+ backend,
+ prCapture,
+ }) => {
+ await testPage.setViewportSize({ width: 390, height: 844 });
+ const setName = `Mobile editor set ${Date.now()}`;
+ const created = await apiClient.createRepositorySet(seedData.workspaceId, setName, [
+ seedData.repositoryId,
+ ]);
+
+ await testPage.goto(`/settings/workspaces/${seedData.workspaceId}/repositories`);
+ await testPage.getByTestId(`repository-set-edit-${created.id}`).tap();
+
+ const surface = testPage.getByTestId("repository-set-editor-surface");
+ await expect(surface).toBeVisible();
+ await expect(surface).toHaveClass(/h-\[100dvh\]/);
+ await expect.poll(async () => (await surface.boundingBox())?.height).toBe(844);
+ await expect(testPage.getByTestId("repository-set-editor-form")).toHaveClass(
+ /min-h-0.*overflow-y-auto/,
+ );
+ const membersHint = testPage.getByText(
+ "Add repositories in task order. Base branches are optional.",
+ );
+ const addRepository = testPage.getByTestId("repository-set-add-repository");
+ const [membersHintBox, addRepositoryBox] = await Promise.all([
+ membersHint.boundingBox(),
+ addRepository.boundingBox(),
+ ]);
+ expect(membersHintBox).not.toBeNull();
+ expect(addRepositoryBox).not.toBeNull();
+ expect(addRepositoryBox!.y).toBeGreaterThan(membersHintBox!.y + membersHintBox!.height);
+ expect(addRepositoryBox!.width).toBeCloseTo(membersHintBox!.width, 0);
+ await testPage.getByTestId(`repository-set-remove-${seedData.repositoryId}`).tap();
+ await addRepository.tap();
+ await testPage.getByRole("option", { name: /E2E Repo/ }).tap();
+ await expect(
+ testPage.getByTestId(`repository-set-base-${seedData.repositoryId}`),
+ ).toBeVisible();
+ await prCapture.screenshot("mobile-repository-set-editor", {
+ caption:
+ "The mobile repository set editor uses a full-height drawer with a fixed action bar.",
+ });
+
+ for (const control of [
+ testPage.getByTestId("repository-set-editor-save"),
+ testPage.getByTestId("repository-set-editor-cancel"),
+ testPage.getByTestId(`repository-set-base-${seedData.repositoryId}`),
+ addRepository,
+ testPage.getByTestId("repository-set-reset-bases"),
+ ]) {
+ const box = await control.boundingBox();
+ expect(box).not.toBeNull();
+ expect(box!.height).toBeGreaterThanOrEqual(44);
+ }
+
+ execSync("git update-ref refs/remotes/origin/main HEAD", {
+ cwd: seedData.repositoryPath,
+ env: makeGitEnv(backend.tmpDir),
+ });
+ const basePicker = testPage.getByTestId(`repository-set-base-${seedData.repositoryId}`);
+ await basePicker.tap();
+ const dropdown = testPage.getByTestId(`repository-set-base-dropdown-${seedData.repositoryId}`);
+ await expect(dropdown).toBeVisible();
+ await expect(dropdown.getByPlaceholder("Search branches...")).toBeVisible();
+ await expect(dropdown.getByText("origin/main")).toBeVisible();
+ await expect(dropdown.getByText("origin", { exact: true })).toBeVisible();
+
+ const search = dropdown.getByPlaceholder("Search branches...");
+ await search.fill("origin");
+ await expect(dropdown.getByRole("option", { name: /^origin\/main origin/ })).toBeVisible();
+ await expect(dropdown.getByRole("option", { name: /^main local/ })).toHaveCount(0);
+ await dropdown.getByTestId("branch-refresh-button").tap();
+ await expect(dropdown.getByRole("option", { name: /^origin\/main origin/ })).toBeVisible();
+
+ const dropdownBox = await dropdown.boundingBox();
+ const viewport = testPage.viewportSize();
+ expect(dropdownBox).not.toBeNull();
+ expect(viewport).not.toBeNull();
+ expect(dropdownBox!.x).toBeGreaterThanOrEqual(0);
+ expect(dropdownBox!.y).toBeGreaterThanOrEqual(0);
+ expect(dropdownBox!.x + dropdownBox!.width).toBeLessThanOrEqual(viewport!.width);
+ expect(dropdownBox!.y + dropdownBox!.height).toBeLessThanOrEqual(viewport!.height);
+ await assertNoDocumentHorizontalOverflow(testPage, "mobile repository-set editor");
+ });
+
test("confirms deletion inline without a second overlay", async ({
testPage,
apiClient,
diff --git a/apps/web/e2e/tests/settings/workspace-repository-sets.spec.ts b/apps/web/e2e/tests/settings/workspace-repository-sets.spec.ts
index 86b3c5a7a1..cf82a7b182 100644
--- a/apps/web/e2e/tests/settings/workspace-repository-sets.spec.ts
+++ b/apps/web/e2e/tests/settings/workspace-repository-sets.spec.ts
@@ -3,6 +3,7 @@ import fs from "node:fs";
import path from "node:path";
import { test, expect } from "../../fixtures/test-base";
import { makeGitEnv } from "../../helpers/git-helper";
+import { expectControlHeight } from "../../helpers/control-sizing";
const SET_ROW = "repository-set-row";
const EDITOR_NAME = "repository-set-editor-name";
@@ -15,12 +16,22 @@ test.describe("Workspace repository sets settings", () => {
apiClient,
seedData,
backend,
+ prCapture,
}) => {
const dir = path.join(backend.tmpDir, "repos", "settings-repository-sets");
+ const remoteDir = path.join(backend.tmpDir, "repos", "settings-repository-sets-origin.git");
fs.mkdirSync(dir, { recursive: true });
const gitEnv = makeGitEnv(backend.tmpDir);
+ execSync(`git init --bare -b main "${remoteDir}"`, { env: gitEnv });
execSync("git init -b main", { cwd: dir, env: gitEnv });
execSync('git commit --allow-empty -m "init"', { cwd: dir, env: gitEnv });
+ execSync("git branch develop", { cwd: dir, env: gitEnv });
+ for (let index = 0; index < 40; index++) {
+ execSync(`git branch scroll-test-${index}`, { cwd: dir, env: gitEnv });
+ }
+ execSync(`git remote add origin "file://${remoteDir}"`, { cwd: dir, env: gitEnv });
+ execSync("git push origin main", { cwd: dir, env: gitEnv });
+ execSync("git update-ref refs/remotes/origin/main HEAD", { cwd: dir, env: gitEnv });
const second = await apiClient.createRepository(seedData.workspaceId, dir, "main", {
name: SECOND_REPO_NAME,
});
@@ -31,9 +42,78 @@ test.describe("Workspace repository sets settings", () => {
// Create a set holding both repositories.
const setName = `Settings set ${Date.now()}`;
await testPage.getByTestId("repository-set-create").click();
+ const membersHint = testPage.getByText(
+ "Add repositories in task order. Base branches are optional.",
+ );
+ const addRepository = testPage.getByTestId("repository-set-add-repository");
+ const [membersHintBox, addRepositoryBox] = await Promise.all([
+ membersHint.boundingBox(),
+ addRepository.boundingBox(),
+ ]);
+ expect(membersHintBox).not.toBeNull();
+ expect(addRepositoryBox).not.toBeNull();
+ expect(membersHintBox!.width).toBeGreaterThan(addRepositoryBox!.width);
await testPage.getByTestId(EDITOR_NAME).fill(setName);
- await testPage.getByTestId(`repository-set-member-${seedData.repositoryId}`).click();
- await testPage.getByTestId(`repository-set-member-${second.id}`).click();
+ await addRepository.click();
+ const repositoryOption = testPage.getByRole("option", { name: /E2E Repo/ });
+ await expect(repositoryOption).toBeVisible();
+ await expect
+ .poll(() =>
+ repositoryOption.evaluate((element) => {
+ const box = element.getBoundingClientRect();
+ return [box.x + 8, box.right - 8].every((x) =>
+ element.contains(document.elementFromPoint(x, box.y + box.height / 2)),
+ );
+ }),
+ )
+ .toBe(true);
+ await prCapture.screenshot("desktop-repository-set-add-picker", {
+ caption: "The repository picker remains fully clickable outside the scrolling form.",
+ });
+ await testPage.getByRole("option", { name: /E2E Repo/ }).click();
+ await testPage.getByTestId("repository-set-add-repository").click();
+ await testPage.getByRole("option", { name: SECOND_REPO_NAME }).click();
+ const basePicker = testPage.getByTestId(`repository-set-base-${second.id}`);
+ for (const control of [
+ addRepository,
+ basePicker,
+ testPage.getByTestId("repository-set-reset-bases"),
+ testPage.getByTestId(`repository-set-remove-${second.id}`),
+ ])
+ await expectControlHeight(control, 28);
+ await basePicker.click();
+ const dropdown = testPage.getByTestId(`repository-set-base-dropdown-${second.id}`);
+ await expect(dropdown).toBeVisible();
+ await expect(dropdown.getByPlaceholder("Search branches...")).toBeVisible();
+ await expect(dropdown.getByText("Branches")).toBeVisible();
+ await expect(dropdown.getByRole("option", { name: /^main local/ })).toBeVisible();
+ await expect(dropdown.getByRole("option", { name: /^origin\/main origin/ })).toBeVisible();
+ await expect(dropdown.getByText("origin", { exact: true })).toBeVisible();
+
+ const branchList = dropdown.getByRole("listbox");
+ await branchList.hover();
+ await testPage.mouse.wheel(0, 500);
+ await expect.poll(() => branchList.evaluate((element) => element.scrollTop)).toBeGreaterThan(0);
+ await prCapture.screenshot("desktop-repository-set-branch-scroll", {
+ caption: "Mouse-wheel scrolling reaches branches beyond the initial list inside the dialog.",
+ });
+ await testPage.mouse.wheel(0, -500);
+ await expect.poll(() => branchList.evaluate((element) => element.scrollTop)).toBe(0);
+
+ const search = dropdown.getByPlaceholder("Search branches...");
+ await search.fill("origin");
+ await expect(dropdown.getByRole("option", { name: /^origin\/main origin/ })).toBeVisible();
+ await expect(dropdown.getByRole("option", { name: /^main local/ })).toHaveCount(0);
+ await dropdown.getByTestId("branch-refresh-button").click();
+ await expect(dropdown.getByRole("option", { name: /^origin\/main origin/ })).toBeVisible();
+
+ await search.fill("");
+ const develop = dropdown.getByRole("option", { name: /^develop local/ });
+ await expect(develop).toBeVisible();
+ await develop.click();
+ await prCapture.screenshot("desktop-repository-set-editor", {
+ caption: "The desktop repository set editor assigns a saved base branch per member.",
+ });
await testPage.getByTestId(EDITOR_SAVE).click();
const rows = testPage.getByTestId(SET_ROW);
@@ -43,9 +123,16 @@ test.describe("Workspace repository sets settings", () => {
await expect
.poll(async () => {
const listed = await apiClient.listRepositorySets(seedData.workspaceId);
- return listed.repository_sets.find((entry) => entry.name === setName)?.repositories.length;
+ const stored = listed.repository_sets.find((entry) => entry.name === setName);
+ return (
+ stored?.repositories.length === 2 &&
+ stored.repositories.some((member) => member.repository_id === seedData.repositoryId) &&
+ stored.repositories.some((member) => member.repository_id === second.id) &&
+ stored.repositories.find((member) => member.repository_id === second.id)?.base_branch ===
+ "develop"
+ );
})
- .toBe(2);
+ .toBe(true);
const createdId = (
await apiClient.listRepositorySets(seedData.workspaceId)
@@ -53,7 +140,7 @@ test.describe("Workspace repository sets settings", () => {
// Edit: drop one member. A supplied membership replaces the whole list.
await testPage.getByTestId(`repository-set-edit-${createdId}`).click();
- await testPage.getByTestId(`repository-set-member-${second.id}`).click();
+ await testPage.getByTestId(`repository-set-remove-${second.id}`).click();
await testPage.getByTestId(EDITOR_SAVE).click();
await expect(rows.first()).toHaveAttribute("data-member-count", "1");
diff --git a/apps/web/e2e/tests/task/create-task-repository-sets.spec.ts b/apps/web/e2e/tests/task/create-task-repository-sets.spec.ts
index d7bb66e6c8..15af3a8c0c 100644
--- a/apps/web/e2e/tests/task/create-task-repository-sets.spec.ts
+++ b/apps/web/e2e/tests/task/create-task-repository-sets.spec.ts
@@ -15,7 +15,9 @@ const REPO_CHIP_TRIGGER = "repo-chip-trigger";
const SECOND_REPO_NAME = "Repository Sets Target";
const SET_NAME = "Full-stack";
-type TaskWithRepos = { repositories?: Array<{ repository_id: string }> };
+type TaskWithRepos = {
+ repositories?: Array<{ repository_id: string; base_branch?: string }>;
+};
/**
* Seeds a second workspace repository plus a set containing both, and returns
@@ -32,25 +34,33 @@ async function seedSetWithTwoRepositories(
createRepositorySet: (
workspaceId: string,
name: string,
- repositoryIds: string[],
+ repositoryIds: string[] | Array<{ repositoryId: string; baseBranch?: string }>,
) => Promise<{ id: string; name: string }>;
},
seedData: { workspaceId: string; repositoryId: string },
backend: { tmpDir: string },
- options: { setName?: string; dirName?: string } = {},
+ options: { setName?: string; dirName?: string; savedBases?: boolean } = {},
) {
const dir = path.join(backend.tmpDir, "repos", options.dirName ?? "repository-sets-target");
fs.mkdirSync(dir, { recursive: true });
const gitEnv = makeGitEnv(backend.tmpDir);
execSync("git init -b main", { cwd: dir, env: gitEnv });
execSync('git commit --allow-empty -m "init"', { cwd: dir, env: gitEnv });
+ execSync("git branch develop", { cwd: dir, env: gitEnv });
const second = await apiClient.createRepository(seedData.workspaceId, dir, "main", {
name: SECOND_REPO_NAME,
});
+ const members: string[] | Array<{ repositoryId: string; baseBranch?: string }> =
+ options.savedBases
+ ? [
+ { repositoryId: seedData.repositoryId, baseBranch: "main" },
+ { repositoryId: second.id, baseBranch: "develop" },
+ ]
+ : [seedData.repositoryId, second.id];
const set = await apiClient.createRepositorySet(
seedData.workspaceId,
options.setName ?? SET_NAME,
- [seedData.repositoryId, second.id],
+ members,
);
return { secondRepositoryId: second.id, setId: set.id };
}
@@ -61,8 +71,11 @@ test.describe("Task creation with repository sets", () => {
apiClient,
seedData,
backend,
+ prCapture,
}) => {
- const { secondRepositoryId } = await seedSetWithTwoRepositories(apiClient, seedData, backend);
+ const { secondRepositoryId } = await seedSetWithTwoRepositories(apiClient, seedData, backend, {
+ savedBases: true,
+ });
await testPage.goto("/");
await testPage.getByTestId("create-task-button").first().click();
@@ -80,6 +93,10 @@ test.describe("Task creation with repository sets", () => {
const chips = dialog.getByTestId(REPO_CHIP_TRIGGER);
await expect(chips).toHaveCount(2);
await expect(chips.nth(1)).toContainText(SECOND_REPO_NAME);
+ await expect(dialog.getByTestId("repo-chip").nth(1)).toContainText("develop");
+ await prCapture.screenshot("desktop-repository-set-applied", {
+ caption: "Applying a repository set on desktop fills the task picker with saved bases.",
+ });
const title = `Repository set task ${Date.now()}`;
await dialog.getByTestId("task-title-input").fill(title);
@@ -106,6 +123,9 @@ test.describe("Task creation with repository sets", () => {
const repoIds = data.repositories?.map((entry) => entry.repository_id) ?? [];
expect(repoIds).toEqual(expect.arrayContaining([seedData.repositoryId, secondRepositoryId]));
expect(repoIds).toHaveLength(2);
+ expect(
+ data.repositories?.find((entry) => entry.repository_id === secondRepositoryId)?.base_branch,
+ ).toBe("develop");
});
test("applying the same set twice adds no duplicate rows", async ({
diff --git a/apps/web/e2e/tests/task/mobile-create-task-repository-sets.spec.ts b/apps/web/e2e/tests/task/mobile-create-task-repository-sets.spec.ts
index 980e7fd07e..b730b4bd97 100644
--- a/apps/web/e2e/tests/task/mobile-create-task-repository-sets.spec.ts
+++ b/apps/web/e2e/tests/task/mobile-create-task-repository-sets.spec.ts
@@ -25,12 +25,13 @@ test.describe("Repository sets in the mobile task-create picker", () => {
const gitEnv = makeGitEnv(backend.tmpDir);
execSync("git init -b main", { cwd: dir, env: gitEnv });
execSync('git commit --allow-empty -m "init"', { cwd: dir, env: gitEnv });
+ execSync("git branch develop", { cwd: dir, env: gitEnv });
const second = await apiClient.createRepository(seedData.workspaceId, dir, "main", {
name: SECOND_REPO_NAME,
});
await apiClient.createRepositorySet(seedData.workspaceId, SET_NAME, [
- seedData.repositoryId,
- second.id,
+ { repositoryId: seedData.repositoryId, baseBranch: "main" },
+ { repositoryId: second.id, baseBranch: "develop" },
]);
const mobile = new MobileKanbanPage(testPage);
@@ -52,6 +53,7 @@ test.describe("Repository sets in the mobile task-create picker", () => {
await expect(repositoryChips).toHaveCount(2);
await expect(repositoryChips.nth(1)).toContainText(SECOND_REPO_NAME);
+ await expect(dialog.getByTestId("repo-chip").nth(1)).toContainText("develop");
if (prCapture.capturing) {
// Let the bottom sheet finish dismissing so the asset shows the resulting
@@ -62,5 +64,27 @@ test.describe("Repository sets in the mobile task-create picker", () => {
await prCapture.screenshot("mobile-repository-set-applied", {
caption: "Applying a repository set on a phone fills the picker with both members.",
});
+
+ const title = `Mobile repository set task ${Date.now()}`;
+ await dialog.getByTestId("task-title-input").fill(title);
+ await dialog.getByTestId("task-description-input").fill("Created from a mobile repository set");
+ await dialog.getByRole("button", { name: "Create only" }).tap();
+ await expect(dialog).not.toBeVisible();
+
+ let created: { id: string; title: string } | undefined;
+ await expect
+ .poll(async () => {
+ const listed = await apiClient.listTasks(seedData.workspaceId);
+ created = listed.tasks.find((entry) => entry.title === title);
+ return created;
+ })
+ .toBeDefined();
+ const raw = await apiClient.rawRequest("GET", `/api/v1/tasks/${created!.id}`);
+ const data = (await raw.json()) as {
+ repositories?: Array<{ repository_id: string; base_branch?: string }>;
+ };
+ expect(data.repositories?.find((entry) => entry.repository_id === second.id)?.base_branch).toBe(
+ "develop",
+ );
});
});
diff --git a/apps/web/hooks/domains/workspace/use-repository-branches.ts b/apps/web/hooks/domains/workspace/use-repository-branches.ts
index 861f3abcf9..9c741a0024 100644
--- a/apps/web/hooks/domains/workspace/use-repository-branches.ts
+++ b/apps/web/hooks/domains/workspace/use-repository-branches.ts
@@ -51,6 +51,8 @@ async function listBranchesUntilSettled(source: BranchSource): Promise
*/
export type UseBranchesResult = {
branches: Branch[];
+ /** True after a non-refresh request has completed, including an empty list. */
+ isLoaded: boolean;
isLoading: boolean;
/**
* Refreshes the branch list. For id-based sources the backend runs
@@ -116,6 +118,7 @@ export function useBranches(source: BranchSource | null, enabled = true): UseBra
return {
branches,
+ isLoaded,
isLoading,
refresh: source ? refresh : undefined,
};
diff --git a/apps/web/lib/api/domains/repository-sets-api.test.ts b/apps/web/lib/api/domains/repository-sets-api.test.ts
index 9563daec46..1a0eda512d 100644
--- a/apps/web/lib/api/domains/repository-sets-api.test.ts
+++ b/apps/web/lib/api/domains/repository-sets-api.test.ts
@@ -76,6 +76,25 @@ describe("repository set API client", () => {
});
});
+ it("posts ordered repository members with their saved bases", async () => {
+ await createRepositorySet("ws-1", {
+ name: "Release",
+ repositories: [
+ { repositoryId: REPO_GATEWAY, baseBranch: "develop" },
+ { repositoryId: REPO_WEB },
+ ],
+ });
+
+ expect(bodyOf(calls[0])).toEqual({
+ name: "Release",
+ description: "",
+ repositories: [
+ { repository_id: REPO_GATEWAY, base_branch: "develop" },
+ { repository_id: REPO_WEB, base_branch: "" },
+ ],
+ });
+ });
+
it("patches the flat item route and omits fields the caller left out", async () => {
await updateRepositorySet(SET_ID, { name: "Renamed" });
@@ -98,6 +117,16 @@ describe("repository set API client", () => {
expect(bodyOf(calls[0])).toEqual({ description: "" });
});
+ it("patches ordered repository members with their saved bases", async () => {
+ await updateRepositorySet(SET_ID, {
+ repositories: [{ repositoryId: REPO_WEB, baseBranch: "develop" }],
+ });
+
+ expect(bodyOf(calls[0])).toEqual({
+ repositories: [{ repository_id: REPO_WEB, base_branch: "develop" }],
+ });
+ });
+
it("deletes the flat item route", async () => {
await deleteRepositorySet(SET_ID);
diff --git a/apps/web/lib/api/domains/workspace-api.ts b/apps/web/lib/api/domains/workspace-api.ts
index f46c0f9e3c..d6eb5a1610 100644
--- a/apps/web/lib/api/domains/workspace-api.ts
+++ b/apps/web/lib/api/domains/workspace-api.ts
@@ -48,6 +48,21 @@ export async function listRepositories(
// Collection routes are workspace-scoped and item routes are flat, mirroring the
// repository routes above.
+type RepositorySetMembersPayload =
+ | {
+ repositoryIds: string[];
+ repositories?: never;
+ }
+ | {
+ repositories: Array<{ repositoryId: string; baseBranch?: string }>;
+ repositoryIds?: never;
+ };
+
+type CreateRepositorySetPayload = {
+ name: string;
+ description?: string;
+} & RepositorySetMembersPayload;
+
export async function listRepositorySets(workspaceId: string, options?: ApiRequestOptions) {
return fetchJson(
`/api/v1/workspaces/${encodeURIComponent(workspaceId)}/repository-sets`,
@@ -57,7 +72,7 @@ export async function listRepositorySets(workspaceId: string, options?: ApiReque
export async function createRepositorySet(
workspaceId: string,
- payload: { name: string; description?: string; repositoryIds: string[] },
+ payload: CreateRepositorySetPayload,
options?: ApiRequestOptions,
) {
return fetchJson(
@@ -66,11 +81,7 @@ export async function createRepositorySet(
...options,
init: {
method: "POST",
- body: JSON.stringify({
- name: payload.name,
- description: payload.description ?? "",
- repository_ids: payload.repositoryIds,
- }),
+ body: JSON.stringify(repositorySetRequestBody(payload)),
...(options?.init ?? {}),
},
},
@@ -84,19 +95,45 @@ export async function createRepositorySet(
*/
export async function updateRepositorySet(
setId: string,
- payload: { name?: string; description?: string; repositoryIds?: string[] },
+ payload: {
+ name?: string;
+ description?: string;
+ repositoryIds?: string[];
+ repositories?: Array<{ repositoryId: string; baseBranch?: string }>;
+ },
options?: ApiRequestOptions,
) {
const body: Record = {};
if (payload.name !== undefined) body.name = payload.name;
if (payload.description !== undefined) body.description = payload.description;
if (payload.repositoryIds !== undefined) body.repository_ids = payload.repositoryIds;
+ if (payload.repositories !== undefined) {
+ body.repositories = payload.repositories.map((member) => ({
+ repository_id: member.repositoryId,
+ base_branch: member.baseBranch ?? "",
+ }));
+ }
return fetchJson(`/api/v1/repository-sets/${encodeURIComponent(setId)}`, {
...options,
init: { method: "PATCH", body: JSON.stringify(body), ...(options?.init ?? {}) },
});
}
+function repositorySetRequestBody(payload: CreateRepositorySetPayload) {
+ return {
+ name: payload.name,
+ description: payload.description ?? "",
+ ...(payload.repositories
+ ? {
+ repositories: payload.repositories.map((member) => ({
+ repository_id: member.repositoryId,
+ base_branch: member.baseBranch ?? "",
+ })),
+ }
+ : { repository_ids: payload.repositoryIds ?? [] }),
+ };
+}
+
export async function deleteRepositorySet(setId: string, options?: ApiRequestOptions) {
return fetchJson(`/api/v1/repository-sets/${encodeURIComponent(setId)}`, {
...options,
diff --git a/apps/web/lib/types/backend.ts b/apps/web/lib/types/backend.ts
index 8ac27e7336..aea5bedfa0 100644
--- a/apps/web/lib/types/backend.ts
+++ b/apps/web/lib/types/backend.ts
@@ -252,7 +252,7 @@ export type RepositorySetPayload = {
workspace_id: string;
name?: string;
description?: string;
- repositories?: Array<{ repository_id: string; position: number }>;
+ repositories?: Array<{ repository_id: string; position: number; base_branch?: string }>;
created_at?: string;
updated_at?: string;
};
diff --git a/apps/web/lib/types/http.ts b/apps/web/lib/types/http.ts
index 7559ed8985..366df12312 100644
--- a/apps/web/lib/types/http.ts
+++ b/apps/web/lib/types/http.ts
@@ -348,8 +348,8 @@ export type RepositorySecretBinding = {
* A named, reusable group of workspace repositories. Applying one fills the
* task-creation repository picker in a single action.
*
- * A set deliberately carries no branch: branch choice belongs to the task, and
- * the picker's existing per-row defaulting fills it after a set is applied.
+ * A set stores an optional base branch for each member. Applying a set copies
+ * that value into the task draft; it never creates a live link to the set.
*/
export type RepositorySet = {
id: string;
@@ -365,6 +365,8 @@ export type RepositorySet = {
export type RepositorySetItem = {
repository_id: RepositoryId;
position: number;
+ /** Empty or absent means that the task form should use its normal default. */
+ base_branch?: string;
};
export type RepositoryScript = {
diff --git a/apps/web/lib/ws/handlers/repository-sets.test.ts b/apps/web/lib/ws/handlers/repository-sets.test.ts
index ec5018257b..e7f025d23c 100644
--- a/apps/web/lib/ws/handlers/repository-sets.test.ts
+++ b/apps/web/lib/ws/handlers/repository-sets.test.ts
@@ -21,7 +21,7 @@ function payload(overrides: Record = {}) {
description: "web + gateway",
repositories: [
{ repository_id: "repo-web", position: 0 },
- { repository_id: "repo-gateway", position: 1 },
+ { repository_id: "repo-gateway", position: 1, base_branch: "develop" },
],
created_at: "2026-08-17T09:00:00Z",
updated_at: "2026-08-17T09:00:00Z",
@@ -63,6 +63,7 @@ describe("repository_set WebSocket handlers", () => {
"repo-web",
"repo-gateway",
]);
+ expect(sets[0].repositories[1].base_branch).toBe("develop");
});
it("updated replaces the existing set rather than adding a second copy", () => {
diff --git a/apps/web/lib/ws/handlers/repository-sets.ts b/apps/web/lib/ws/handlers/repository-sets.ts
index bcecdcf49c..4c94acd7a9 100644
--- a/apps/web/lib/ws/handlers/repository-sets.ts
+++ b/apps/web/lib/ws/handlers/repository-sets.ts
@@ -60,6 +60,7 @@ function toRepositorySetItems(items: RepositorySetPayload["repositories"]): Repo
.map((entry, index) => ({
repository_id: repositoryId(entry.repository_id),
position: typeof entry.position === "number" ? entry.position : index,
+ base_branch: entry.base_branch ?? "",
}))
.sort((left, right) => left.position - right.position);
}
diff --git a/apps/web/src/locales/en/task.json b/apps/web/src/locales/en/task.json
index 107b4b3ea5..e18a3b6aa2 100644
--- a/apps/web/src/locales/en/task.json
+++ b/apps/web/src/locales/en/task.json
@@ -1,4 +1,6 @@
{
+ "repositorySetsSaveDuplicateRows_one": "{{count}} additional row is not included. Only the first row for each repository is saved, including its base choice.",
+ "repositorySetsSaveDuplicateRows_other": "{{count}} additional rows are not included. Only the first row for each repository is saved, including its base choice.",
"agentCliNotInstalled": "Agent CLI not installed",
"agentProbeFailed": "Agent probe failed",
"aPullRequestAlreadyExistsFor": "A pull request already exists for this task",
@@ -1271,7 +1273,7 @@
"repositoryWithPath": "Repository · {{path}}",
"repositorySetsTrigger": "Sets",
"repositorySetsSaveTitle": "Save as repository set",
- "repositorySetsSaveDescription": "Reuse this repository selection on future tasks. Branches are chosen per task and are not saved.",
+ "repositorySetsSaveDescription": "Reuse this repository selection and its saved base branches on future tasks. Checkout branches stay task-specific.",
"repositorySetsSaveNameLabel": "Name",
"repositorySetsSaveDescriptionLabel": "Description (optional)",
"repositorySetsSaveSubmit": "Save set",
@@ -1295,6 +1297,10 @@
"repositorySetsNothingToApply": "Every repository in {{name}} is already in this task",
"repositorySetsSkippedMissing_one": "{{count}} repository in {{name}} no longer exists in this workspace",
"repositorySetsSkippedMissing_other": "{{count}} repositories in {{name}} no longer exist in this workspace",
+ "repositorySetBaseUnavailable": "A saved base branch is unavailable. Choose another branch before creating the task.",
+ "repositorySetBaseForLocal": "Base: {{base}}",
+ "branchUnavailable": "This saved branch is not available. Choose another branch.",
+ "branchUnavailableShort": "Unavailable",
"requestChanges": "Request changes",
"requestedChanges": "requested changes",
"requestedChangesPlain": "{{who}} requested changes",
diff --git a/apps/web/src/locales/en/workspaces.json b/apps/web/src/locales/en/workspaces.json
index 862e2d61a1..42a6db6b31 100644
--- a/apps/web/src/locales/en/workspaces.json
+++ b/apps/web/src/locales/en/workspaces.json
@@ -136,11 +136,11 @@
"sourceFolderAlreadySelected": "This folder is already selected.",
"sourceRepoBranchAlreadySelected": "This repository and branch are already selected.",
"repositorySetsTitle": "Repository sets",
- "repositorySetsDescription": "Named groups of this workspace's repositories. Choosing a set in the task dialog fills the repository picker with its members; branches are still chosen per task.",
+ "repositorySetsDescription": "Named groups of this workspace's repositories. Choosing a set in the task dialog fills the repository picker and copies its saved base branches into the task; checkout branches remain task-specific.",
"repositorySetsCreate": "New set",
"repositorySetsCreateTitle": "New repository set",
"repositorySetsEditTitle": "Edit repository set",
- "repositorySetsEditorDescription": "Pick the repositories in this set and the order they fill the picker.",
+ "repositorySetsEditorDescription": "Pick the repositories in this set, their order, and an optional base branch for each.",
"repositorySetsEdit": "Edit set",
"repositorySetsDelete": "Delete set",
"repositorySetsDeleteTitle": "Delete {{name}}?",
@@ -151,15 +151,31 @@
"repositorySetsNameLabel": "Name",
"repositorySetsDescriptionLabel": "Description (optional)",
"repositorySetsMembersLabel": "Repositories",
- "repositorySetsMembersHint": "Select at least one. The order here is the order they are added to a task.",
+ "repositorySetsMembersHint": "Add repositories in task order. Base branches are optional.",
"repositorySetsMoveUp": "Move earlier",
"repositorySetsMoveDown": "Move later",
+ "repositorySetsRemove": "Remove repository",
"repositorySetsSave": "Save set",
"repositorySetsNameTaken": "A set with this name already exists in this workspace.",
"repositorySetsMemberRejected": "One of the chosen repositories is no longer available in this workspace.",
"repositorySetsSaveFailed": "Could not save the set. Try again.",
"repositorySetsAlreadyDeleted": "This set was already deleted. Refresh to see the current list.",
"repositorySetsDeleteFailed": "Could not delete the set. Try again.",
+ "repositorySetsAddRepository": "Add repository",
+ "repositorySetsSearchRepositories": "Search repositories...",
+ "repositorySetsNoMatchingRepositories": "No matching repositories.",
+ "repositorySetsSearchSelected": "Filter selected repositories...",
+ "repositorySetsNoMatchingMembers": "No selected repositories match this search.",
+ "repositorySetsNoMembersSelected": "No repositories selected yet.",
+ "repositorySetsResetBases": "Reset bases",
+ "repositorySetsTaskDefault": "Task default ({{branch}})",
+ "repositorySetsTaskDefaultNoBranch": "Task default",
+ "repositorySetsBaseBranchLabel": "Saved base branch",
+ "repositorySetsBaseBranchFor": "Saved base branch for {{name}}",
+ "repositorySetsBranchUnavailable": "Unavailable",
+ "repositorySetsBranchUnavailableReason": "This saved branch is not available. Choose another branch or reset to the task default.",
+ "repositorySetsMemberMissing": "Repository no longer exists in this workspace.",
+ "repositorySetsMemberBase": "base: {{base}}",
"branchPoliciesTitle": "Branch policies",
"branchPoliciesDescription": "Choose a named branch policy when you create a task. The selected policy is saved with the task.",
"branchPoliciesSaveRepositoryFirst": "Save this repository before adding branch policies.",
diff --git a/apps/web/src/locales/pseudo/task.json b/apps/web/src/locales/pseudo/task.json
index 7ca3f2417b..71097ce5e7 100644
--- a/apps/web/src/locales/pseudo/task.json
+++ b/apps/web/src/locales/pseudo/task.json
@@ -1,4 +1,6 @@
{
+ "repositorySetsSaveDuplicateRows_one": "{{count}} àďďĩţĩōńàĺ ŕōŵ ĩś ńōţ ĩńćĺũďēď. Ōńĺŷ ţĥē ƒĩŕśţ ŕōŵ ƒōŕ ēàćĥ ŕēƥōśĩţōŕŷ ĩś śàvēď, ĩńćĺũďĩńĝ ĩţś ƀàśē ćĥōĩćē.",
+ "repositorySetsSaveDuplicateRows_other": "{{count}} àďďĩţĩōńàĺ ŕōŵś àŕē ńōţ ĩńćĺũďēď. Ōńĺŷ ţĥē ƒĩŕśţ ŕōŵ ƒōŕ ēàćĥ ŕēƥōśĩţōŕŷ ĩś śàvēď, ĩńćĺũďĩńĝ ĩţś ƀàśē ćĥōĩćē.",
"agentCliNotInstalled": "Àĝēńţ ĆĹĨ ńōţ ĩńśţàĺĺēď",
"agentProbeFailed": "Àĝēńţ ƥŕōƀē ƒàĩĺēď",
"aPullRequestAlreadyExistsFor": "À ƥũĺĺ ŕēqũēśţ àĺŕēàďŷ ēxĩśţś ƒōŕ ţĥĩś ţàśķ",
@@ -1271,7 +1273,7 @@
"repositoryWithPath": "Ŕēƥōśĩţōŕŷ · {{path}}",
"repositorySetsTrigger": "Śēţś",
"repositorySetsSaveTitle": "Śàvē àś ŕēƥōśĩţōŕŷ śēţ",
- "repositorySetsSaveDescription": "Ŕēũśē ţĥĩś ŕēƥōśĩţōŕŷ śēĺēćţĩōń ōń ƒũţũŕē ţàśķś. Ɓŕàńćĥēś àŕē ćĥōśēń ƥēŕ ţàśķ àńď àŕē ńōţ śàvēď.",
+ "repositorySetsSaveDescription": "Ŕēũśē ţĥĩś ŕēƥōśĩţōŕŷ śēĺēćţĩōń àńď ĩţś śàvēď ƀàśē ƀŕàńćĥēś ōń ƒũţũŕē ţàśķś. Ćĥēćķōũţ ƀŕàńćĥēś śţàŷ ţàśķ-śƥēćĩƒĩć.",
"repositorySetsSaveNameLabel": "Ńàḿē",
"repositorySetsSaveDescriptionLabel": "Ďēśćŕĩƥţĩōń (ōƥţĩōńàĺ)",
"repositorySetsSaveSubmit": "Śàvē śēţ",
@@ -1295,6 +1297,10 @@
"repositorySetsNothingToApply": "Ēvēŕŷ ŕēƥōśĩţōŕŷ ĩń {{name}} ĩś àĺŕēàďŷ ĩń ţĥĩś ţàśķ",
"repositorySetsSkippedMissing_one": "{{count}} ŕēƥōśĩţōŕŷ ĩń {{name}} ńō ĺōńĝēŕ ēxĩśţś ĩń ţĥĩś ŵōŕķśƥàćē",
"repositorySetsSkippedMissing_other": "{{count}} ŕēƥōśĩţōŕĩēś ĩń {{name}} ńō ĺōńĝēŕ ēxĩśţ ĩń ţĥĩś ŵōŕķśƥàćē",
+ "repositorySetBaseUnavailable": "À śàvēď ƀàśē ƀŕàńćĥ ĩś ũńàvàĩĺàƀĺē. Ćĥōōśē àńōţĥēŕ ƀŕàńćĥ ƀēƒōŕē ćŕēàţĩńĝ ţĥē ţàśķ.",
+ "repositorySetBaseForLocal": "Ɓàśē: {{base}}",
+ "branchUnavailable": "Ţĥĩś śàvēď ƀŕàńćĥ ĩś ńōţ àvàĩĺàƀĺē. Ćĥōōśē àńōţĥēŕ ƀŕàńćĥ.",
+ "branchUnavailableShort": "Ũńàvàĩĺàƀĺē",
"requestChanges": "Ŕēqũēśţ ćĥàńĝēś",
"requestedChanges": "ŕēqũēśţēď ćĥàńĝēś",
"requestedChangesPlain": "{{who}} ŕēqũēśţēď ćĥàńĝēś",
diff --git a/apps/web/src/locales/pseudo/workspaces.json b/apps/web/src/locales/pseudo/workspaces.json
index b0970f5aad..336c0e9c1c 100644
--- a/apps/web/src/locales/pseudo/workspaces.json
+++ b/apps/web/src/locales/pseudo/workspaces.json
@@ -136,11 +136,11 @@
"sourceFolderAlreadySelected": "Ţĥĩś ƒōĺďēŕ ĩś àĺŕēàďŷ śēĺēćţēď.",
"sourceRepoBranchAlreadySelected": "Ţĥĩś ŕēƥōśĩţōŕŷ àńď ƀŕàńćĥ àŕē àĺŕēàďŷ śēĺēćţēď.",
"repositorySetsTitle": "Ŕēƥōśĩţōŕŷ śēţś",
- "repositorySetsDescription": "Ńàḿēď ĝŕōũƥś ōƒ ţĥĩś ŵōŕķśƥàćē'ś ŕēƥōśĩţōŕĩēś. Ćĥōōśĩńĝ à śēţ ĩń ţĥē ţàśķ ďĩàĺōĝ ƒĩĺĺś ţĥē ŕēƥōśĩţōŕŷ ƥĩćķēŕ ŵĩţĥ ĩţś ḿēḿƀēŕś; ƀŕàńćĥēś àŕē śţĩĺĺ ćĥōśēń ƥēŕ ţàśķ.",
+ "repositorySetsDescription": "Ńàḿēď ĝŕōũƥś ōƒ ţĥĩś ŵōŕķśƥàćē'ś ŕēƥōśĩţōŕĩēś. Ćĥōōśĩńĝ à śēţ ĩń ţĥē ţàśķ ďĩàĺōĝ ƒĩĺĺś ţĥē ŕēƥōśĩţōŕŷ ƥĩćķēŕ àńď ćōƥĩēś ĩţś śàvēď ƀàśē ƀŕàńćĥēś ĩńţō ţĥē ţàśķ; ćĥēćķōũţ ƀŕàńćĥēś ŕēḿàĩń ţàśķ-śƥēćĩƒĩć.",
"repositorySetsCreate": "Ńēŵ śēţ",
"repositorySetsCreateTitle": "Ńēŵ ŕēƥōśĩţōŕŷ śēţ",
"repositorySetsEditTitle": "Ēďĩţ ŕēƥōśĩţōŕŷ śēţ",
- "repositorySetsEditorDescription": "Ƥĩćķ ţĥē ŕēƥōśĩţōŕĩēś ĩń ţĥĩś śēţ àńď ţĥē ōŕďēŕ ţĥēŷ ƒĩĺĺ ţĥē ƥĩćķēŕ.",
+ "repositorySetsEditorDescription": "Ƥĩćķ ţĥē ŕēƥōśĩţōŕĩēś ĩń ţĥĩś śēţ, ţĥēĩŕ ōŕďēŕ, àńď àń ōƥţĩōńàĺ ƀàśē ƀŕàńćĥ ƒōŕ ēàćĥ.",
"repositorySetsEdit": "Ēďĩţ śēţ",
"repositorySetsDelete": "Ďēĺēţē śēţ",
"repositorySetsDeleteTitle": "Ďēĺēţē {{name}}?",
@@ -151,15 +151,31 @@
"repositorySetsNameLabel": "Ńàḿē",
"repositorySetsDescriptionLabel": "Ďēśćŕĩƥţĩōń (ōƥţĩōńàĺ)",
"repositorySetsMembersLabel": "Ŕēƥōśĩţōŕĩēś",
- "repositorySetsMembersHint": "Śēĺēćţ àţ ĺēàśţ ōńē. Ţĥē ōŕďēŕ ĥēŕē ĩś ţĥē ōŕďēŕ ţĥēŷ àŕē àďďēď ţō à ţàśķ.",
+ "repositorySetsMembersHint": "Àďď ŕēƥōśĩţōŕĩēś ĩń ţàśķ ōŕďēŕ. Ɓàśē ƀŕàńćĥēś àŕē ōƥţĩōńàĺ.",
"repositorySetsMoveUp": "Ḿōvē ēàŕĺĩēŕ",
"repositorySetsMoveDown": "Ḿōvē ĺàţēŕ",
+ "repositorySetsRemove": "Ŕēḿōvē ŕēƥōśĩţōŕŷ",
"repositorySetsSave": "Śàvē śēţ",
"repositorySetsNameTaken": "À śēţ ŵĩţĥ ţĥĩś ńàḿē àĺŕēàďŷ ēxĩśţś ĩń ţĥĩś ŵōŕķśƥàćē.",
"repositorySetsMemberRejected": "Ōńē ōƒ ţĥē ćĥōśēń ŕēƥōśĩţōŕĩēś ĩś ńō ĺōńĝēŕ àvàĩĺàƀĺē ĩń ţĥĩś ŵōŕķśƥàćē.",
"repositorySetsSaveFailed": "Ćōũĺď ńōţ śàvē ţĥē śēţ. Ţŕŷ àĝàĩń.",
"repositorySetsAlreadyDeleted": "Ţĥĩś śēţ ŵàś àĺŕēàďŷ ďēĺēţēď. Ŕēƒŕēśĥ ţō śēē ţĥē ćũŕŕēńţ ĺĩśţ.",
"repositorySetsDeleteFailed": "Ćōũĺď ńōţ ďēĺēţē ţĥē śēţ. Ţŕŷ àĝàĩń.",
+ "repositorySetsAddRepository": "Àďď ŕēƥōśĩţōŕŷ",
+ "repositorySetsSearchRepositories": "Śēàŕćĥ ŕēƥōśĩţōŕĩēś...",
+ "repositorySetsNoMatchingRepositories": "Ńō ḿàţćĥĩńĝ ŕēƥōśĩţōŕĩēś.",
+ "repositorySetsSearchSelected": "Ƒĩĺţēŕ śēĺēćţēď ŕēƥōśĩţōŕĩēś...",
+ "repositorySetsNoMatchingMembers": "Ńō śēĺēćţēď ŕēƥōśĩţōŕĩēś ḿàţćĥ ţĥĩś śēàŕćĥ.",
+ "repositorySetsNoMembersSelected": "Ńō ŕēƥōśĩţōŕĩēś śēĺēćţēď ŷēţ.",
+ "repositorySetsResetBases": "Ŕēśēţ ƀàśēś",
+ "repositorySetsTaskDefault": "Ţàśķ ďēƒàũĺţ ({{branch}})",
+ "repositorySetsTaskDefaultNoBranch": "Ţàśķ ďēƒàũĺţ",
+ "repositorySetsBaseBranchLabel": "Śàvēď ƀàśē ƀŕàńćĥ",
+ "repositorySetsBaseBranchFor": "Śàvēď ƀàśē ƀŕàńćĥ ƒōŕ {{name}}",
+ "repositorySetsBranchUnavailable": "Ũńàvàĩĺàƀĺē",
+ "repositorySetsBranchUnavailableReason": "Ţĥĩś śàvēď ƀŕàńćĥ ĩś ńōţ àvàĩĺàƀĺē. Ćĥōōśē àńōţĥēŕ ƀŕàńćĥ ōŕ ŕēśēţ ţō ţĥē ţàśķ ďēƒàũĺţ.",
+ "repositorySetsMemberMissing": "Ŕēƥōśĩţōŕŷ ńō ĺōńĝēŕ ēxĩśţś ĩń ţĥĩś ŵōŕķśƥàćē.",
+ "repositorySetsMemberBase": "ƀàśē: {{base}}",
"branchPoliciesTitle": "Ɓŕàńćĥ ƥōĺĩćĩēś",
"branchPoliciesDescription": "Ćĥōōśē à ńàḿēď ƀŕàńćĥ ƥōĺĩćŷ ŵĥēń ŷōũ ćŕēàţē à ţàśķ. Ţĥē śēĺēćţēď ƥōĺĩćŷ ĩś śàvēď ŵĩţĥ ţĥē ţàśķ.",
"branchPoliciesSaveRepositoryFirst": "Śàvē ţĥĩś ŕēƥōśĩţōŕŷ ƀēƒōŕē àďďĩńĝ ƀŕàńćĥ ƥōĺĩćĩēś.",
diff --git a/apps/web/src/locales/pt-pt/task.json b/apps/web/src/locales/pt-pt/task.json
index 5fd035b381..14d8c1fb3a 100644
--- a/apps/web/src/locales/pt-pt/task.json
+++ b/apps/web/src/locales/pt-pt/task.json
@@ -1,4 +1,6 @@
{
+ "repositorySetsSaveDuplicateRows_one": "{{count}} linha adicional não é incluída. Só é guardada a primeira linha de cada repositório, incluindo a escolha da base.",
+ "repositorySetsSaveDuplicateRows_other": "{{count}} linhas adicionais não são incluídas. Só é guardada a primeira linha de cada repositório, incluindo a escolha da base.",
"agentCliNotInstalled": "CLI do agente não instalado",
"agentProbeFailed": "A sondagem do agente falhou",
"aPullRequestAlreadyExistsFor": "Já existe um pull request para esta tarefa",
@@ -1214,7 +1216,7 @@
"repositoryWithPath": "Repositório · {{path}}",
"repositorySetsTrigger": "Conjuntos",
"repositorySetsSaveTitle": "Guardar como conjunto de repositórios",
- "repositorySetsSaveDescription": "Reutilize esta seleção de repositórios em tarefas futuras. Os ramos são escolhidos em cada tarefa e não são guardados.",
+ "repositorySetsSaveDescription": "Reutilize esta seleção de repositórios e os seus ramos base guardados em tarefas futuras. Os ramos de checkout continuam específicos de cada tarefa.",
"repositorySetsSaveNameLabel": "Nome",
"repositorySetsSaveDescriptionLabel": "Descrição (opcional)",
"repositorySetsSaveSubmit": "Guardar conjunto",
@@ -1238,6 +1240,10 @@
"repositorySetsNothingToApply": "Todos os repositórios de {{name}} já estão nesta tarefa",
"repositorySetsSkippedMissing_one": "{{count}} repositório de {{name}} já não existe nesta área de trabalho",
"repositorySetsSkippedMissing_other": "{{count}} repositórios de {{name}} já não existem nesta área de trabalho",
+ "repositorySetBaseUnavailable": "Um ramo base guardado não está disponível. Escolha outro ramo antes de criar a tarefa.",
+ "repositorySetBaseForLocal": "Ramo base: {{base}}",
+ "branchUnavailable": "Este ramo guardado não está disponível. Escolha outro ramo.",
+ "branchUnavailableShort": "Indisponível",
"requestChanges": "Solicitar alterações",
"requestedChanges": "solicitou alterações",
"requestedChangesPlain": "{{who}} solicitou alterações",
diff --git a/apps/web/src/locales/pt-pt/workspaces.json b/apps/web/src/locales/pt-pt/workspaces.json
index a3ceedb613..ed23908ac7 100644
--- a/apps/web/src/locales/pt-pt/workspaces.json
+++ b/apps/web/src/locales/pt-pt/workspaces.json
@@ -136,11 +136,11 @@
"sourceFolderAlreadySelected": "Esta pasta já está selecionada.",
"sourceRepoBranchAlreadySelected": "Este repositório e ramo já estão selecionados.",
"repositorySetsTitle": "Conjuntos de repositórios",
- "repositorySetsDescription": "Grupos com nome dos repositórios desta área de trabalho. Escolher um conjunto na caixa de criação de tarefas preenche o seletor de repositórios com os seus membros; os ramos continuam a ser escolhidos em cada tarefa.",
+ "repositorySetsDescription": "Grupos com nome dos repositórios desta área de trabalho. Escolher um conjunto na caixa de criação de tarefas preenche o seletor de repositórios e copia os seus ramos base guardados para a tarefa; os ramos de checkout continuam específicos de cada tarefa.",
"repositorySetsCreate": "Novo conjunto",
"repositorySetsCreateTitle": "Novo conjunto de repositórios",
"repositorySetsEditTitle": "Editar conjunto de repositórios",
- "repositorySetsEditorDescription": "Escolha os repositórios deste conjunto e a ordem em que preenchem o seletor.",
+ "repositorySetsEditorDescription": "Escolha os repositórios deste conjunto, a sua ordem e um ramo base opcional para cada um.",
"repositorySetsEdit": "Editar conjunto",
"repositorySetsDelete": "Eliminar conjunto",
"repositorySetsDeleteTitle": "Eliminar {{name}}?",
@@ -151,15 +151,31 @@
"repositorySetsNameLabel": "Nome",
"repositorySetsDescriptionLabel": "Descrição (opcional)",
"repositorySetsMembersLabel": "Repositórios",
- "repositorySetsMembersHint": "Selecione pelo menos um. Esta ordem é a ordem em que são adicionados a uma tarefa.",
+ "repositorySetsMembersHint": "Adicione repositórios pela ordem da tarefa. Os ramos base são opcionais.",
"repositorySetsMoveUp": "Mover para cima",
"repositorySetsMoveDown": "Mover para baixo",
+ "repositorySetsRemove": "Remover repositório",
"repositorySetsSave": "Guardar conjunto",
"repositorySetsNameTaken": "Já existe um conjunto com este nome nesta área de trabalho.",
"repositorySetsMemberRejected": "Um dos repositórios escolhidos já não está disponível nesta área de trabalho.",
"repositorySetsSaveFailed": "Não foi possível guardar o conjunto. Tente novamente.",
"repositorySetsAlreadyDeleted": "Este conjunto já foi eliminado. Atualize para ver a lista atual.",
"repositorySetsDeleteFailed": "Não foi possível eliminar o conjunto. Tente novamente.",
+ "repositorySetsAddRepository": "Adicionar repositório",
+ "repositorySetsSearchRepositories": "Pesquisar repositórios...",
+ "repositorySetsNoMatchingRepositories": "Não foram encontrados repositórios correspondentes.",
+ "repositorySetsSearchSelected": "Filtrar repositórios selecionados...",
+ "repositorySetsNoMatchingMembers": "Nenhum repositório selecionado corresponde à pesquisa.",
+ "repositorySetsNoMembersSelected": "Ainda não existem repositórios selecionados.",
+ "repositorySetsResetBases": "Repor ramos base",
+ "repositorySetsTaskDefault": "Predefinição da tarefa ({{branch}})",
+ "repositorySetsTaskDefaultNoBranch": "Predefinição da tarefa",
+ "repositorySetsBaseBranchLabel": "Ramo base guardado",
+ "repositorySetsBaseBranchFor": "Ramo base guardado para {{name}}",
+ "repositorySetsBranchUnavailable": "Indisponível",
+ "repositorySetsBranchUnavailableReason": "Este ramo guardado não está disponível. Escolha outro ramo ou reponha a predefinição da tarefa.",
+ "repositorySetsMemberMissing": "O repositório já não existe nesta área de trabalho.",
+ "repositorySetsMemberBase": "base: {{base}}",
"branchPoliciesTitle": "Políticas de branches",
"branchPoliciesDescription": "Escolha uma política de branches com nome ao criar uma tarefa. A política selecionada fica guardada na tarefa.",
"branchPoliciesSaveRepositoryFirst": "Guarde este repositório antes de adicionar políticas de branches.",
diff --git a/apps/web/src/locales/zh-cn/task.json b/apps/web/src/locales/zh-cn/task.json
index 1433f95901..3dee467d27 100644
--- a/apps/web/src/locales/zh-cn/task.json
+++ b/apps/web/src/locales/zh-cn/task.json
@@ -1,4 +1,6 @@
{
+ "repositorySetsSaveDuplicateRows_one": "不包含另外 {{count}} 行。每个仓库只保存第一行及其基准分支选择。",
+ "repositorySetsSaveDuplicateRows_other": "不包含另外 {{count}} 行。每个仓库只保存第一行及其基准分支选择。",
"agentCliNotInstalled": "未安装智能体 CLI",
"agentProbeFailed": "智能体探测失败",
"aPullRequestAlreadyExistsFor": "此任务已存在拉取请求",
@@ -1213,7 +1215,7 @@
"repositoryWithPath": "仓库 · {{path}}",
"repositorySetsTrigger": "仓库集",
"repositorySetsSaveTitle": "另存为仓库集",
- "repositorySetsSaveDescription": "在后续任务中复用此仓库选择。分支按任务单独选择,不会被保存。",
+ "repositorySetsSaveDescription": "在后续任务中复用此仓库选择及其保存的基础分支。检出分支仍按任务单独设置。",
"repositorySetsSaveNameLabel": "名称",
"repositorySetsSaveDescriptionLabel": "描述(可选)",
"repositorySetsSaveSubmit": "保存",
@@ -1237,6 +1239,10 @@
"repositorySetsNothingToApply": "{{name}} 中的所有仓库都已在此任务中",
"repositorySetsSkippedMissing_one": "{{name}} 中有 {{count}} 个仓库已不存在于此工作区",
"repositorySetsSkippedMissing_other": "{{name}} 中有 {{count}} 个仓库已不存在于此工作区",
+ "repositorySetBaseUnavailable": "保存的基础分支不可用。请在创建任务前选择其他分支。",
+ "repositorySetBaseForLocal": "基础分支:{{base}}",
+ "branchUnavailable": "此保存的分支不可用。请选择其他分支。",
+ "branchUnavailableShort": "不可用",
"requestChanges": "请求更改",
"requestedChanges": "已请求更改",
"requestedChangesPlain": "{{who}} 请求了更改",
diff --git a/apps/web/src/locales/zh-cn/workspaces.json b/apps/web/src/locales/zh-cn/workspaces.json
index 6cbd744ae4..fce571d4c5 100644
--- a/apps/web/src/locales/zh-cn/workspaces.json
+++ b/apps/web/src/locales/zh-cn/workspaces.json
@@ -136,11 +136,11 @@
"sourceFolderAlreadySelected": "该目录已被选择。",
"sourceRepoBranchAlreadySelected": "该仓库和分支已被选择。",
"repositorySetsTitle": "仓库集",
- "repositorySetsDescription": "本工作区仓库的命名分组。在任务创建对话框中选择某个仓库集会用其成员填充仓库选择器;分支仍按任务单独选择。",
+ "repositorySetsDescription": "本工作区仓库的命名分组。在任务创建对话框中选择仓库集会填充仓库选择器,并将保存的基础分支复制到任务中;检出分支仍按任务单独设置。",
"repositorySetsCreate": "新建仓库集",
"repositorySetsCreateTitle": "新建仓库集",
"repositorySetsEditTitle": "编辑仓库集",
- "repositorySetsEditorDescription": "选择此仓库集包含的仓库,以及它们填充选择器的顺序。",
+ "repositorySetsEditorDescription": "选择此仓库集包含的仓库、顺序,以及每个仓库可选的基础分支。",
"repositorySetsEdit": "编辑仓库集",
"repositorySetsDelete": "删除仓库集",
"repositorySetsDeleteTitle": "删除 {{name}}?",
@@ -151,15 +151,31 @@
"repositorySetsNameLabel": "名称",
"repositorySetsDescriptionLabel": "描述(可选)",
"repositorySetsMembersLabel": "仓库",
- "repositorySetsMembersHint": "请至少选择一个。此处的顺序即添加到任务时的顺序。",
+ "repositorySetsMembersHint": "按任务顺序添加仓库。基础分支可选。",
"repositorySetsMoveUp": "上移",
"repositorySetsMoveDown": "下移",
+ "repositorySetsRemove": "移除仓库",
"repositorySetsSave": "保存",
"repositorySetsNameTaken": "此工作区中已存在同名的仓库集。",
"repositorySetsMemberRejected": "所选仓库之一在此工作区中已不可用。",
"repositorySetsSaveFailed": "无法保存该仓库集。请重试。",
"repositorySetsAlreadyDeleted": "该仓库集已被删除。请刷新以查看当前列表。",
"repositorySetsDeleteFailed": "无法删除该仓库集。请重试。",
+ "repositorySetsAddRepository": "添加仓库",
+ "repositorySetsSearchRepositories": "搜索仓库…",
+ "repositorySetsNoMatchingRepositories": "没有匹配的仓库。",
+ "repositorySetsSearchSelected": "筛选已选仓库…",
+ "repositorySetsNoMatchingMembers": "没有选中的仓库匹配此搜索。",
+ "repositorySetsNoMembersSelected": "尚未选择仓库。",
+ "repositorySetsResetBases": "重置基础分支",
+ "repositorySetsTaskDefault": "任务默认值({{branch}})",
+ "repositorySetsTaskDefaultNoBranch": "任务默认值",
+ "repositorySetsBaseBranchLabel": "保存的基础分支",
+ "repositorySetsBaseBranchFor": "{{name}} 的保存基础分支",
+ "repositorySetsBranchUnavailable": "不可用",
+ "repositorySetsBranchUnavailableReason": "此保存的分支不可用。请选择其他分支,或重置为任务默认值。",
+ "repositorySetsMemberMissing": "该仓库已不在此工作区中。",
+ "repositorySetsMemberBase": "基础分支:{{base}}",
"branchPoliciesTitle": "分支策略",
"branchPoliciesDescription": "创建任务时选择一个命名分支策略。所选策略会保存到任务中。",
"branchPoliciesSaveRepositoryFirst": "请先保存此仓库,再添加分支策略。",
diff --git a/apps/web/src/locales/zh-hk/task.json b/apps/web/src/locales/zh-hk/task.json
index a8e55884cf..402260c6c6 100644
--- a/apps/web/src/locales/zh-hk/task.json
+++ b/apps/web/src/locales/zh-hk/task.json
@@ -1,4 +1,6 @@
{
+ "repositorySetsSaveDuplicateRows_one": "不包含另外 {{count}} 行。每個儲存庫只儲存第一行及其基準分支選擇。",
+ "repositorySetsSaveDuplicateRows_other": "不包含另外 {{count}} 行。每個儲存庫只儲存第一行及其基準分支選擇。",
"agentCliNotInstalled": "未安裝代理程式 CLI",
"agentProbeFailed": "代理程式探測失敗",
"aPullRequestAlreadyExistsFor": "此任務已存在拉取要求",
@@ -1213,7 +1215,7 @@
"repositoryWithPath": "儲存庫 · {{path}}",
"repositorySetsTrigger": "儲存庫集",
"repositorySetsSaveTitle": "另存為儲存庫集",
- "repositorySetsSaveDescription": "在後續任務中複用此儲存庫選擇。分支按任務單獨選擇,不會被儲存。",
+ "repositorySetsSaveDescription": "在後續任務中複用此儲存庫選擇及其儲存的基礎分支。檢出分支仍按任務單獨設定。",
"repositorySetsSaveNameLabel": "名稱",
"repositorySetsSaveDescriptionLabel": "描述(可選)",
"repositorySetsSaveSubmit": "儲存",
@@ -1237,6 +1239,10 @@
"repositorySetsNothingToApply": "{{name}} 中的所有儲存庫都已在此任務中",
"repositorySetsSkippedMissing_one": "{{name}} 中有 {{count}} 個儲存庫已不存在於此工作區",
"repositorySetsSkippedMissing_other": "{{name}} 中有 {{count}} 個儲存庫已不存在於此工作區",
+ "repositorySetBaseUnavailable": "儲存的基礎分支不可用。請在建立任務前選擇其他分支。",
+ "repositorySetBaseForLocal": "基礎分支:{{base}}",
+ "branchUnavailable": "此儲存的分支不可用。請選擇其他分支。",
+ "branchUnavailableShort": "不可用",
"requestChanges": "請求更改",
"requestedChanges": "已請求更改",
"requestedChangesPlain": "{{who}} 請求了更改",
diff --git a/apps/web/src/locales/zh-hk/workspaces.json b/apps/web/src/locales/zh-hk/workspaces.json
index f815b13568..e4a3590e78 100644
--- a/apps/web/src/locales/zh-hk/workspaces.json
+++ b/apps/web/src/locales/zh-hk/workspaces.json
@@ -136,11 +136,11 @@
"sourceFolderAlreadySelected": "該目錄已被選擇。",
"sourceRepoBranchAlreadySelected": "該儲存庫和分支已被選擇。",
"repositorySetsTitle": "儲存庫集",
- "repositorySetsDescription": "本工作區儲存庫的命名分組。在任務建立對話框中選擇某個儲存庫集會用其成員填充儲存庫選擇器;分支仍按任務單獨選擇。",
+ "repositorySetsDescription": "本工作區儲存庫的命名分組。在任務建立對話框中選擇儲存庫集會填充儲存庫選擇器,並將儲存的基礎分支複製到任務中;檢出分支仍按任務單獨設定。",
"repositorySetsCreate": "新建儲存庫集",
"repositorySetsCreateTitle": "新建儲存庫集",
"repositorySetsEditTitle": "編輯儲存庫集",
- "repositorySetsEditorDescription": "選擇此儲存庫集包含的儲存庫,以及它們填充選擇器的順序。",
+ "repositorySetsEditorDescription": "選擇此儲存庫集包含的儲存庫、順序,以及每個儲存庫可選的基礎分支。",
"repositorySetsEdit": "編輯儲存庫集",
"repositorySetsDelete": "刪除儲存庫集",
"repositorySetsDeleteTitle": "刪除 {{name}}?",
@@ -151,15 +151,31 @@
"repositorySetsNameLabel": "名稱",
"repositorySetsDescriptionLabel": "描述(可選)",
"repositorySetsMembersLabel": "儲存庫",
- "repositorySetsMembersHint": "請至少選擇一個。此處的順序即新增到任務時的順序。",
+ "repositorySetsMembersHint": "按任務順序新增儲存庫。基礎分支可選。",
"repositorySetsMoveUp": "上移",
"repositorySetsMoveDown": "下移",
+ "repositorySetsRemove": "移除儲存庫",
"repositorySetsSave": "儲存",
"repositorySetsNameTaken": "此工作區中已存在同名的儲存庫集。",
"repositorySetsMemberRejected": "所選儲存庫之一在此工作區中已不可用。",
"repositorySetsSaveFailed": "無法儲存該儲存庫集。請重試。",
"repositorySetsAlreadyDeleted": "該儲存庫集已被刪除。請刷新以查看目前列表。",
"repositorySetsDeleteFailed": "無法刪除該儲存庫集。請重試。",
+ "repositorySetsAddRepository": "新增儲存庫",
+ "repositorySetsSearchRepositories": "搜尋儲存庫…",
+ "repositorySetsNoMatchingRepositories": "沒有匹配的儲存庫。",
+ "repositorySetsSearchSelected": "篩選已選儲存庫…",
+ "repositorySetsNoMatchingMembers": "沒有選中的儲存庫匹配此搜尋。",
+ "repositorySetsNoMembersSelected": "尚未選擇儲存庫。",
+ "repositorySetsResetBases": "重置基礎分支",
+ "repositorySetsTaskDefault": "任務預設值({{branch}})",
+ "repositorySetsTaskDefaultNoBranch": "任務預設值",
+ "repositorySetsBaseBranchLabel": "儲存的基礎分支",
+ "repositorySetsBaseBranchFor": "{{name}} 的儲存基礎分支",
+ "repositorySetsBranchUnavailable": "不可用",
+ "repositorySetsBranchUnavailableReason": "此儲存的分支不可用。請選擇其他分支,或重置為任務預設值。",
+ "repositorySetsMemberMissing": "該儲存庫已不在此工作區中。",
+ "repositorySetsMemberBase": "基礎分支:{{base}}",
"branchPoliciesTitle": "分支策略",
"branchPoliciesDescription": "建立任務時選擇一個命名分支策略。所選策略會儲存到任務中。",
"branchPoliciesSaveRepositoryFirst": "請先儲存此儲存庫,再新增分支策略。",
diff --git a/apps/web/src/locales/zh-tw/task.json b/apps/web/src/locales/zh-tw/task.json
index 112fc4e648..ed55314fe6 100644
--- a/apps/web/src/locales/zh-tw/task.json
+++ b/apps/web/src/locales/zh-tw/task.json
@@ -1,4 +1,6 @@
{
+ "repositorySetsSaveDuplicateRows_one": "不包含另外 {{count}} 行。每個儲存庫只儲存第一行及其基準分支選擇。",
+ "repositorySetsSaveDuplicateRows_other": "不包含另外 {{count}} 行。每個儲存庫只儲存第一行及其基準分支選擇。",
"agentCliNotInstalled": "未安裝代理程式 CLI",
"agentProbeFailed": "代理程式探測失敗",
"aPullRequestAlreadyExistsFor": "此任務已存在提取要求",
@@ -1213,7 +1215,7 @@
"repositoryWithPath": "儲存庫 · {{path}}",
"repositorySetsTrigger": "儲存庫集",
"repositorySetsSaveTitle": "另存為儲存庫集",
- "repositorySetsSaveDescription": "在後續任務中複用此儲存庫選擇。分支按任務單獨選擇,不會被儲存。",
+ "repositorySetsSaveDescription": "在後續任務中複用此儲存庫選擇及其儲存的基礎分支。檢出分支仍按任務單獨設定。",
"repositorySetsSaveNameLabel": "名稱",
"repositorySetsSaveDescriptionLabel": "描述(可選)",
"repositorySetsSaveSubmit": "儲存",
@@ -1237,6 +1239,10 @@
"repositorySetsNothingToApply": "{{name}} 中的所有儲存庫都已在此任務中",
"repositorySetsSkippedMissing_one": "{{name}} 中有 {{count}} 個儲存庫已不存在於此工作區",
"repositorySetsSkippedMissing_other": "{{name}} 中有 {{count}} 個儲存庫已不存在於此工作區",
+ "repositorySetBaseUnavailable": "儲存的基礎分支不可用。請在建立任務前選擇其他分支。",
+ "repositorySetBaseForLocal": "基礎分支:{{base}}",
+ "branchUnavailable": "此儲存的分支不可用。請選擇其他分支。",
+ "branchUnavailableShort": "不可用",
"requestChanges": "請求更改",
"requestedChanges": "已請求更改",
"requestedChangesPlain": "{{who}} 請求了更改",
diff --git a/apps/web/src/locales/zh-tw/workspaces.json b/apps/web/src/locales/zh-tw/workspaces.json
index 5157f5b04c..efc39bbc56 100644
--- a/apps/web/src/locales/zh-tw/workspaces.json
+++ b/apps/web/src/locales/zh-tw/workspaces.json
@@ -136,11 +136,11 @@
"sourceFolderAlreadySelected": "該目錄已被選擇。",
"sourceRepoBranchAlreadySelected": "該儲存庫和分支已被選擇。",
"repositorySetsTitle": "儲存庫集",
- "repositorySetsDescription": "本工作區儲存庫的命名分組。在任務建立對話方塊中選擇某個儲存庫集會用其成員填充儲存庫選擇器;分支仍按任務單獨選擇。",
+ "repositorySetsDescription": "本工作區儲存庫的命名分組。在任務建立對話方塊中選擇儲存庫集會填充儲存庫選擇器,並將儲存的基礎分支複製到任務中;檢出分支仍按任務單獨設定。",
"repositorySetsCreate": "新建儲存庫集",
"repositorySetsCreateTitle": "新建儲存庫集",
"repositorySetsEditTitle": "編輯儲存庫集",
- "repositorySetsEditorDescription": "選擇此儲存庫集包含的儲存庫,以及它們填充選擇器的順序。",
+ "repositorySetsEditorDescription": "選擇此儲存庫集包含的儲存庫、順序,以及每個儲存庫可選的基礎分支。",
"repositorySetsEdit": "編輯儲存庫集",
"repositorySetsDelete": "刪除儲存庫集",
"repositorySetsDeleteTitle": "刪除 {{name}}?",
@@ -151,15 +151,31 @@
"repositorySetsNameLabel": "名稱",
"repositorySetsDescriptionLabel": "描述(可選)",
"repositorySetsMembersLabel": "儲存庫",
- "repositorySetsMembersHint": "請至少選擇一個。此處的順序即新增到任務時的順序。",
+ "repositorySetsMembersHint": "按任務順序新增儲存庫。基礎分支可選。",
"repositorySetsMoveUp": "上移",
"repositorySetsMoveDown": "下移",
+ "repositorySetsRemove": "移除儲存庫",
"repositorySetsSave": "儲存",
"repositorySetsNameTaken": "此工作區中已存在同名的儲存庫集。",
"repositorySetsMemberRejected": "所選儲存庫之一在此工作區中已不可用。",
"repositorySetsSaveFailed": "無法儲存該儲存庫集。請重試。",
"repositorySetsAlreadyDeleted": "該儲存庫集已被刪除。請重新整理以檢視目前清單。",
"repositorySetsDeleteFailed": "無法刪除該儲存庫集。請重試。",
+ "repositorySetsAddRepository": "新增儲存庫",
+ "repositorySetsSearchRepositories": "搜尋儲存庫…",
+ "repositorySetsNoMatchingRepositories": "沒有匹配的儲存庫。",
+ "repositorySetsSearchSelected": "篩選已選儲存庫…",
+ "repositorySetsNoMatchingMembers": "沒有選中的儲存庫匹配此搜尋。",
+ "repositorySetsNoMembersSelected": "尚未選擇儲存庫。",
+ "repositorySetsResetBases": "重置基礎分支",
+ "repositorySetsTaskDefault": "任務預設值({{branch}})",
+ "repositorySetsTaskDefaultNoBranch": "任務預設值",
+ "repositorySetsBaseBranchLabel": "儲存的基礎分支",
+ "repositorySetsBaseBranchFor": "{{name}} 的已儲存基礎分支",
+ "repositorySetsBranchUnavailable": "不可用",
+ "repositorySetsBranchUnavailableReason": "此儲存的分支不可用。請選擇其他分支,或重置為任務預設值。",
+ "repositorySetsMemberMissing": "該儲存庫已不在此工作區中。",
+ "repositorySetsMemberBase": "基礎分支:{{base}}",
"branchPoliciesTitle": "分支策略",
"branchPoliciesDescription": "建立任務時選擇一個命名分支策略。所選策略會儲存到任務中。",
"branchPoliciesSaveRepositoryFirst": "請先儲存此儲存庫,再新增分支策略。",
diff --git a/docs/plans/kubernetes-executor/task-06-kind-e2e-ci.md b/docs/plans/kubernetes-executor/task-06-kind-e2e-ci.md
index 377ae5a3c3..6517d285d6 100644
--- a/docs/plans/kubernetes-executor/task-06-kind-e2e-ci.md
+++ b/docs/plans/kubernetes-executor/task-06-kind-e2e-ci.md
@@ -46,9 +46,17 @@ jobs, and E2E README are implemented and verified.
node
`kindest/node:v1.34.8@sha256:02722c2dedddcfc00febf5d27fbeb9b7b2c14294c82109ff4a85d89ac9ba3256`.
- Runtime base:
- `ubuntu:24.04@sha256:33ceb71981b602c1a7443a53469e4dba065f7503eab3078a2d7a57a2ab987517`.
- Its `apt-get` package resolution is not snapshot-pinned; this is a documented
- nonblocking reproducibility limitation for the fixture.
+ `ghcr.io/kdlbs/kandev-ci:runtime-sha-6f288a23c526@sha256:b9636e1c20adb0fcce1c65858a767fb1b0fe48a15ac5688b9c623163575efb8d`.
+ The compatibility fixture reuses the immutable CI runtime image, including
+ its lifecycle tools, instead of resolving Ubuntu packages on every runner.
+
+### CI timeout remediation
+
+The compatibility fixture now uses the pinned Kandev CI runtime image and the
+container workflow pre-pulls it with bounded retries. The per-run image build
+copies the current artifacts without contacting an Ubuntu package mirror. The
+Kubernetes pin contract test covers the immutable image reference and the
+absence of the package-install step.
### Fresh build identity
diff --git a/docs/plans/repository-set-base-branches/plan.md b/docs/plans/repository-set-base-branches/plan.md
new file mode 100644
index 0000000000..d23b537b2a
--- /dev/null
+++ b/docs/plans/repository-set-base-branches/plan.md
@@ -0,0 +1,155 @@
+---
+created: 2026-09-01
+status: complete
+requirements:
+ - REQ-WORKSPACES-REPOSITORY-SETS-001
+ - REQ-WORKSPACES-REPOSITORY-SETS-002
+ - REQ-WORKSPACES-REPOSITORY-SETS-003
+system_design:
+ - ../../specs/workspaces/system-design/repository-sets.md
+legacy_specs: []
+---
+
+# Implementation Plan: Repository Set Base Branches
+
+## Overview
+
+Add an optional base branch to each repository-set member. Then expose that
+value in the approved inline editor and copy it into new task drafts.
+
+The backend contract comes first because every later task consumes the member
+shape. Task-draft behavior comes next because it defines local and worktree
+semantics. The responsive editor, E2E evidence, and public documentation follow.
+
+## Scope
+
+### In scope
+
+- Persist one optional base branch for each set member.
+- Preserve `repository_ids` as a compatibility input.
+- Show selected members and base selectors in one searchable editor.
+- Load a member branch list only when its selector opens.
+- Copy saved bases into new task rows without changing existing rows.
+- Keep local base and checkout branches separate.
+- Capture effective bases through `Save as set`.
+- Cover desktop and phone workflows.
+
+### Out of scope
+
+- One bulk branch value for all members.
+- Branch policies, generated branch templates, and pull-request targets in sets.
+- Remote URLs, local folder sources, and Quick Chat.
+- Automatic replacement of unavailable saved bases.
+
+## Technical approach
+
+### Persistence and service contract
+
+Add `base_branch` to `repository_set_items` in the base schema and replayable
+migrations. Extend models, repository scans, writes, DTOs, and event payloads.
+
+Replace ordered ID slices inside the service with ordered member inputs. Keep
+`repository_ids` at the handler boundary for compatibility. Reject requests
+that contain both member fields.
+
+Use `securityutil.IsValidBaseBranchRef` for each non-empty base. Do not query Git
+inside set mutations.
+
+### Task-draft behavior
+
+Extend `TaskRepoRow` with explicit base state. Update `applyRepositorySet` to
+copy a saved base only into a new row. Keep the idempotent skip rule for a row
+that is already present.
+
+Update task payload construction so worktree execution uses the effective base.
+For local execution, send the effective base and checkout branch separately.
+
+Update `Save as set` to send ordered member objects. The dialog summary states
+that repository bases are included.
+
+### Responsive settings editor
+
+Replace the all-repository checkbox list with a selected-member list and an Add
+repository picker. Keep explicit move actions for order.
+
+Each row shows `Task default` or its saved base. Enable `useBranches` only
+while that row selector is open. Keep an unavailable saved value visible.
+
+Reuse New Task `Pill`, `sortBranches`, `branchOptionValue`, and `branchToOption` without a
+settings-only fork. Preserve branch search, refresh, remote-qualified names,
+and origin badges.
+
+Use a bounded desktop dialog. Use the repository branch-policy full-height
+drawer pattern on phones. The phone drawer owns one scroll region and a
+safe-area footer.
+
+### State, events, and localization
+
+Extend HTTP, WebSocket, store, and boot-state types with `base_branch`. Add all
+new copy to English, Portuguese, Simplified Chinese, and Traditional Chinese
+catalogs. Generate both Traditional Chinese variants with the current script.
+
+### Public documentation
+
+Update the repository-set section in `docs/public/tasks-and-workflows.md`. State
+how saved bases, task defaults, repository defaults, and unavailable branches
+work.
+
+## Tests
+
+| Acceptance criteria | Evidence |
+| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
+| `AC-WORKSPACES-REPOSITORY-SETS-001.8`, `AC-WORKSPACES-REPOSITORY-SETS-002.1` | Repository and service tests for migration, ordered persistence, validation, and atomic replacement. |
+| `AC-WORKSPACES-REPOSITORY-SETS-003.2` through `.8` | Pure apply tests and task-payload tests for idempotence, unavailable values, and local semantics. |
+| `AC-WORKSPACES-REPOSITORY-SETS-002.2` through `.9` | Component tests for rows, shared branch search, origin labels, reset, lazy loading, and responsive surfaces. |
+| `AC-WORKSPACES-REPOSITORY-SETS-003.9` | Save-as-set component and API tests for ordered member objects. |
+
+## E2E tests
+
+- Desktop settings creates and edits saved bases in
+ `apps/web/e2e/tests/settings/workspace-repository-sets.spec.ts`. The test also
+ proves search, remote-qualified names, origin badges, and refresh.
+- Desktop task creation applies those bases in
+ `apps/web/e2e/tests/task/create-task-repository-sets.spec.ts`.
+- Phone settings proves the full-height editor, internal scroll, safe footer,
+ touch targets, and selector containment in
+ `mobile-workspace-repository-sets.spec.ts`.
+- Phone task creation proves the same saved-base outcome in
+ `mobile-create-task-repository-sets.spec.ts`.
+
+## Work orders
+
+- [x] [Task 01: Persist member base branches](task-01-persist-member-base-branches.md)
+- [x] [Task 02: Apply saved bases to task drafts](task-02-apply-saved-bases.md)
+- [x] [Task 03: Build the responsive inline editor](task-03-responsive-inline-editor.md)
+- [x] [Task 04: Prove saved-base workflows](task-04-saved-base-e2e.md)
+- [x] [Task 05: Document repository-set bases](task-05-public-documentation.md)
+
+## Verification results
+
+- Backend focused packages pass: `go test ./internal/task/repository/sqlite
+./internal/task/service ./internal/task/dto ./internal/task/handlers
+./internal/backendapp`.
+- Frontend focused tests pass: 8 files, 103 tests. The task-draft and editor
+ work-order commands also pass independently with 82 and 46 tests.
+- `pnpm run typecheck`, `pnpm --filter @kandev/web lint`, `pnpm run i18n:check`,
+ `pnpm run i18n:ratchet`, and the changed-file E2E lint pass.
+- `make build-web` passes. Desktop repository-set E2E passes 7 tests, and mobile
+ repository-set E2E passes 3 tests.
+- Public documentation validation passes 61 tests and validates 41 published
+ pages. Specification lint passes all files.
+- The full-repository `lint:e2e-sleeps` command still reports unrelated existing
+ errors in other files; the five changed E2E files pass its rule directly.
+
+## Risks
+
+- The current task row overloads one branch value across executor types. The
+ implementation must not map a saved base to a local checkout.
+- Large sets can cause many Git requests if branch hooks become active during
+ row render. Selector-open state must gate each request.
+- SQLite and PostgreSQL both use the repository-set schema path. The migration
+ and scans must change together.
+- Old clients send `repository_ids`. Removing this input can break scripts and
+ existing E2E helpers.
+- An unavailable branch can persist after a remote deletion. The UI must keep
+ the value visible and block unintended substitution.
diff --git a/docs/plans/repository-set-base-branches/task-01-persist-member-base-branches.md b/docs/plans/repository-set-base-branches/task-01-persist-member-base-branches.md
new file mode 100644
index 0000000000..5a9fe2217e
--- /dev/null
+++ b/docs/plans/repository-set-base-branches/task-01-persist-member-base-branches.md
@@ -0,0 +1,94 @@
+---
+id: "01-persist-member-base-branches"
+title: "Persist member base branches"
+status: done
+wave: 1
+depends_on: []
+plan: "plan.md"
+requirements:
+ - REQ-WORKSPACES-REPOSITORY-SETS-001
+ - REQ-WORKSPACES-REPOSITORY-SETS-002
+acceptance_criteria:
+ - AC-WORKSPACES-REPOSITORY-SETS-001.8
+ - AC-WORKSPACES-REPOSITORY-SETS-002.1
+system_design:
+ - ../../specs/workspaces/system-design/repository-sets.md
+---
+
+# Task 01: Persist Member Base Branches
+
+## Summary
+
+Add an optional base branch to each persisted set member. Expose the value
+through service, HTTP, WebSocket, event, and boot-state contracts.
+
+## In scope
+
+- Add the replay-safe SQLite and PostgreSQL column migration.
+- Update repository-set models, scans, inserts, and replacements.
+- Accept ordered member objects and validate non-empty bases.
+- Keep `repository_ids` as a no-base compatibility input.
+- Include `base_branch` in DTOs and semantic events.
+
+## Out of scope
+
+- Frontend state and UI behavior.
+- Git branch existence requests during mutations.
+- Changes to repository defaults or task rows.
+
+## Acceptance
+
+- Existing member rows migrate with an empty base and keep their order.
+- Create and update persist every member base atomically.
+- Unsafe bases and conflicting input shapes produce no write.
+
+## Verification
+
+Run this command from `apps/backend`.
+
+```bash
+go test ./internal/task/repository/sqlite ./internal/task/service ./internal/task/dto ./internal/task/handlers ./internal/backendapp
+```
+
+## Files likely touched
+
+- `apps/backend/internal/task/models/models.go`
+- `apps/backend/internal/task/repository/interface.go`
+- `apps/backend/internal/task/repository/sqlite/base_schema.go`
+- `apps/backend/internal/task/repository/sqlite/base_migrations.go`
+- `apps/backend/internal/task/repository/sqlite/repository_set.go`
+- `apps/backend/internal/task/service/service_repository_sets.go`
+- `apps/backend/internal/task/dto/dto.go`
+- `apps/backend/internal/task/handlers/repository_set_handlers.go`
+- `apps/backend/internal/backendapp/boot_state_routes.go`
+- Existing repository-set tests beside these files
+
+## Dependencies
+
+None.
+
+## Risks
+
+- A schema query can reference the new column before the migration adds it.
+- A compatibility request can conflict with the new ordered member field.
+
+## Parallelism
+
+`sequential`
+
+## Inputs
+
+- `REQ-WORKSPACES-REPOSITORY-SETS-001`
+- `REQ-WORKSPACES-REPOSITORY-SETS-002`
+- System-design sections for data, persistence, service, and events
+
+## Results
+
+- Added `repository_set_items.base_branch` to the fresh schema and replayable
+ migration, with SQLite legacy-row and PostgreSQL parity coverage.
+- Persisted ordered member bases through repository, service, DTO, HTTP, WebSocket,
+ boot-state, and repository-set event paths.
+- Preserved `repository_ids` compatibility input and rejected unsafe or conflicting
+ member payloads atomically.
+- Verification: `go test ./internal/task/repository/sqlite ./internal/task/service
+./internal/task/dto ./internal/task/handlers ./internal/backendapp` (3848 passed).
diff --git a/docs/plans/repository-set-base-branches/task-02-apply-saved-bases.md b/docs/plans/repository-set-base-branches/task-02-apply-saved-bases.md
new file mode 100644
index 0000000000..c70f894ee4
--- /dev/null
+++ b/docs/plans/repository-set-base-branches/task-02-apply-saved-bases.md
@@ -0,0 +1,104 @@
+---
+id: "02-apply-saved-bases"
+title: "Apply saved bases to task drafts"
+status: done
+wave: 2
+depends_on:
+ - "01-persist-member-base-branches"
+plan: "plan.md"
+requirements:
+ - REQ-WORKSPACES-REPOSITORY-SETS-003
+acceptance_criteria:
+ - AC-WORKSPACES-REPOSITORY-SETS-003.2
+ - AC-WORKSPACES-REPOSITORY-SETS-003.3
+ - AC-WORKSPACES-REPOSITORY-SETS-003.4
+ - AC-WORKSPACES-REPOSITORY-SETS-003.5
+ - AC-WORKSPACES-REPOSITORY-SETS-003.6
+ - AC-WORKSPACES-REPOSITORY-SETS-003.7
+ - AC-WORKSPACES-REPOSITORY-SETS-003.8
+ - AC-WORKSPACES-REPOSITORY-SETS-003.9
+system_design:
+ - ../../specs/workspaces/system-design/repository-sets.md
+---
+
+# Task 02: Apply Saved Bases To Task Drafts
+
+## Summary
+
+Carry member bases through frontend types and set application. Keep the base
+separate from local checkout state during task submission.
+
+## In scope
+
+- Extend frontend HTTP, WebSocket, and store member types.
+- Copy saved bases into new task rows.
+- Preserve existing rows during repeated or overlapping application.
+- Block silent fallback for an unavailable copied base.
+- Send separate base and checkout values for local execution.
+- Make `Save as set` send ordered members with effective bases.
+
+## Out of scope
+
+- Settings editor composition.
+- Translation catalogs except copy owned by `Save as set`.
+- Browser E2E coverage.
+
+## Acceptance
+
+- Applying a set copies each available saved base into a new row.
+- Existing rows remain unchanged and duplicate application stays idempotent.
+- Local payloads never use a copied base as checkout without user action.
+
+## Verification
+
+Run this command from `apps/web`.
+
+```bash
+pnpm exec vitest run lib/api/domains/repository-sets-api.test.ts lib/ws/handlers/repository-sets.test.ts lib/state/slices/workspace/repository-sets-slice.test.ts components/task-create-dialog-repository-sets.test.ts components/task-create-dialog-helpers.multi-repo.test.ts components/task-create-dialog-repository-sets-save.test.tsx
+```
+
+## Files likely touched
+
+- `apps/web/lib/types/http.ts`
+- `apps/web/lib/types/backend.ts`
+- `apps/web/lib/api/domains/workspace-api.ts`
+- `apps/web/lib/ws/handlers/repository-sets.ts`
+- `apps/web/lib/state/slices/workspace/workspace-slice.ts`
+- `apps/web/components/task-create-dialog-types.ts`
+- `apps/web/components/task-create-dialog-repository-sets.ts`
+- `apps/web/components/task-create-dialog-repository-sets-apply.ts`
+- `apps/web/components/task-create-dialog-repository-sets-save.tsx`
+- `apps/web/components/task-create-dialog-helpers.ts`
+- Related unit tests
+
+## Dependencies
+
+- Task 01 supplies the member transport shape.
+
+## Risks
+
+- Existing auto-selection can overwrite a copied saved base.
+- Local and worktree executors interpret the current `branch` field differently.
+
+## Parallelism
+
+`sequential`
+
+## Inputs
+
+- `REQ-WORKSPACES-REPOSITORY-SETS-003`
+- System-design sections for task application and local executor semantics
+- Existing pure apply tests and multi-repository payload tests
+
+## Results
+
+- Copied saved member bases into new task rows while preserving empty branch
+ state for local checkout semantics.
+- Kept application additive and idempotent, blocked unavailable copied bases,
+ and preserved separate local base and checkout payload values.
+- Updated Save as set to send ordered member objects with effective bases.
+- Review follow-up: Save as set reports duplicate rows separately from
+ non-workspace rows. It explains that the first row and its base choice win.
+ Focused tests cover singular/plural counts, mixed exclusions, unchanged drafts,
+ and first-row bases in worktree, local, and fresh-branch modes.
+- Verification: the work-order Vitest command passed 6 files and 82 tests.
diff --git a/docs/plans/repository-set-base-branches/task-03-responsive-inline-editor.md b/docs/plans/repository-set-base-branches/task-03-responsive-inline-editor.md
new file mode 100644
index 0000000000..02389a0fe2
--- /dev/null
+++ b/docs/plans/repository-set-base-branches/task-03-responsive-inline-editor.md
@@ -0,0 +1,135 @@
+---
+id: "03-responsive-inline-editor"
+title: "Build the responsive inline editor"
+status: done
+wave: 3
+depends_on:
+ - "02-apply-saved-bases"
+plan: "plan.md"
+requirements:
+ - REQ-WORKSPACES-REPOSITORY-SETS-002
+ - REQ-WORKSPACES-REPOSITORY-SETS-003
+acceptance_criteria:
+ - AC-WORKSPACES-REPOSITORY-SETS-002.2
+ - AC-WORKSPACES-REPOSITORY-SETS-002.3
+ - AC-WORKSPACES-REPOSITORY-SETS-002.4
+ - AC-WORKSPACES-REPOSITORY-SETS-002.5
+ - AC-WORKSPACES-REPOSITORY-SETS-002.6
+ - AC-WORKSPACES-REPOSITORY-SETS-002.7
+ - AC-WORKSPACES-REPOSITORY-SETS-002.8
+ - AC-WORKSPACES-REPOSITORY-SETS-002.9
+ - AC-WORKSPACES-REPOSITORY-SETS-003.9
+system_design:
+ - ../../specs/workspaces/system-design/repository-sets.md
+---
+
+# Task 03: Build The Responsive Inline Editor
+
+## Summary
+
+Build the approved selected-member editor with one base selector per row. Use a
+desktop dialog and a full-height phone drawer with shared form state.
+
+## In scope
+
+- Show searchable and ordered selected-member rows.
+- Add repositories through a searchable picker.
+- Add per-row default and saved-base selectors.
+- Reuse New Task branch search, refresh, option mapping, and origin badges.
+- Gate branch loading on selector-open state.
+- Keep unavailable saved values visible.
+- Add Reset bases and responsive action regions.
+- Add localized copy in every supported catalog.
+
+## Out of scope
+
+- Backend transport changes.
+- Task payload construction.
+- Playwright coverage.
+
+## Acceptance
+
+- Opening a large set starts no branch request until a selector opens.
+- Branch rows match New Task names, search results, ordering, and origin badges.
+- Desktop and phone surfaces expose the same member and base actions.
+- The phone editor has one scroll owner, safe-area actions, and touch targets of
+ at least 44 CSS pixels.
+
+## Verification
+
+Run these commands from `apps/web`.
+
+```bash
+pnpm exec vitest run app/settings/workspace/workspace-repository-set-editor.test.tsx app/settings/workspace/workspace-repository-sets-section.test.tsx components/task-create-dialog-selectors.test.tsx components/combobox.test.tsx components/task-create-dialog-repository-sets-save.test.tsx
+pnpm run typecheck
+pnpm run i18n:check
+```
+
+## Files likely touched
+
+- `apps/web/app/settings/workspace/workspace-repository-set-editor.tsx`
+- `apps/web/app/settings/workspace/workspace-repository-sets-section.tsx`
+- `apps/web/app/settings/workspace/use-workspace-repository-sets.ts`
+- `apps/web/components/task-create-dialog-selectors.tsx`
+- `apps/web/components/task-create-dialog-branch-options.tsx`
+- `apps/web/components/combobox.tsx`
+- `apps/web/components/settings/repository-branch-policy-fields.tsx`
+- `apps/web/src/locales/en/workspaces.json`
+- `apps/web/src/locales/pt-pt/workspaces.json`
+- `apps/web/src/locales/zh-cn/workspaces.json`
+- `apps/web/src/locales/zh-hk/workspaces.json`
+- `apps/web/src/locales/zh-tw/workspaces.json`
+- Related component tests
+
+## Dependencies
+
+- Task 02 supplies the frontend member and task-draft shapes.
+
+## Risks
+
+- A hook per visible row can cause eager Git traffic.
+- A settings-only option mapper can drift from New Task labels and filtering.
+- Nested selectors can create more than one scroll owner on phones.
+- Saved unavailable values need a stable fallback option.
+
+## Parallelism
+
+`sequential`
+
+## Inputs
+
+- `REQ-WORKSPACES-REPOSITORY-SETS-002`
+- Mobile design contract in the repository-set system design
+- New Task `Pill`, `branchOptionValue`, `branchToOption`, and `sortBranches`
+- Repository branch-policy dialog and drawer patterns
+
+## Results
+
+- Scroll follow-up: the desktop wheel regression reproduced a branch list that
+ stayed at scrollTop zero. The editor now supplies its outer surface as the
+ shared picker portal container and allows popup overflow outside the form.
+ The member hint is shorter and remains visible on desktop and mobile.
+ Added desktop wheel and mobile touch regressions with 40 branches.
+ Validation passed: 47 focused component tests, 2 desktop and 3 mobile E2E
+ tests, TypeScript checking, changed-file ESLint, i18n checks, and spec lint.
+
+- UX follow-up: use the shared 28px desktop control sizing and responsive
+ touch targets for add, base, reset, and row actions. Keep the existing
+ full-height phone drawer and shared state. Portal the repository picker out
+ of the scrolling form and align it to the trigger's trailing edge.
+ Pad the desktop footer and override the shared bottom drawer's 80vh cap so
+ the phone editor retains its full-height contract.
+ Verification: 25 focused component tests and both settings Playwright specs
+ pass (2 desktop and 2 mobile tests). The browser checks cover 28px desktop
+ controls, repository-option hit targets, phone touch sizes, and drawer height.
+- Replaced the checkbox editor with ordered selected-member rows, searchable
+ add and filter controls, move/remove actions, per-member base selectors, and
+ Reset bases.
+- Reused New Task branch options and loading behavior, including unavailable
+ saved values and open-triggered branch requests.
+- Added the bounded desktop dialog and full-height phone drawer with one scroll
+ owner, safe-area footer, and touch-sized actions.
+- Added complete localized copy across English, Portuguese, Simplified Chinese,
+ Traditional Chinese, and the pseudo catalog.
+- Verification: the work-order Vitest command passed 5 files and 46 tests;
+ typecheck, web lint, i18n check, and i18n ratchet pass.
diff --git a/docs/plans/repository-set-base-branches/task-04-saved-base-e2e.md b/docs/plans/repository-set-base-branches/task-04-saved-base-e2e.md
new file mode 100644
index 0000000000..1aa191b97a
--- /dev/null
+++ b/docs/plans/repository-set-base-branches/task-04-saved-base-e2e.md
@@ -0,0 +1,107 @@
+---
+id: "04-saved-base-e2e"
+title: "Prove saved-base workflows"
+status: done
+wave: 4
+depends_on:
+ - "03-responsive-inline-editor"
+plan: "plan.md"
+requirements:
+ - REQ-WORKSPACES-REPOSITORY-SETS-002
+ - REQ-WORKSPACES-REPOSITORY-SETS-003
+acceptance_criteria:
+ - AC-WORKSPACES-REPOSITORY-SETS-002.2
+ - AC-WORKSPACES-REPOSITORY-SETS-002.5
+ - AC-WORKSPACES-REPOSITORY-SETS-002.7
+ - AC-WORKSPACES-REPOSITORY-SETS-002.8
+ - AC-WORKSPACES-REPOSITORY-SETS-002.9
+ - AC-WORKSPACES-REPOSITORY-SETS-003.4
+ - AC-WORKSPACES-REPOSITORY-SETS-003.6
+ - AC-WORKSPACES-REPOSITORY-SETS-003.9
+system_design:
+ - ../../specs/workspaces/system-design/repository-sets.md
+---
+
+# Task 04: Prove Saved-Base Workflows
+
+## Summary
+
+Extend repository-set Playwright coverage for saved bases. Prove the same user
+outcome on desktop and phone layouts.
+
+## In scope
+
+- Create and edit saved member bases in repository settings.
+- Apply a configured set in New Task and create the task.
+- Prove persisted task-repository bases.
+- Prove phone drawer containment, scrolling, safe footer, and touch targets.
+- Prove branch search, refresh, remote-qualified names, and origin badges.
+- Prove that large-set editor open does not start branch requests for every row.
+
+## Out of scope
+
+- Full E2E suite execution.
+- Remote URL and Quick Chat flows.
+- Visual asset capture.
+
+## Acceptance
+
+- Desktop creates a task with the configured base for each set member.
+- Settings uses the same searchable and origin-labeled branch rows as New Task.
+- Phone settings and task creation produce the same saved-base result.
+- Phone tests show no document-level horizontal overflow.
+
+## Verification
+
+Run `make build-web` from the repository root. Run the `pnpm` commands from
+`apps/web`.
+
+```bash
+make build-web
+```
+
+```bash
+pnpm e2e:raw --project=chromium e2e/tests/settings/workspace-repository-sets.spec.ts e2e/tests/task/create-task-repository-sets.spec.ts
+pnpm e2e:raw --project=mobile-chrome e2e/tests/settings/mobile-workspace-repository-sets.spec.ts e2e/tests/task/mobile-create-task-repository-sets.spec.ts
+```
+
+## Files likely touched
+
+- `apps/web/e2e/helpers/api-client.ts`
+- `apps/web/e2e/tests/settings/workspace-repository-sets.spec.ts`
+- `apps/web/e2e/tests/settings/mobile-workspace-repository-sets.spec.ts`
+- `apps/web/e2e/tests/task/create-task-repository-sets.spec.ts`
+- `apps/web/e2e/tests/task/mobile-create-task-repository-sets.spec.ts`
+
+## Dependencies
+
+- Task 03 completes the responsive UI and task workflow.
+
+## Risks
+
+- E2E branch fixtures need distinct branches in every test repository.
+- A stale web build can hide frontend changes.
+
+## Parallelism
+
+`sequential`
+
+## Inputs
+
+- Desktop and mobile repository-set E2E patterns
+- Mobile layout assertions
+- System-design verification strategy
+
+## Results
+
+- Desktop settings and task-create coverage verifies saved-base editing,
+ application, task persistence, idempotence, and Save as set behavior.
+- Desktop settings coverage opens the shared New Task branch picker and verifies
+ grouped search, refresh, local and remote-qualified values, and origin badges.
+- Phone settings coverage verifies the full-height drawer, internal scroll,
+ safe-area action footer, touch targets, picker search/refresh, remote badges,
+ viewport containment, and no document overflow.
+- Phone task-create coverage verifies the same saved base reaches the created
+ task repository.
+- Verification: `make build-web`, desktop E2E (8 tests), and mobile E2E (4
+ tests) pass.
diff --git a/docs/plans/repository-set-base-branches/task-05-public-documentation.md b/docs/plans/repository-set-base-branches/task-05-public-documentation.md
new file mode 100644
index 0000000000..a7a8fe82e5
--- /dev/null
+++ b/docs/plans/repository-set-base-branches/task-05-public-documentation.md
@@ -0,0 +1,87 @@
+---
+id: "05-public-documentation"
+title: "Document repository-set bases"
+status: done
+wave: 5
+depends_on:
+ - "04-saved-base-e2e"
+plan: "plan.md"
+requirements:
+ - REQ-WORKSPACES-REPOSITORY-SETS-002
+ - REQ-WORKSPACES-REPOSITORY-SETS-003
+acceptance_criteria:
+ - AC-WORKSPACES-REPOSITORY-SETS-002.1
+ - AC-WORKSPACES-REPOSITORY-SETS-002.3
+ - AC-WORKSPACES-REPOSITORY-SETS-002.6
+ - AC-WORKSPACES-REPOSITORY-SETS-003.3
+ - AC-WORKSPACES-REPOSITORY-SETS-003.4
+ - AC-WORKSPACES-REPOSITORY-SETS-003.7
+system_design:
+ - ../../specs/workspaces/system-design/repository-sets.md
+---
+
+# Task 05: Document Repository-Set Bases
+
+## Summary
+
+Update the public repository-set guide after the verified behavior exists. Use
+the same terms as the settings and task-create interfaces.
+
+## In scope
+
+- Explain saved bases, `Task default`, and the repository-default context.
+- Explain apply-time copy and existing-row preservation.
+- Explain unavailable saved bases and user repair.
+- Update API payload examples for ordered member objects and compatibility IDs.
+
+## Out of scope
+
+- General Git branch-policy documentation.
+- Release notes and marketing copy.
+
+## Acceptance
+
+- The guide no longer states that sets hold repositories only.
+- The guide distinguishes task defaults, repository defaults, saved bases, and
+ local checkout.
+- The API example includes the new ordered member field and compatibility note.
+
+## Verification
+
+Run these commands from the repository root.
+
+```bash
+git diff --check -- docs/public/tasks-and-workflows.md
+rg -n "repository set|saved base|Task default|repository_ids" docs/public/tasks-and-workflows.md
+```
+
+## Files likely touched
+
+- `docs/public/tasks-and-workflows.md`
+
+## Dependencies
+
+- Task 04 proves the final visible behavior.
+
+## Risks
+
+- The guide can describe planned UI instead of the implemented UI if this task
+ starts before E2E completion.
+
+## Parallelism
+
+`sequential`
+
+## Inputs
+
+- `REQ-WORKSPACES-REPOSITORY-SETS-002`
+- `REQ-WORKSPACES-REPOSITORY-SETS-003`
+- Verified UI labels from Task 04
+
+## Results
+
+- Updated the public task guide with saved bases, Task default and repository
+ default context, local checkout separation, unavailable-branch recovery, and
+ ordered API member objects with `repository_ids` compatibility.
+- Verification: the public-docs validator passed 61 tests, all 41 published
+ pages validated, and the task-specific diff and search checks pass.
diff --git a/docs/public/tasks-and-workflows.md b/docs/public/tasks-and-workflows.md
index 5aeb340256..99dcc199d7 100644
--- a/docs/public/tasks-and-workflows.md
+++ b/docs/public/tasks-and-workflows.md
@@ -83,7 +83,7 @@ Use **New Task** in the sidebar. In an open task, the **Task** split button also
| Source | Use it for | Important behavior |
| ---------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
- | **Repo** | A configured, discovered, or new local repository | Select a named branch policy or a raw base branch for each repository row. A policy creates a fresh branch from its saved base and uses its branch template. For a single-row new task, **Create new repository** initializes an empty `main` repository with one empty initial commit in a parent folder you choose. Add more rows for a multi-repository task. |
+ | **Repo** | A configured, discovered, or new local repository | Select a named branch policy or a raw base branch for each repository row. A policy creates a fresh branch from its saved base and uses its branch template. For a single-row new task, **Create new repository** initializes an empty `main` repository with one empty initial commit in a parent folder you choose. Add more rows for a multi-repository task. |
| **Remote** | A remote repository | Search configured GitHub, GitLab, or Azure DevOps repositories, or paste a supported URL. A pasted URL stays editable until you press Enter; then select the branch. Anonymous, credential-free reads include public GitHub repository branches, pull requests, and issues, plus public `gitlab.com` branch discovery. Private resources and authenticated browse/write features require valid provider credentials. |
| **None** | Planning, research, or work outside Git | Use a scratch workspace or an optional folder on the Kandev host. Git worktree execution and repository-aware Changes, branch, and pull-request features are unavailable. |
@@ -178,7 +178,7 @@ For a compact reminder while you read later replies, enable **Show anchored
prompt bar** in the same settings section. On desktop, it pins a shortened
copy of your latest prompt below the session tabs once you've scrolled past
it further down the transcript. It stays hidden while you're browsing earlier
- history above your prompt, even though the prompt itself is out of view.
+history above your prompt, even though the prompt itself is out of view.
use **Scroll to last prompt** to jump back to it instead. Expand the bar for
longer prompts, or use its scroll action to return to the full prompt; the
expanded view is capped at 40% of the transcript panel's height so it stays
@@ -207,17 +207,22 @@ A **repository set** is a named, reusable group of a workspace's repositories: d
once, then fill the repository picker with all of its repositories in a single action every time that
combination of repositories is the one you need.
-A set holds repositories only. Branches stay a per-task decision, so applying a set leaves each row's
-branch to the picker's normal defaulting, and you review and adjust branches exactly as when adding
-rows by hand.
+A set stores the repositories and order, plus an optional saved base branch for each member. When a
+member has no saved base, applying the set uses the task form's normal defaulting. A saved base is
+copied into the new task row, while the task branch or local checkout remains a separate choice.
Define a set in either place:
- **Settings → Workspaces → _workspace_ → Repositories**, in the **Repository sets** section: create,
- rename, edit which repositories belong, reorder them, and delete.
+ rename, add or remove repositories, set each member's base branch, reorder them, reset saved bases,
+ and delete.
- **New Task → Sets → Save as set**, which captures the repositories currently selected in the form
without disturbing the task you are creating.
+Each set contains a repository only once. If the form contains several rows for one repository,
+**Save as set** keeps the first row and its base choice. The dialog reports additional rows separately
+from rows that are not workspace repositories. The task draft keeps all its rows.
+
Apply one from the **Sets** control beside **add repository** in **New Task** and **New subtask**.
Applying a set adds one row per repository, in the set's order. It is additive and repeatable:
@@ -230,21 +235,30 @@ Applying a set adds one row per repository, in the set's order. It is additive a
Applying a set only fills the form. Nothing is saved until you create the task, so the repositories
the task ends up with are whatever the form holds when you submit.
+Each set member's base selector includes **Task default**, with the repository's current default branch
+shown as context when available. Open a selector to load its branch list. If a saved branch no longer
+exists, the form keeps that value visible as unavailable and blocks task creation until you select an
+available branch or **Task default**. For local execution, the saved base is used separately from the
+repository's current checkout branch.
+
Sets are also available over the API for scripted setup:
```text
GET /api/v1/workspaces/:id/repository-sets
-POST /api/v1/workspaces/:id/repository-sets {"name","description","repository_ids"}
+POST /api/v1/workspaces/:id/repository-sets {"name","description","repositories"}
GET /api/v1/repository-sets/:id
-PATCH /api/v1/repository-sets/:id any of name, description, repository_ids
+PATCH /api/v1/repository-sets/:id any of name, description, repositories
DELETE /api/v1/repository-sets/:id
```
-`repository_ids` is ordered and is the order a set fills the picker. A supplied `repository_ids`
-replaces the whole membership list, which is also how you reorder one; omit the field to leave
-membership untouched. The same five operations exist as `repository_set.list|create|get|update|delete`
-WebSocket actions, and `repository_set.created|updated|deleted` notifications keep every open client
-current. See [WebSocket API](websocket-api.md).
+`repositories` is an ordered list of objects. Each object has a `repository_id` and an optional
+`base_branch`; an empty or omitted base uses task defaulting. A supplied list replaces the whole
+membership list, which is also how you reorder one. Omit the field to leave membership untouched.
+Existing clients may send ordered `repository_ids`; those members have no saved bases. Do not send both
+member fields in one request. The same five operations exist as
+`repository_set.list|create|get|update|delete` WebSocket actions, and
+`repository_set.created|updated|deleted` notifications keep every open client current. See
+[WebSocket API](websocket-api.md).
Sets are workspace-scoped and shared: everyone who can see the workspace sees and can apply its sets.
A set name is unique within its workspace, compared case-insensitively. Deleting a set removes the
@@ -430,9 +444,9 @@ Explicit view selections (including Kanban, Pipeline, and List), task, session,
The **TASKS** list in the left sidebar has two time-based sort choices. These choices are separate from the sort choices in the task **List** view.
-| Sort choice | Meaning |
-| --- | --- |
-| **Updated** | The last task summary refresh. Background events, such as pull-request status changes, can change this time. |
+| Sort choice | Meaning |
+| ----------------- | ----------------------------------------------------------------------------------------------------------------------- |
+| **Updated** | The last task summary refresh. Background events, such as pull-request status changes, can change this time. |
| **Last activity** | The last real user or agent action. Opening or focusing a task and background provider polling do not change this time. |
Choose **Last activity** when you want to review tasks by the least recent user or agent interaction.
@@ -550,12 +564,12 @@ Pull configuration rejects self-references, cycles, and cross-workflow feeders.
### Configure events and transitions
-| Event | Available transition |
-| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| **On Turn Start** | Do nothing, move next, move previous, or move to a selected step when the user sends a message. |
-| **On Turn Complete** | **Do nothing (wait for user)**, move next, move previous, or move to a selected step after the agent turn. |
+| Event | Available transition |
+| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| **On Turn Start** | Do nothing, move next, move previous, or move to a selected step when the user sends a message. |
+| **On Turn Complete** | **Do nothing (wait for user)**, move next, move previous, or move to a selected step after the agent turn. |
| **Cancelled turn completion** | When enabled, an explicit user cancellation also runs this step's normal `on_turn_complete` actions after the cancelled turn settles. It bypasses the `auto_advance_requires_signal` / `step_complete_kandev` gate for that cancellation, but a pending clarification still blocks the transition. It does not apply to silent clarification cancellation, peer interruptions, parent/task stops, provider errors, crashes, or runtime teardown. |
-| **When Child Tasks Complete** | Do nothing, move next, move previous, or move to a selected step after every active direct child reaches `COMPLETED`, `FAILED`, or `CANCELLED`, provided the parent has an active session. |
+| **When Child Tasks Complete** | Do nothing, move next, move previous, or move to a selected step after every active direct child reaches `COMPLETED`, `FAILED`, or `CANCELLED`, provided the parent has an active session. |
The child-completion event ignores archived and ephemeral children, does not inspect grandchildren, and does nothing when the parent has no children. It also requires a parent session in `CREATED`, `STARTING`, `RUNNING`, or `WAITING_FOR_INPUT`; a parent with no session, or only an `IDLE`, `COMPLETED`, `FAILED`, or `CANCELLED` session, does not transition.
@@ -665,12 +679,12 @@ Revision history is not an immutable record of every autosave. Consecutive write
> [!EXPERIMENTAL]
> Office is feature-flagged, disabled in the production profile by default, and still in progress. Its named documents, labels, and blocker controls are not stable regular-Kanban features.
-| Capability | Regular Kanban | Office |
-| ------------------------------------- | -------------- | --------------------------------------------------- |
-| One versioned task plan | Available | Available in Office-specific surfaces where enabled |
-| Multiple named task documents | Not exposed | In-progress Office capability |
-| Task label editor and label filters | Not exposed | In-progress Office capability |
-| Blocked-by / blocking property editor | Set at task creation or over MCP; read-only afterwards | In-progress Office capability |
+| Capability | Regular Kanban | Office |
+| ------------------------------------- | ------------------------------------------------------ | --------------------------------------------------- |
+| One versioned task plan | Available | Available in Office-specific surfaces where enabled |
+| Multiple named task documents | Not exposed | In-progress Office capability |
+| Task label editor and label filters | Not exposed | In-progress Office capability |
+| Blocked-by / blocking property editor | Set at task creation or over MCP; read-only afterwards | In-progress Office capability |
Regular Kanban reads and enforces blocker relationships (see [Task dependencies](#task-dependencies)) but has no blocker filter and no in-place editor: dependencies are declared when the task is created or over MCP. Office additionally exposes named documents, labels, and its own blocker property editor. Do not treat those Office surfaces as a stable public contract yet.
@@ -678,9 +692,9 @@ Regular Kanban reads and enforces blocker relationships (see [Task dependencies]
Archive records the task as archived and removes it from active views immediately. Runtime stopping and physical cleanup then run in the background with a 60-second timeout. Cleanup is best-effort: a stop or deletion failure is logged and does not undo the archive, and Kandev preserves a runtime or environment when a nonterminal session cannot be stopped. Shared inherited environments and borrowed worktrees are also preserved while another active task still uses them.
-| Executor | Archive cleanup |
-| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| Local | Attempts to stop the agent runtime; leaves the local folder, files, and branch untouched. |
+| Executor | Archive cleanup |
+| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Local | Attempts to stop the agent runtime; leaves the local folder, files, and branch untouched. |
| Git worktree | Attempts to remove the Kandev-owned worktree directory. It keeps the local task branch and leaves any existing remote branch untouched. Shared or borrowed worktrees can remain until their last active user is gone. |
| Local Docker | Attempts to stop and remove the container; the host repository remains. |
| Kubernetes | Deletes only the recorded Pod and Kandev-managed PVC after exact UID and ownership checks. An existing claim is retained. |
diff --git a/docs/specs/workspaces/README.md b/docs/specs/workspaces/README.md
index fc510eef0b..a77d020399 100644
--- a/docs/specs/workspaces/README.md
+++ b/docs/specs/workspaces/README.md
@@ -30,8 +30,6 @@ Git state.
### Requirements
-
-
- [Branch Policies](requirements/branch-policies.md)
- [Create a Local Repository During Task Creation](requirements/create-local-repository.md)
- [Empty Remote Repositories](requirements/empty-remote-repositories.md)
@@ -57,6 +55,7 @@ Git state.
- [Worktree Base Refresh](system-design/worktree-base-refresh.md)
- [Local Workspace Repositories](system-design/local-repositories.md)
- [Organization Units](system-design/org-units.md)
+- [Repository Sets](system-design/repository-sets.md)
## Migration record
diff --git a/docs/specs/workspaces/requirements/repository-sets.md b/docs/specs/workspaces/requirements/repository-sets.md
index df41fbd558..c712a9b09c 100644
--- a/docs/specs/workspaces/requirements/repository-sets.md
+++ b/docs/specs/workspaces/requirements/repository-sets.md
@@ -5,236 +5,155 @@ created: 2026-08-17
owners:
- kandev
---
+
# Repository Sets Requirements
## Overview
-A workspace can hold dozens of repositories, and real work rarely touches one of them. A feature that runs from a web client through an API gateway into two backend services means the same four repositories are picked, one chip at a time, every time a task is created. The selection is knowledge the user already has and re-enters by hand on every task, and a repository forgotten on the third of four chips is only discovered once the agent cannot find the code.
+A workspace can contain many repositories. Most tasks use a known subset of
+those repositories. A repository set stores that reusable selection and its
+order.
+
+Some teams also start work from different base branches in each repository.
+The set can store an optional base-branch preference for each member. This
+preference reduces repeated task setup without changing repository defaults.
+
+The workspace system owns this contract because it owns repository membership,
+repository settings, and repository branch information.
+
+## Terminology
+
+- **Repository set:** A named and ordered group of repositories in one
+ workspace.
+- **Set member:** One repository and its position in a repository set.
+- **Saved base:** An optional base branch on a set member.
+- **Task default:** The existing task-form branch selection when a set has no
+ saved base.
+- **Repository default:** The current `default_branch` of a repository.
## Requirements
-### REQ-WORKSPACES-REPOSITORY-SETS-001: Repository Sets
+### REQ-WORKSPACES-REPOSITORY-SETS-001: Repository set management
-**Intent:** A workspace can hold dozens of repositories, and real work rarely touches one of them. A feature that runs from a web client through an API gateway into two backend services means the same four repositories are picked, one chip at a time, every time a task is created. The selection is knowledge the user already has and re-enters by hand on every task, and a repository forgotten on the third of four chips is only discovered once the agent cannot find the code.
+**Intent:** Users can reuse a known repository selection when they create a
+task.
#### Acceptance criteria
-- **AC-WORKSPACES-REPOSITORY-SETS-001.1:** A workspace owns any number of repository sets. A set has a name, an optional description, and an ordered list of repositories drawn from that same workspace.
-- **AC-WORKSPACES-REPOSITORY-SETS-001.2:** Sets are managed from **Settings > Workspaces > _workspace_ > Repositories**, in a **Repository sets** section below the repository list. The section lists each set with its name, description, and member repositories, and offers create, rename, edit-members, reorder, and delete.
-- **AC-WORKSPACES-REPOSITORY-SETS-001.3:** Sets can also be created from the task-creation dialog: **Save as set** captures the workspace repositories currently selected in the form, asks for a name, and creates the set without discarding the in-progress task.
-- **AC-WORKSPACES-REPOSITORY-SETS-001.4:** A set name is trimmed, is 1 to 100 characters, and is unique within its workspace, compared case-insensitively. A second set named `Full-stack` in a workspace that already has `full-stack` is rejected and the existing set is named in the error.
-- **AC-WORKSPACES-REPOSITORY-SETS-001.5:** A set holds each repository at most once. Ordering is user-controlled and is the order in which the set fills the picker.
-- **AC-WORKSPACES-REPOSITORY-SETS-001.6:** Creating or updating a set requires at least one repository. A set that becomes empty because its repositories were deleted is kept, not removed.
-- **AC-WORKSPACES-REPOSITORY-SETS-001.7:** Sets are workspace-scoped, not per-user: every user who can see the workspace sees and can apply its sets.
-- **AC-WORKSPACES-REPOSITORY-SETS-001.8:** The repository row of the task-creation dialog gains a **Sets** control next to **add repository**, listing the workspace's sets by name with their repository count.
+- **AC-WORKSPACES-REPOSITORY-SETS-001.1:** A workspace shall own any number of
+ repository sets. Each set shall have a name, an optional description, and an
+ ordered list of repositories from that workspace.
+- **AC-WORKSPACES-REPOSITORY-SETS-001.2:** The repository settings page shall
+ list each set with its name, description, and members. Users shall be able to
+ create, rename, reorder, edit, and delete sets.
+- **AC-WORKSPACES-REPOSITORY-SETS-001.3:** A set name shall contain 1 to 100
+ characters after trimming. Names shall be unique in a workspace under a
+ case-insensitive comparison.
+- **AC-WORKSPACES-REPOSITORY-SETS-001.4:** A set shall contain each repository
+ at most once. A user-created set shall contain at least one repository.
+- **AC-WORKSPACES-REPOSITORY-SETS-001.5:** When repository deletion removes the
+ last member, the system shall keep the empty set.
+- **AC-WORKSPACES-REPOSITORY-SETS-001.6:** Every user with workspace access
+ shall see the same sets. Workspace write permissions shall control set
+ mutations.
+- **AC-WORKSPACES-REPOSITORY-SETS-001.7:** A mutation shall update other open
+ clients through the repository-set event stream.
+- **AC-WORKSPACES-REPOSITORY-SETS-001.8:** Set writes shall be atomic. A
+ rejected name, member, order, or saved base shall not cause a partial write.
-## Migrated source detail
+### REQ-WORKSPACES-REPOSITORY-SETS-002: Saved base branches
-## Why
+**Intent:** Users can reuse the base branch for each repository in a set.
-A workspace can hold dozens of repositories, and real work rarely touches one of them. A feature
-that runs from a web client through an API gateway into two backend services means the same four
-repositories are picked, one chip at a time, every time a task is created. The selection is
-knowledge the user already has and re-enters by hand on every task, and a repository forgotten on
-the third of four chips is only discovered once the agent cannot find the code.
+**User story:** As a user, I want to save each repository base branch, so that I
+do not select every branch for each task.
-A **repository set** is a named, reusable group of workspace repositories. Choosing a set fills the
-task-creation repository picker with every repository in it, in one action. Branches remain a
-per-task decision and are never stored in a set.
+#### Acceptance criteria
-## What
+- **AC-WORKSPACES-REPOSITORY-SETS-002.1:** Each set member shall store zero or
+ one saved base. A member without a saved base shall use normal task-form
+ defaulting when the set is applied.
+- **AC-WORKSPACES-REPOSITORY-SETS-002.2:** The set editor shall show selected
+ members as searchable, ordered rows. Each row shall show its repository and a
+ base-branch selector.
+- **AC-WORKSPACES-REPOSITORY-SETS-002.3:** The selector shall include a
+ `Task default` choice. The choice shall show the current repository default
+ as supporting context when that value is available.
+- **AC-WORKSPACES-REPOSITORY-SETS-002.4:** A reset action shall remove all saved
+ bases from the draft. The action shall not remove or reorder members.
+- **AC-WORKSPACES-REPOSITORY-SETS-002.5:** Branch lists shall load when a user
+ opens a selector. Opening a set with many members shall not start one branch
+ request for every member.
+- **AC-WORKSPACES-REPOSITORY-SETS-002.6:** A saved base that is no longer
+ available shall remain visible with an unavailable state. The system shall
+ not replace it with another branch.
+- **AC-WORKSPACES-REPOSITORY-SETS-002.7:** The desktop editor shall use a modal
+ surface. The phone editor shall use a full-height surface with one scroll
+ region and a safe-area action footer.
+- **AC-WORKSPACES-REPOSITORY-SETS-002.8:** All required actions shall support
+ keyboard, pointer, and touch input. Touch targets shall be at least 44 CSS
+ pixels in their active dimension.
+- **AC-WORKSPACES-REPOSITORY-SETS-002.9:** The base control shall use the same
+ selector behavior as New Task. It shall include branch search, refresh,
+ remote-qualified names, and local or remote-origin labels.
-### Defining a set
+### REQ-WORKSPACES-REPOSITORY-SETS-003: Task form application
-- A workspace owns any number of repository sets. A set has a name, an optional description, and an
- ordered list of repositories drawn from that same workspace.
-- Sets are managed from **Settings > Workspaces > _workspace_ > Repositories**, in a **Repository
- sets** section below the repository list. The section lists each set with its name, description,
- and member repositories, and offers create, rename, edit-members, reorder, and delete.
-- Sets can also be created from the task-creation dialog: **Save as set** captures the workspace
- repositories currently selected in the form, asks for a name, and creates the set without
- discarding the in-progress task.
-- A set name is trimmed, is 1 to 100 characters, and is unique within its workspace, compared
- case-insensitively. A second set named `Full-stack` in a workspace that already has `full-stack`
- is rejected and the existing set is named in the error.
-- A set holds each repository at most once. Ordering is user-controlled and is the order in which
- the set fills the picker.
-- Creating or updating a set requires at least one repository. A set that becomes empty because its
- repositories were deleted is kept, not removed.
-- Sets are workspace-scoped, not per-user: every user who can see the workspace sees and can apply
- its sets.
+**Intent:** Applying a set fills the task form without removing user work.
-### Applying a set
+#### Acceptance criteria
-- The repository row of the task-creation dialog gains a **Sets** control next to **add
- repository**, listing the workspace's sets by name with their repository count.
-- Choosing a set adds one repository row per member, in set order, leaving each row's branch empty
- so the dialog's existing per-row branch defaulting fills it. The user then reviews and adjusts
- branches exactly as when adding rows by hand.
-- A single empty placeholder row is consumed by the first applied repository rather than left
- behind. Rows the user already configured are never discarded or reordered by applying a set.
-- Applying a set is additive and idempotent: a repository already present in the form is skipped,
- so applying the same set twice changes nothing and applying two overlapping sets yields the union.
-- A member repository that no longer exists in the workspace, or was deleted, is skipped. When any
- member is skipped the dialog reports how many were skipped and why, as visible text.
-- The same control appears in the **new subtask** form, which uses the same repository picker. It
- does not appear in Quick Chat.
-- The control is absent when the workspace has no sets **and** the current selection cannot be saved
- as one, so a control that could only report "you have no sets" never appears. When the form does
- hold a workspace repository, the control stays available with **Save as set** and no set entries:
- otherwise the first set could never be defined from the flow that just chose the repositories.
-- The control is absent in **Remote URL** and **No repository** source modes, where workspace
- repositories are not what is being selected.
-- The control is never disabled by executor capability. **Add repository** beside it is not
- executor-gated either: the repository selection is what constrains which executor profiles stay
- selectable, and the executor picker already marks an incompatible profile unavailable with its
- reason. Applying a set on a single-repository executor therefore behaves exactly like adding the
- same rows by hand.
-- Applying a set changes only the form. No task, repository, or set is modified, and nothing is
- persisted until the task is created.
+- **AC-WORKSPACES-REPOSITORY-SETS-003.1:** New Task and New Subtask shall show a
+ `Sets` control next to the repository action. Each option shall show the set
+ name and member count.
+- **AC-WORKSPACES-REPOSITORY-SETS-003.2:** Applying a set shall add one row for
+ each available member, in set order. The action shall consume one empty
+ placeholder row.
+- **AC-WORKSPACES-REPOSITORY-SETS-003.3:** Applying a set shall skip a repository
+ that is already in the form. The action shall not change or reorder that
+ existing row.
+- **AC-WORKSPACES-REPOSITORY-SETS-003.4:** Applying a set shall copy each saved
+ base into its new task row. A member without a saved base shall use normal
+ task-form defaulting.
+- **AC-WORKSPACES-REPOSITORY-SETS-003.5:** The task form shall show an unavailable
+ copied base. The user shall select an available base or the task default
+ before task creation.
+- **AC-WORKSPACES-REPOSITORY-SETS-003.6:** Local execution shall keep the saved
+ base separate from the checkout branch. Applying a set shall not silently use
+ the saved base as the local checkout branch.
+- **AC-WORKSPACES-REPOSITORY-SETS-003.7:** Applying a set shall change only the
+ task draft. Later set changes shall not change existing tasks or open drafts.
+- **AC-WORKSPACES-REPOSITORY-SETS-003.8:** When members are missing, the form
+ shall skip them and show the number skipped. Applying the same set twice
+ shall not add duplicate rows.
+- **AC-WORKSPACES-REPOSITORY-SETS-003.9:** `Save as set` shall capture the
+ workspace repositories and effective bases shown in the task form. The dialog
+ shall state that it saves base choices. A `Task default` choice shall remain
+ an empty saved base.
+ When a repository appears on several rows, saving shall keep the first row and
+ its effective base. The dialog shall explain this rule and report additional
+ rows separately from rows that are not workspace repositories.
+- **AC-WORKSPACES-REPOSITORY-SETS-003.10:** The control shall remain absent from
+ Quick Chat, Remote URL, and No repository modes. Executor capability shall not
+ hide or disable the control.
-### Live updates
+## Compatibility
-- A set created, changed, or deleted in one client appears in every other client viewing that
- workspace without a reload.
-
-## Data model
-
-Two new tables, both workspace-owned.
-
-`repository_sets`
-
-| Field | Contract |
-| -------------------------- | ----------------------------------------------------------------- |
-| `id` | Stable set identity. |
-| `workspace_id` | Owning workspace; cascade-deleted with the workspace. |
-| `name` | Trimmed, 1 to 100 characters, unique per workspace. |
-| `description` | Optional free text, defaults to empty. |
-| `created_at`, `updated_at` | Audit timestamps. |
-
-`(workspace_id, name)` is unique in the database, and a second unique index on
-`(workspace_id, LOWER(name))` makes that backstop case-insensitive too. The service rejects a
-case-insensitive collision with a message naming the existing set; the index is what stops two
-concurrent creates of `Full-stack` and `full-stack` from both landing.
-
-`repository_set_items`
-
-| Field | Contract |
-| -------------------------- | ------------------------------------------------------------------- |
-| `id` | Stable membership identity. |
-| `repository_set_id` | Owning set; cascade-deleted with the set. |
-| `repository_id` | A repository in the same workspace as the set. |
-| `position` | Zero-based order within the set; contiguous after every write. |
-| `created_at`, `updated_at` | Audit timestamps. |
-
-`(repository_set_id, repository_id)` is unique: a set cannot list the same repository twice.
-
-Sets deliberately store **no branch**. Branch choice belongs to a task, is already modelled on
-`task_repositories.base_branch` / `checkout_branch`, and is what the user still decides per task.
-
-Repositories are soft-deleted (`repositories.deleted_at`), so a foreign-key cascade does not remove
-memberships. Deleting a repository removes its `repository_set_items` rows in the same transaction
-that soft-deletes it, and every read of a set also excludes members whose repository is soft-deleted
-or has moved out of the workspace. Either mechanism alone is sufficient; both are present so a set
-can never surface a repository the user cannot select.
-
-## API surface
-
-Collection routes are workspace-scoped, item routes are flat, matching the existing repository
-routes.
-
-```
-GET /api/v1/workspaces/:id/repository-sets
-POST /api/v1/workspaces/:id/repository-sets
-GET /api/v1/repository-sets/:id
-PATCH /api/v1/repository-sets/:id
-DELETE /api/v1/repository-sets/:id
-```
-
-Create request:
-
-```json
-{
- "name": "Full-stack",
- "description": "web + gateway + services",
- "repository_ids": ["repo-web", "repo-gateway", "repo-orders"]
-}
-```
-
-`repository_ids` is ordered and defines `position`. Update accepts `name`, `description`, and
-`repository_ids` independently; a supplied `repository_ids` replaces the whole membership list,
-which is also how reordering is expressed.
-
-Response:
-
-```json
-{
- "id": "set-1",
- "workspace_id": "ws-1",
- "name": "Full-stack",
- "description": "web + gateway + services",
- "repositories": [
- { "repository_id": "repo-web", "position": 0 },
- { "repository_id": "repo-gateway", "position": 1 },
- { "repository_id": "repo-orders", "position": 2 }
- ],
- "created_at": "2026-08-17T09:00:00Z",
- "updated_at": "2026-08-17T09:00:00Z"
-}
-```
-
-The same five operations are available over the WebSocket dispatcher as
-`repository_set.list|create|get|update|delete`, mirroring `repository.*`, so clients on the socket
-do not need a second transport.
-
-Set membership is also exposed on the boot payload as a workspace-keyed `repositorySets`
-collection, so the task-creation dialog can offer sets on first paint without a fetch.
-
-## Permissions
-
-- Every route resolves the workspace and applies the same workspace-access authorization already
- required for repository routes. A user without access to the workspace receives the same response
- as for a workspace that does not exist.
-- Item routes (`/repository-sets/:id`) resolve the set's workspace first and authorize against it;
- a set id from another workspace is not readable, writable, or deletable.
-- `repository_ids` are validated against the set's workspace. A repository id from another
- workspace is rejected and does not reveal whether that id exists.
-
-## Failure modes
-
-| Situation | Result |
-| ------------------------------------------------------------ | --------------------------------------------------------------- |
-| Malformed body, blank name, name over 100 characters | `400`, no write |
-| Empty or absent `repository_ids` on create, empty on update | `400`, no write |
-| Duplicate id inside `repository_ids` | `400`, no write |
-| Unknown workspace, unknown set, or no workspace access | `404`, no write |
-| Name already used in the workspace, case-insensitively | `409` naming the existing set, no write |
-| A `repository_id` is unknown, deleted, or in another workspace | `422` listing the offending ids, no write |
-| Repository listing fails while building the boot payload | Boot succeeds with an empty set list; the dialog fetches instead |
-| A set's members were all deleted | The set lists as empty and cannot be applied; it is not removed |
-| Applying a set on an executor that forbids multi-repository | The set applies; the executor picker marks that profile unavailable |
-
-Writes are atomic: name, description, and membership of one request either all land or none do,
-because the store applies both halves in a single transaction. A set deleted between the read and
-the write is reported as not found rather than resurrected.
-
-## Persistence guarantees
-
-- A created or updated set is durable before the response returns, and its membership positions are
- contiguous from zero in the order requested.
-- Deleting a workspace deletes its sets and memberships. Deleting a set deletes its memberships and
- leaves every repository untouched. Deleting a repository removes it from every set, leaves the
- sets themselves intact, and publishes each affected set's new shape so open clients stop offering
- the deleted member.
-- Applying a set writes nothing. The repositories that reach `task_repositories` are whatever the
- form holds at submit, so a set applied and then edited persists the edited selection.
-- Sets survive backup and restore with the rest of the workspace schema, and the schema
- initialization is replay-safe: initializing twice against the same database is a no-op.
+- Existing sets shall load with no saved bases and shall preserve current task
+ defaulting.
+- Existing create and update clients that send ordered `repository_ids` shall
+ remain valid. Those members shall have no saved bases.
+- Deleting a set shall not change its repositories or tasks that used it.
## Out of scope
-- Branches, agent profiles, executor profiles, or workflows stored in a set. A set is repositories.
-- Remote-URL and folder sources. Sets reference workspace repository entities.
-- Quick Chat, and adding sources to an already-created task.
-- Cross-workspace and per-user sets.
-- Automatic set suggestions derived from task history.
+- A shared branch value that is applied to every repository.
+- Branch policies, branch templates, pull-request targets, agent profiles,
+ executor profiles, or workflows in a set.
+- Remote-URL sources, folder sources, cross-workspace sets, and per-user sets.
+- Automatic repair of unavailable saved bases.
+
+## Traceability
+
+- System design: [Repository sets](../system-design/repository-sets.md)
+- Implementation plan: [Repository set base branches](../../../plans/repository-set-base-branches/plan.md)
diff --git a/docs/specs/workspaces/system-design/repository-sets.md b/docs/specs/workspaces/system-design/repository-sets.md
new file mode 100644
index 0000000000..090e930576
--- /dev/null
+++ b/docs/specs/workspaces/system-design/repository-sets.md
@@ -0,0 +1,281 @@
+---
+status: draft
+system: workspaces
+requirements:
+ - REQ-WORKSPACES-REPOSITORY-SETS-001
+ - REQ-WORKSPACES-REPOSITORY-SETS-002
+ - REQ-WORKSPACES-REPOSITORY-SETS-003
+---
+
+# Repository Sets System Design
+
+## Purpose and boundaries
+
+The workspace system owns repository-set persistence, authorization, transport,
+and settings behavior. The task form consumes a set as a reusable draft input.
+
+A set stores an optional base for each member. Applying a set copies this value
+into the task draft. The task service remains the authority for task-repository
+snapshots and launch behavior.
+
+The saved base does not change `repositories.default_branch`. It also does not
+create a live link between a set and a task.
+
+## Requirement mapping
+
+| Requirement | Design sections |
+| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `REQ-WORKSPACES-REPOSITORY-SETS-001` | [Persistence](#persistence), [Service and transport](#service-and-transport), [Events and boot state](#events-and-boot-state) |
+| `REQ-WORKSPACES-REPOSITORY-SETS-002` | [Settings experience](#settings-experience), [Shared branch selector](#shared-branch-selector), [Branch loading](#branch-loading), [Responsive behavior](#responsive-behavior) |
+| `REQ-WORKSPACES-REPOSITORY-SETS-003` | [Task form application](#task-form-application), [Local executor semantics](#local-executor-semantics), [Failure and recovery](#failure-and-recovery) |
+
+## Data model
+
+`repository_sets` keeps its current fields and workspace ownership.
+
+`repository_set_items` adds `base_branch TEXT NOT NULL DEFAULT ''`. An empty
+value means that the set does not override normal task-form defaulting.
+
+The `RepositorySetItem` model and DTO add `BaseBranch` and `base_branch`.
+Responses always include the ordered member list. A member can omit
+`base_branch` when it has no override.
+
+The set remains a draft template. It does not store a branch-policy ID,
+checkout branch, generated task branch, or pull-request target.
+
+## Persistence
+
+The SQLite and PostgreSQL schema migration adds the new column before any query
+uses it. The migration is replay-safe. The base schema includes the column for
+new databases.
+
+Repository-set create and update operations write metadata and all member
+fields in one transaction. Membership replacement preserves the requested
+order and assigns contiguous positions.
+
+Existing rows receive an empty base. Backup and restore include the new column
+through the existing database process.
+
+## Service and transport
+
+The service accepts ordered member inputs with `repository_id` and optional
+`base_branch`. It validates these facts before the transaction:
+
+- Each repository is live and belongs to the set workspace.
+- Each repository occurs once.
+- Each non-empty base passes `securityutil.IsValidBaseBranchRef`.
+
+The service does not query Git during a write. Branch existence can change
+after any check, and Git access can require credentials that are not available
+to a settings request.
+
+Create and update payloads add an ordered `repositories` field:
+
+```json
+{
+ "name": "Central",
+ "description": "Core services",
+ "repositories": [
+ { "repository_id": "repo-document", "base_branch": "develop" },
+ { "repository_id": "repo-classifier", "base_branch": "" }
+ ]
+}
+```
+
+The existing `repository_ids` field remains a compatibility input. Each ID
+becomes a member with an empty base. A request that contains both member fields
+is invalid because their order or values can conflict.
+
+HTTP and WebSocket handlers use the same request type and service methods. The
+same error categories remain stable. An unsafe base produces a validation
+error and no write.
+
+## Events and boot state
+
+Repository-set DTOs include `base_branch` in list, get, create, and update
+responses. The `repository_set.created` and `repository_set.updated` events use
+the same member shape.
+
+The boot-state projection uses the DTO without a second mapping. The workspace
+store and WebSocket handlers preserve the complete member objects.
+
+## Settings experience
+
+The approved editor uses one inline row for each selected repository. The
+desktop modal contains these elements:
+
+- Name and description fields.
+- A search field for the selected-member list.
+- Ordered member rows with a repository label and base selector.
+- An Add repository action.
+- A Reset bases action.
+- Cancel and Save actions.
+
+The base selector starts with `Task default`. When available, supporting text
+also shows `repositories.default_branch`. Choosing this option stores an empty
+base and preserves current task-form defaulting.
+
+The list shows only selected members. The Add repository action opens a
+searchable list of remaining workspace repositories. Existing move controls
+preserve explicit member order.
+
+Set summary cards keep their current member chips. A member with a saved base
+shows the base as secondary text or a compact suffix. The card does not fetch
+branch lists.
+
+## Shared branch selector
+
+The set editor reuses the `Pill` popover/list primitive from
+`task-create-dialog-pill.tsx`, the same primitive rendered by New Task's
+`RepoChipBranchPill`. It does not create a settings-only branch selector or a
+second lookalike popover.
+
+The editor builds branch options with `sortBranches`, `branchOptionValue`, and
+`branchToOption` from `task-create-dialog-branch-options.tsx`. This shared
+option model supplies these behaviors:
+
+- Search uses the same branch scoring and keywords as New Task.
+- Remote branches keep qualified names such as `origin/main`.
+- Local branches show the `local` badge.
+- Remote branches show the remote name, such as `origin` or `followup`.
+- Provider branches without a remote name show the `remote` badge.
+- The shared popover keeps search and refresh in one row, groups branches under
+ `Branches`, and preserves the New Task keyboard, pointer, and portal behavior.
+
+The editor supplies its dialog or drawer surface as the shared picker portal
+container. Pickers remain inside the modal scroll-lock boundary but outside
+the scrolling form. The outer surface allows overflow so it does not clip
+the floating picker. Mouse-wheel and touch gestures scroll the option list.
+
+`Task default` is a synthetic first option for base pickers. It does not change
+the shared mapping, search terms, ordering, badges, or selected-branch display.
+
+The shared `Pill` accepts an optional open-state callback for settings' lazy
+branch loading. New Task keeps its current behavior when the callback is
+absent.
+
+## Branch loading
+
+The trigger can show these values without a branch request:
+
+- A saved base from the set member.
+- The repository default from the workspace repository DTO.
+- The loading or unavailable state.
+
+The editor enables `useBranches` only while a row selector is open. This rule
+prevents an immediate request for every member in a large set.
+
+After the list loads, the selector compares the saved base with all available
+branch option values from `branchOptionValue`. A missing value remains in the
+selector as a disabled fallback option with an unavailable marker.
+
+The frontend can save an unchanged unavailable value. A user cannot select a
+new value that is absent from the current list. The backend still validates the
+Git-ref syntax for all values.
+
+## Responsive behavior
+
+Desktop uses the existing dialog pattern. The dialog has a bounded height and
+one internal scroll region for member rows.
+
+Phone layouts use the full-height drawer pattern from repository branch-policy
+settings. The drawer uses `100dvh`, one scrolling body, and a fixed footer. The
+footer includes safe-area padding.
+
+Each member row stacks its repository label above a full-width base selector on
+phones. Add, remove, move, reset, save, and cancel actions have touch targets of
+at least 44 CSS pixels.
+
+The phone editor uses the same searchable `Pill` popover as New Task. The
+popover stays inside the viewport and owns the temporary option-list scroll. It
+keeps the origin badges, refresh action, focus return, and keyboard behavior.
+
+The domain draft, validation, mutations, and branch option mapping are shared
+between desktop and phone layouts. Only the surface composition changes.
+
+## Task form application
+
+`RepositorySetItem` supplies the saved base to `applyRepositorySet`. A new
+`TaskRepoRow` keeps the copied base separate from checkout state.
+
+Applying a set follows this order:
+
+1. Resolve the member against the current workspace repository list.
+2. Skip the member when the repository is missing or already in the form.
+3. Add a row with the saved base and no branch-policy selection.
+4. Let normal row defaulting resolve an empty saved base.
+
+The action never changes an existing row. This rule preserves manual edits and
+keeps repeated or overlapping set application idempotent.
+
+The task branch selector shows the effective base. If a copied saved base is
+unavailable, the row shows the value and blocks submission. The user must select
+an available branch or `Task default`. Selecting `Task default` clears the
+copied base so normal task-form branch autoselection runs again.
+
+`Save as set` sends ordered member objects. It captures each workspace
+repository and the effective base in the draft. A `Task default` choice sends
+an empty base. The visible summary states that base choices are included.
+
+Saving keeps the first row for each workspace repository, including its effective
+base. The dialog counts additional rows separately from non-workspace rows and
+explains that only the first row is saved. Neither exclusion changes the draft.
+
+## Local executor semantics
+
+The task draft keeps these values separate:
+
+- The effective base from the set member or repository default.
+- The checkout branch that represents the current local working branch.
+
+For worktree-based execution, the effective base remains the source for
+`base_branch`. For local execution, submission sends the effective base as
+`base_branch` and the local working branch as `checkout_branch` when they
+differ.
+
+The task row shows both values when local execution makes them different. A
+copied saved base never changes the local checkout branch as a side effect.
+
+## Failure and recovery
+
+| Condition | Behavior |
+| -------------------------------------------- | ----------------------------------------------------------------- |
+| A member repository is missing | Applying skips the member and reports the count. |
+| A saved base is unsafe | The service rejects the set write with no partial change. |
+| A saved base disappears | Settings and task creation keep the value visible as unavailable. |
+| A branch request fails | The open selector shows retry behavior and keeps the draft value. |
+| An old client sends `repository_ids` | The service stores members with no saved bases. |
+| An open task draft already contains a member | Applying keeps the existing row unchanged. |
+
+The frontend does not substitute a repository default for an unavailable saved
+base. This rule prevents tasks from starting from an unintended branch.
+
+## Permissions and security
+
+Repository-set routes keep their current workspace authorization. Item routes
+resolve the owning workspace before read or write access.
+
+The service validates all repository IDs against the set workspace. It does not
+reveal whether a cross-workspace ID exists. Safe Git-ref validation prevents a
+saved base from becoming a command argument with unsafe syntax.
+
+## Localization and accessibility
+
+All new labels, hints, unavailable states, errors, and summaries use i18n keys.
+The five supported catalogs contain the same keys and placeholders.
+
+The editor uses semantic controls and visible labels. Selector triggers expose
+accessible names. Focus returns to the trigger after a selector closes.
+
+## Verification strategy
+
+- Repository tests cover fresh schema, replay, existing-row migration, ordered
+ base persistence, atomic replacement, and SQLite/PostgreSQL behavior.
+- Service and handler tests cover validation, compatibility payloads, DTOs,
+ events, and authorization.
+- Frontend unit tests cover API mapping, store events, apply rules, unavailable
+ bases, save-as-set input, and local base-versus-checkout submission.
+- Component tests cover search, add, remove, reorder, reset, lazy branch loads,
+ and responsive surface selection.
+- Desktop and mobile Playwright tests create a set, save member bases, apply the
+ set, and create a task with the expected repository bases.