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): parallel steps take turns on Windows and Linux, where own workspaces cannot run commands

leen.zhou756cf89e90dc
diff --git a/packages/orchestration/src/conversations/groups/group-plan-merges.ts b/packages/orchestration/src/conversations/groups/group-plan-merges.ts
index 0193257..5276d16 100644
--- a/packages/orchestration/src/conversations/groups/group-plan-merges.ts
+++ b/packages/orchestration/src/conversations/groups/group-plan-merges.ts
@@ -323,6 +323,10 @@ function turnsReason(reason: string, zh: boolean) {
return zh
? "这台电脑没有安装 Git,建不了独立工作区"
: "Git is not installed on this computer, so steps cannot have own workspaces";
+ case "readonly_commands_unsupported":
+ return zh
+ ? "这个系统上独立工作区里还不能运行命令"
+ : "commands cannot run in own workspaces on this system yet";
case "group_workspace_setup_failed":
return zh ? "这次建独立工作区没有成功" : "setting up its own workspace failed this time";
case "group_workspace_cleanup_pending":
diff --git a/packages/workspaces/src/brain/groups/group-step-prepare.ts b/packages/workspaces/src/brain/groups/group-step-prepare.ts
index 138d60e..1de2f34 100644
--- a/packages/workspaces/src/brain/groups/group-step-prepare.ts
+++ b/packages/workspaces/src/brain/groups/group-step-prepare.ts
@@ -100,6 +100,10 @@ export async function prepareStepWorktree(
const sharing = owner.turns.reason(folder);
if (sharing) return turns(sharing);
if (owner.cleanupPending([primary])) return turns(CLEANUP_PENDING);
+ // Retest 2026-11-21: an own workspace keeps the group folder as a read-only reference, and only
+ // the macOS sandbox can run commands beside one (local-run-authorization refuses elsewhere), so
+ // a test step there could never run its test. Taking turns in the folder keeps commands working.
+ if (!remote && local.deps.platform !== "darwin") return turns("readonly_commands_unsupported");
// Without Git nothing below can work. Checked first, so a step never waits for a folder lock
// another step holds only to learn that Git is missing (B2: the 120 s prepare limit).
if (
@@ -126,14 +130,21 @@ export async function prepareStepWorktree(
if (remote) return turns(repository ? "runner_folder_dirty" : "runner_folder_not_git");
const managed = managedFolderRepository(primary, step.planKey);
owner.stage(context.runId, "managed_folder");
- const authority = await groupWorktreeAuthority(
- local,
- context,
- baseline.boundary,
- [managed],
- signal,
- "create",
- );
+ let authority: Awaited<ReturnType<typeof groupWorktreeAuthority>>;
+ try {
+ authority = await groupWorktreeAuthority(
+ local,
+ context,
+ baseline.boundary,
+ [managed],
+ signal,
+ "create",
+ );
+ } catch (error) {
+ // Windows retest 2026-11-21: the policy check's own 10 s limit fired right after a brain
+ // stall and interrupted the step; setupFailed still rethrows stops and the person's answers.
+ return setupFailed(error);
+ }
try {
await owner.exclusive(`folder:${managed}`, context.botId, [managed], signal, async () => {
authority.assertAuthorized();