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(computer-use): a foreground step asks the user instead of skipping silently

leen.zhoud4e5b913daa1
diff --git a/packages/computer-use/src/brain/service/run/computer-runs.ts b/packages/computer-use/src/brain/service/run/computer-runs.ts
index 76c91f9..50e32e7 100644
--- a/packages/computer-use/src/brain/service/run/computer-runs.ts
+++ b/packages/computer-use/src/brain/service/run/computer-runs.ts
@@ -171,12 +171,19 @@ export class ComputerRuns {
const run = this.map.get(context.runId);
const grant = this.valid(run);
const host = this.local.computerHost(context);
- if (!run || !grant || !host || !coversApps(grant, [step.app])) return "skip";
+ // The grant holds resolved app IDs (com.apple.finder) while a tool call may still name the
+ // app as the model wrote it (Finder); matching only IDs skipped every foreground step of
+ // such a call without ever showing the card.
+ const app = grant?.apps.find(
+ (held) => sameAppId(held.id, step.app) || sameAppId(held.name, step.app),
+ );
+ if (!run || !grant || !host || !app) {
+ this.local.deps.logger.warn(
+ `computer foreground skipped run=${context.runId} reason=${!run ? "no_run" : !grant ? "no_grant" : !host ? "no_host" : "app_not_in_grant"}`,
+ );
+ return "skip";
+ }
const action = clean(step.description, 200, "foreground step");
- const app = grant.apps.find((held) => sameAppId(held.id, step.app)) ?? {
- id: step.app,
- name: step.app,
- };
await this.whilePaused(run, signal);
const held = this.lock.holds(run.runId);
const request: ComputerForeground = {