Skip to content

armgit / pibot

Public Imported from GitHub
0

Open-source, local-first AI agent team for your desktop: multi-agent group chats, computer use, browser, MCP, routines and approvals. macOS, Windows, Linux + Android. Built on pi.

fix(groups): a step continued after the group's pause keeps its workspace and is told files may have changed

leen.zhou4bdabeced5ca
diff --git a/packages/brain/src/kit.ts b/packages/brain/src/kit.ts
index c523723..d6134c9 100644
--- a/packages/brain/src/kit.ts
+++ b/packages/brain/src/kit.ts
@@ -234,6 +234,7 @@ export type {
ChangesScope,
PlanStepWorkspace,
RunChangesPort,
+ StepKeep,
StepMerge,
StepWorkspaceFallback,
TurnFileSource,
diff --git a/packages/brain/src/orchestration-kit.ts b/packages/brain/src/orchestration-kit.ts
index d9617ad..31cbc17 100644
--- a/packages/brain/src/orchestration-kit.ts
+++ b/packages/brain/src/orchestration-kit.ts
@@ -129,5 +129,6 @@ export { restoreWorkflow } from "./runtime/workflows/workflow-recovery.ts";
export type {
GroupWorktreesPort,
PlanStepWorkspace,
+ StepKeep,
StepMerge,
} from "./runtime/workspaces/port.ts";
diff --git a/packages/brain/src/runtime/workspaces/port.ts b/packages/brain/src/runtime/workspaces/port.ts
index 824a34d..da5d216 100644
--- a/packages/brain/src/runtime/workspaces/port.ts
+++ b/packages/brain/src/runtime/workspaces/port.ts
@@ -146,6 +146,14 @@ export type StepMerge =
| { state: "pending" }
| { state: "conflict"; code: string; files: string[] }
| { state: "failed"; code: string };
+/**
+ * Whether a plan step the group's pause stopped can go on in its own workspace (maintainers
+ * 2026-11-21): `none` it had none or never started in it; `lost` it had one that cannot be kept.
+ */
+export type StepKeep =
+ | { state: "none" }
+ | { state: "lost" }
+ | { state: "kept"; worktreeId: string; version: number };
/** Group routing asks only about its current run; it never sees the worktree owner/registry. */
export interface GroupWorktreesPort {
prepare(
@@ -165,6 +173,16 @@ export interface GroupWorktreesPort {
mergeStep(taskId: string, signal: AbortSignal): Promise<StepMerge>;
/** Removes a step's unmerged workspace, keeping its branch (plan ended or step redone). */
discardStep(taskId: string, signal: AbortSignal): Promise<void>;
+ /** Pause-continue: whether the stopped step's workspace, unmerged work intact, can go on. */
+ keepStep(taskId: string, botId: string, signal: AbortSignal): Promise<StepKeep>;
+ /** Moves a kept workspace to the rerun's task, inside the transaction creating that task. */
+ adoptStep(
+ fromTaskId: string,
+ toTaskId: string,
+ kept: Extract<StepKeep, { state: "kept" }>,
+ ): boolean;
+ /** After adoptStep committed: the workspace's output record follows it (never throws). */
+ adoptedStep(fromTaskId: string, toTaskId: string): Promise<void>;
/** Removes the plan's managed folder repository once no step workspace needs it. */
endPlan(primaryPath: string, planKey: string): Promise<void>;
/** Workspaces not yet merged or removed (bounded), for the cleanup sweep. */
diff --git a/packages/orchestration/src/conversations/groups/group-workflow-brief.ts b/packages/orchestration/src/conversations/groups/group-workflow-brief.ts
index 87119ac..d65c0f4 100644
--- a/packages/orchestration/src/conversations/groups/group-workflow-brief.ts
+++ b/packages/orchestration/src/conversations/groups/group-workflow-brief.ts
@@ -2,6 +2,7 @@ import { deliveryCorrectionText } from "@pibot/brain/orchestration-kit";
import type { GroupExecutionPlan, HandoffSpec, WorkflowStep } from "@pibot/protocol-base";
import type { HandoffRecord } from "@pibot/storage";
import { handoffBrief } from "./group-handoff-text.ts";
+import { groupWorkflowBriefPrompts } from "./prompts/group-workflow-brief.ts";
export function stepHandoff(step: WorkflowStep, workflowRunId: string): HandoffSpec {
return {
@@ -30,6 +31,11 @@ export function stepInstructions(
review?: string,
/** Maintainers 2026-11-14: the member writes in its own workspace; paths are relative to it. */
ownWorkspace = false,
+ /**
+ * Maintainers 2026-11-21: the rerun of a step the group's pause stopped. Fixed lines at the end,
+ * so every other brief keeps its text; `lost` when its unmerged workspace could not be kept.
+ */
+ continued?: { lost: boolean },
): string | undefined {
const failed = previous?.result?.items.filter((item) => item.status === "fail") ?? [];
const text = redact(
@@ -48,6 +54,8 @@ export function stepInstructions(
? "报告必须有独立结论行「结论:通过」或「结论:不通过」(Verdict: PASS / Verdict: FAIL);不通过项逐条列在结论之后。请如实报告,不要为通过交付检查而改结论。 / Include a standalone Verdict: PASS or Verdict: FAIL line and list failures below it. Report actual findings; never change a verdict just to satisfy delivery checks."
: "",
review ?? "",
+ continued ? groupWorkflowBriefPrompts.resumed : "",
+ continued?.lost ? groupWorkflowBriefPrompts.resumedLost : "",
]
.filter(Boolean)
.join("\n\n"),
diff --git a/packages/orchestration/src/conversations/groups/group-workflow-dispatch.ts b/packages/orchestration/src/conversations/groups/group-workflow-dispatch.ts
index 7aa04e6..17247ce 100644
--- a/packages/orchestration/src/conversations/groups/group-workflow-dispatch.ts
+++ b/packages/orchestration/src/conversations/groups/group-workflow-dispatch.ts
@@ -268,9 +268,24 @@ export class GroupWorkflowDispatcher {
const previousTaskId = state.executionRunId
? service.runs.get(state.executionRunId)?.taskId
: undefined;
- // A redone step starts from the latest merged base; its earlier workspace is never merged.
+ const ownFolder = workspaceSteps(record, workflow, states).has(definition.id)
+ ? workspaceFolder(workflow, definition)
+ : undefined;
+ // Maintainers 2026-11-21: the rerun of a step the group's pause stopped (not a user's retry,
+ // which is a new attempt) is told files may have changed and goes on in the workspace it had.
+ const marker = ledger.resumed?.[definition.id];
+ const continued =
+ !!marker && marker.runId === state.executionRunId && marker.attempt === state.attempt;
+ const keep =
+ continued && previousTaskId
+ ? await service.memberWorktrees.keepStep(previousTaskId, bot.id, signal)
+ : undefined;
+ const kept = keep?.state === "kept" && ownFolder ? keep : undefined;
+ const lost = keep?.state === "lost" || (keep?.state === "kept" && !ownFolder);
+ // A redone step starts from the latest merged base; its earlier workspace is never merged
+ // (a kept one is the new task's from the transaction below).
if (previousTaskId) {
- void this.discard(previousTaskId);
+ if (!kept) void this.discard(previousTaskId);
// Maintainers 2026-11-20: the replaced task must not stay 待接续 beside the new one
// after a continue or retry. Only an open task with nothing running is closed.
const previous = service.tasks.get(previousTaskId);
@@ -280,9 +295,6 @@ export class GroupWorkflowDispatcher {
service.taskChanged(closed);
}
}
- const ownFolder = workspaceSteps(record, workflow, states).has(definition.id)
- ? workspaceFolder(workflow, definition)
- : undefined;
let review = isSupplement
? state.ownerBotId === record.coordinatorBotId && state.ownerBotId === group.coordinatorBotId
? ledger.review
@@ -300,6 +312,7 @@ export class GroupWorkflowDispatcher {
(value) => service.deps.redactor.redact(value),
text,
!!ownFolder,
+ continued ? { lost } : undefined,
);
const reviewText =
review && reviewPrompt(service, review, workflow.contract.steps ?? [], states);
@@ -330,6 +343,15 @@ export class GroupWorkflowDispatcher {
const latest = repo.steps(record.id).find((item) => item.stepId === state.stepId);
if (latest?.status !== "ready" || service.pausedFor(record.groupId)) return undefined;
if (review && isSummary) this.engine.progress.save(active, { ...progressOf(active), review });
+ if (marker) {
+ // Whatever run this dispatch starts consumes the continue; a later one starts fresh.
+ const current = progressOf(repo.get(record.id) ?? active);
+ const { [definition.id]: _consumed, ...rest } = current.resumed ?? {};
+ this.engine.progress.save(active, {
+ ...current,
+ resumed: Object.keys(rest).length ? rest : undefined,
+ });
+ }
const created = service.tasks.create({
groupId: group.id,
assigneeBotId: bot.id,
@@ -341,6 +363,14 @@ export class GroupWorkflowDispatcher {
});
service.cycles.bind(created.id, record.cycleId, record.sourceMessageId, record.id);
const bound = service.tasks.bindUserSource(created.id, record.sourceMessageId);
+ // The kept workspace belongs to the new task from here; if it changed since the check,
+ // nothing is created and the dispatch retries (its check then starts the step fresh).
+ if (
+ kept &&
+ previousTaskId &&
+ !service.memberWorktrees.adoptStep(previousTaskId, created.id, kept)
+ )
+ throw new RpcError(RpcErrorCodes.busy, "group_workspace_changed");
service.handoffs.repo.create({
taskId: created.id,
spec,
@@ -414,6 +444,19 @@ export class GroupWorkflowDispatcher {
if (!task) return;
service.deps.chat.queue.publish(task.queued, task.input);
service.taskChanged(task.task);
+ if (continued)
+ service.deps.logger.info(
+ JSON.stringify({
+ module: "group-workflow",
+ event: "step_continued",
+ workflowRunId: record.id,
+ stepId: definition.id,
+ workspace: kept ? "kept" : lost ? "lost" : "none",
+ }),
+ );
+ // Only needed by the step's merge, long after its run started.
+ if (kept && previousTaskId)
+ await service.memberWorktrees.adoptedStep(previousTaskId, task.task.id);
}
private async discard(taskId: string) {
diff --git a/packages/orchestration/src/conversations/groups/group-workflow-pause.ts b/packages/orchestration/src/conversations/groups/group-workflow-pause.ts
index b2fd5df..7dc1f55 100644
--- a/packages/orchestration/src/conversations/groups/group-workflow-pause.ts
+++ b/packages/orchestration/src/conversations/groups/group-workflow-pause.ts
@@ -33,7 +33,8 @@ export class GroupWorkflowPause {
)
return false;
// The stopped run stays the step's execution, so the rerun gets its hand-back as context
- // and a fresh trigger key (dispatch); the task is replaced like a retry's.
+ // and a fresh trigger key (dispatch); the task is replaced like a retry's, but its own
+ // workspace, if it had one, moves to the new task on continue (resume, dispatch).
repo.updateStep(record.id, step.stepId, { status: "ready", taskId: null });
const ledger = progressOf(latestRun);
progress.save(latestRun, { ...ledger, paused: { ...ledger.paused, [step.stepId]: true } });
@@ -131,18 +132,30 @@ export class GroupWorkflowPause {
const ledger = progressOf(latest);
const ids = Object.keys(ledger.paused ?? {});
if (!ids.length) return [];
- progress.save(latest, { ...ledger, paused: undefined });
- // Messages sent while paused may have started a new cycle; the plan follows it, as a retry.
- const cycleId = service.cycles.get(groupId).cycleId ?? service.cycles.reset(groupId);
- if (latest.cycleId !== cycleId) repo.rebindCycle(latest.id, cycleId);
- const titles = new Map(workflowOf(latest).contract.steps?.map((s) => [s.id, s.title]));
- const ready = new Set(
+ const ready = new Map(
repo
.steps(latest.id)
.filter((state) => state.status === "ready")
- .map((s) => s.stepId),
+ .map((s) => [s.stepId, s]),
);
const picked = ids.filter((id) => ready.has(id));
+ // The rerun of each is told files may have changed and keeps the workspace it had
+ // (dispatch); the marker names the stopped run, so only that rerun reads it.
+ const resumed = { ...ledger.resumed };
+ for (const stepId of picked) {
+ const state = ready.get(stepId);
+ if (state?.executionRunId)
+ resumed[stepId] = { runId: state.executionRunId, attempt: state.attempt };
+ }
+ progress.save(latest, {
+ ...ledger,
+ paused: undefined,
+ ...(Object.keys(resumed).length ? { resumed } : {}),
+ });
+ // Messages sent while paused may have started a new cycle; the plan follows it, as a retry.
+ const cycleId = service.cycles.get(groupId).cycleId ?? service.cycles.reset(groupId);
+ if (latest.cycleId !== cycleId) repo.rebindCycle(latest.id, cycleId);
+ const titles = new Map(workflowOf(latest).contract.steps?.map((s) => [s.id, s.title]));
for (const stepId of picked)
this.engine.audit(
latest,
diff --git a/packages/orchestration/src/conversations/groups/group-workflow-progress.ts b/packages/orchestration/src/conversations/groups/group-workflow-progress.ts
index 982012e..279fb47 100644
--- a/packages/orchestration/src/conversations/groups/group-workflow-progress.ts
+++ b/packages/orchestration/src/conversations/groups/group-workflow-progress.ts
@@ -84,6 +84,18 @@ const Progress = z.strictObject({
.record(z.string(), z.literal(true))
.refine((items) => Object.keys(items).length <= 20)
.optional(),
+ /**
+ * Maintainers 2026-11-21: steps the group's continue released, with the stopped run and attempt.
+ * Their rerun is told files may have changed and goes on in the workspace it had; a user's
+ * retry (a new attempt) or any later run starts fresh as before.
+ */
+ resumed: z
+ .record(
+ z.string(),
+ z.strictObject({ runId: z.string().max(64), attempt: z.number().int().nonnegative() }),
+ )
+ .refine((items) => Object.keys(items).length <= 20)
+ .optional(),
/**
* Steps the program already ran once more after the member's run stopped in a repeated-action
* loop. A second loop goes to the user as before.
diff --git a/packages/orchestration/src/conversations/groups/prompts/group-workflow-brief.md b/packages/orchestration/src/conversations/groups/prompts/group-workflow-brief.md
new file mode 100644
index 0000000..7cc437c
--- /dev/null
+++ b/packages/orchestration/src/conversations/groups/prompts/group-workflow-brief.md
@@ -0,0 +1,11 @@
+# group-workflow-brief
+
+Prompt text used by `group-workflow-brief.ts` (a plan step's brief). Each `## \`key\`` block is sent to the model exactly as written (blank lines around a block are ignored); `{{name}}` is filled in by the code. After editing, run `pnpm gen:prompts`. Changing a block changes the cached prompt prefix (see docs/prompt-cache.md). These lines are appended at the end of a brief, and only to the rerun of a step the group's pause stopped, so other briefs keep their text.
+
+## `resumed`
+
+这一步因群组暂停被中断,现在继续:暂停期间文件可能有变化(包括用户的修改),继续前先重新读取你要依赖的文件和当前进度,已经完成的部分不要重做。 / This step was interrupted by the group pause and is continuing now: files may have changed during the pause (including by the user). Re-read the files and progress you rely on before editing, and don't redo parts that are already done.
+
+## `resumedLost`
+
+这一步之前在自己工作区里还没合并的改动没能保留,这次从当前的群文件夹开始。 / The unmerged changes this step had made in its own workspace could not be kept; this run starts from the current group folder.
diff --git a/packages/orchestration/src/conversations/groups/prompts/group-workflow-brief.ts b/packages/orchestration/src/conversations/groups/prompts/group-workflow-brief.ts
new file mode 100644
index 0000000..8f23bc9
--- /dev/null
+++ b/packages/orchestration/src/conversations/groups/prompts/group-workflow-brief.ts
@@ -0,0 +1,7 @@
+// Generated from group-workflow-brief.md by tools/dev/prompts-gen.ts. Edit the md file, then run `pnpm gen:prompts`.
+export const groupWorkflowBriefPrompts = {
+ resumed:
+ "这一步因群组暂停被中断,现在继续:暂停期间文件可能有变化(包括用户的修改),继续前先重新读取你要依赖的文件和当前进度,已经完成的部分不要重做。 / This step was interrupted by the group pause and is continuing now: files may have changed during the pause (including by the user). Re-read the files and progress you rely on before editing, and don't redo parts that are already done.",
+ resumedLost:
+ "这一步之前在自己工作区里还没合并的改动没能保留,这次从当前的群文件夹开始。 / The unmerged changes this step had made in its own workspace could not be kept; this run starts from the current group folder.",
+} as const;
diff --git a/packages/storage/src/groups/group-member-workspaces.ts b/packages/storage/src/groups/group-member-workspaces.ts
index d114abe..1cf71d3 100644
--- a/packages/storage/src/groups/group-member-workspaces.ts
+++ b/packages/storage/src/groups/group-member-workspaces.ts
@@ -90,6 +90,20 @@ export class GroupMemberWorkspacesRepo {
);
return row;
}
+ /**
+ * Maintainers 2026-11-21: a plan step the group's pause stopped continues in the workspace it had,
+ * but its rerun is a new task, so the row moves to that task. False when the row no longer holds
+ * this tree in use (the caller then starts the rerun fresh).
+ */
+ rekey(fromTaskId: string, toTaskId: string, worktreeId: string) {
+ return (
+ this.db
+ .prepare(
+ "UPDATE group_member_workspaces SET task_id=?,updated_at=? WHERE task_id=? AND worktree_id=? AND state='working'",
+ )
+ .run(toTaskId, new Date().toISOString(), fromTaskId, worktreeId).changes === 1
+ );
+ }
interrupted() {
// A fully returned task can be reviewed after restart, never silently merged.
this.db
diff --git a/packages/workspaces/src/brain/groups/group-member-worktrees.ts b/packages/workspaces/src/brain/groups/group-member-worktrees.ts
index a824adb..24b802f 100644
--- a/packages/workspaces/src/brain/groups/group-member-worktrees.ts
+++ b/packages/workspaces/src/brain/groups/group-member-worktrees.ts
@@ -1,6 +1,7 @@
import type {
WorkspaceGroups as GroupService,
PlanStepWorkspace,
+ StepKeep,
StepWorkspaceFallback,
ToolRunContext,
} from "@pibot/brain/kit";
@@ -33,6 +34,7 @@ import {
managedPlanKeys,
stepWorkspaceRoot,
} from "./group-step-cleanup.ts";
+import { adoptedStepWorkspace, adoptStepWorkspace, keepStepWorkspace } from "./group-step-keep.ts";
import { mergeStep } from "./group-step-merge.ts";
import { isPlanStepWorkspace } from "./group-step-output.ts";
import { prepareFailureCode, prepareStepWorktree, SETUP_FAILED } from "./group-step-prepare.ts";
@@ -538,6 +540,15 @@ export class GroupMemberWorktrees {
discardStep(taskId: string, signal: AbortSignal) {
return discardStepWorkspace(this, taskId, this.signal(signal));
}
+ keepStep(taskId: string, botId: string, signal: AbortSignal) {
+ return keepStepWorkspace(this, taskId, botId, this.signal(signal));
+ }
+ adoptStep(fromTaskId: string, toTaskId: string, kept: Extract<StepKeep, { state: "kept" }>) {
+ return adoptStepWorkspace(this, fromTaskId, toTaskId, kept);
+ }
+ adoptedStep(fromTaskId: string, toTaskId: string) {
+ return adoptedStepWorkspace(this, fromTaskId, toTaskId);
+ }
endPlan(primaryPath: string, planKey: string) {
return endPlanWorkspaces(this, primaryPath, planKey);
}
diff --git a/packages/workspaces/src/brain/groups/group-step-keep.ts b/packages/workspaces/src/brain/groups/group-step-keep.ts
new file mode 100644
index 0000000..f86e299
--- /dev/null
+++ b/packages/workspaces/src/brain/groups/group-step-keep.ts
@@ -0,0 +1,91 @@
+import type { StepKeep } from "@pibot/brain/kit";
+import { RpcError } from "@pibot/workspaces-contract/full";
+import { groupWorkplace } from "../runtime.ts";
+import type { GroupMemberWorktrees } from "./group-member-worktrees.ts";
+import { stepActor } from "./group-step-merge.ts";
+import { isPlanStepWorkspace, moveStepOutput } from "./group-step-output.ts";
+
+const NONE: StepKeep = { state: "none" };
+const LOST: StepKeep = { state: "lost" };
+
+function log(owner: GroupMemberWorktrees, event: string, fields: Record<string, unknown>) {
+ owner.service.deps.local.deps.logger.warn(JSON.stringify({ module: "group", event, ...fields }));
+}
+
+/**
+ * Maintainers 2026-11-21: a plan step the group's pause stopped goes on in the workspace it had, with
+ * its unmerged changes. The same checks a later run's reattach makes are made here, before the
+ * rerun is created, so a workspace that cannot be continued is discarded as before (and the
+ * brief says so) instead of failing the rerun's prepare.
+ */
+export async function keepStepWorkspace(
+ owner: GroupMemberWorktrees,
+ taskId: string,
+ botId: string,
+ signal: AbortSignal,
+): Promise<StepKeep> {
+ const member = owner.repo.get(taskId);
+ if (!member || member.state === "integrated" || member.state === "removed") return NONE;
+ const tree = owner.registry.get(member.worktreeId);
+ // A tree that never became ready, or a prepare stopped before the seed was written, means the
+ // step never started working there: nothing of it is lost.
+ if (!tree?.identity) return NONE;
+ if (!(await isPlanStepWorkspace(owner.service.deps.local, taskId))) return NONE;
+ if (
+ member.state !== "working" ||
+ tree.state !== "ready" ||
+ member.botId !== botId ||
+ tree.botId !== botId ||
+ !owner.idle(member)
+ )
+ return LOST;
+ try {
+ const context = stepActor(owner, taskId, signal);
+ const group = owner.current(context, member);
+ const baseline = await groupWorkplace(owner.service.deps.local, botId, group, signal);
+ const location =
+ baseline.boundary.location && baseline.boundary.location.target !== "local"
+ ? baseline.boundary.location.target
+ : null;
+ if ((member.executionLocation ?? null) !== location)
+ throw new RpcError(-32602, "group_workspace_changed");
+ await owner.verify(tree, signal, owner.host(baseline.boundary));
+ } catch (error) {
+ if (signal.aborted) throw error;
+ log(owner, "step_workspace_keep_failed", {
+ taskId,
+ code: error instanceof RpcError ? error.message : "internal",
+ });
+ return LOST;
+ }
+ return { state: "kept", worktreeId: tree.id, version: tree.version };
+}
+
+/** Synchronous: runs inside the transaction that creates the rerun's task. */
+export function adoptStepWorkspace(
+ owner: GroupMemberWorktrees,
+ fromTaskId: string,
+ toTaskId: string,
+ kept: Extract<StepKeep, { state: "kept" }>,
+) {
+ const tree = owner.registry.get(kept.worktreeId);
+ if (!tree || tree.version !== kept.version || tree.state !== "ready") return false;
+ return owner.repo.rekey(fromTaskId, toTaskId, kept.worktreeId);
+}
+
+export async function adoptedStepWorkspace(
+ owner: GroupMemberWorktrees,
+ fromTaskId: string,
+ toTaskId: string,
+) {
+ try {
+ await moveStepOutput(owner.service.deps.local, fromTaskId, toTaskId);
+ } catch (error) {
+ // The workspace still holds the work; only its output-folder carry-back is unknown, and the
+ // step's merge then stops with an explicit failure instead of overwriting anything.
+ log(owner, "step_workspace_seed_move_failed", {
+ taskId: toTaskId,
+ code: (error as NodeJS.ErrnoException).code ?? "internal",
+ });
+ }
+}
diff --git a/packages/workspaces/src/brain/groups/group-step-output.ts b/packages/workspaces/src/brain/groups/group-step-output.ts
index 827f2d3..9b35f04 100644
--- a/packages/workspaces/src/brain/groups/group-step-output.ts
+++ b/packages/workspaces/src/brain/groups/group-step-output.ts
@@ -1,5 +1,5 @@
import { createHash } from "node:crypto";
-import { lstat, mkdir, opendir, readFile, rm, writeFile } from "node:fs/promises";
+import { lstat, mkdir, opendir, readFile, rename, rm, writeFile } from "node:fs/promises";
import path from "node:path";
import type { WorkspaceLocal as LocalService } from "@pibot/brain/kit";
import { RpcError, type WorkspaceSnapshot } from "@pibot/workspaces-contract/full";
@@ -205,3 +205,8 @@ export async function writeStepOutput(
export async function forgetStepOutput(local: LocalService, taskId: string) {
await rm(seedFile(local, taskId), { force: true });
}
+
+/** A kept workspace moved to its rerun's task (pause-continue): what it started from moves too. */
+export async function moveStepOutput(local: LocalService, fromTaskId: string, toTaskId: string) {
+ await rename(seedFile(local, fromTaskId), seedFile(local, toTaskId));
+}
diff --git a/packages/workspaces/src/brain/groups/group-step-turns.ts b/packages/workspaces/src/brain/groups/group-step-turns.ts
index 251ea54..9632280 100644
--- a/packages/workspaces/src/brain/groups/group-step-turns.ts
+++ b/packages/workspaces/src/brain/groups/group-step-turns.ts
@@ -15,6 +15,11 @@ interface Hold {
* only stopped the second at its first write (10 min wait), after it had read the folder while
* the first was changing it. The turn is taken when prepare decides to take turns and is given
* back when that run settles, so the order is the order the steps prepared in.
+ *
+ * The group's pause stops every run in a line: a waiter leaves at once (its wait is aborted), the
+ * step working in the folder when its run settles. On continue each stopped step is a new run
+ * that joins the line anew when it prepares (the reruns are dispatched one after another in plan
+ * order); a hold whose old run is still stopping stays ahead of them until that run settles.
*/
export class StepTurns {
private readonly folders = new Map<string, { tail: Promise<void>; reason: string }>();