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 failed step prepare logs the managed Git code

leen.zhou7f7cd342bfb7
diff --git a/packages/workspaces/src/brain/groups/group-step-prepare.ts b/packages/workspaces/src/brain/groups/group-step-prepare.ts
index 1f3cd65..138d60e 100644
--- a/packages/workspaces/src/brain/groups/group-step-prepare.ts
+++ b/packages/workspaces/src/brain/groups/group-step-prepare.ts
@@ -1,5 +1,11 @@
import type { PlanStepWorkspace, ToolRunContext } from "@pibot/brain/kit";
-import { ExecError, findGit, ManagedFolderError, managedFolderRepository } from "@pibot/execution";
+import {
+ ExecError,
+ findGit,
+ ManagedExecError,
+ ManagedFolderError,
+ managedFolderRepository,
+} from "@pibot/execution";
import { type Group, RpcError } from "@pibot/workspaces-contract/full";
import { isManagedCleanupFailure } from "../managed/managed-failure.ts";
import type { groupWorkplace } from "../runtime.ts";
@@ -35,11 +41,14 @@ const CLEANUP_PENDING = "group_workspace_cleanup_pending";
export function prepareFailureCode(error: unknown) {
return error instanceof RpcError && /^[a-z0-9_.-]{1,80}$/i.test(error.message)
? error.message
- : error instanceof ExecError
- ? `exec_${error.code}${error.reason ? `.${error.reason}` : ""}`
- : error instanceof Error
- ? error.name
- : "unknown";
+ : // Its ExecError code is always invalid_input; the managed code says which check refused.
+ error instanceof ManagedExecError
+ ? `exec_${error.code}.${error.managedCode}`
+ : error instanceof ExecError
+ ? `exec_${error.code}${error.reason ? `.${error.reason}` : ""}`
+ : error instanceof Error
+ ? error.name
+ : "unknown";
}
/**