Repository navigation
Description
Original author: Cedric Vidal (@cedricvidal)
Summary
In integration, runs on the coder-acp-copilot worker fail the build gate because execute (bash) tool calls — e.g. npm run build — are rejected with:
Permission denied and could not request permission from user
The agent never recovers, exhausts all iterations, the build gate FAILS, and downstream gates (test) are skipped.
Observed behavior (from integration logs)
Session config options: mode (mode), model (model), allow_all (permissions)
bypassPermissions mode not available (available: .../session-modes#agent, .../session-modes#plan, .../session-modes#autopilot)
...
Criteria DAG: 0 passed, 1 failed — builds_successfully
feedback: "running `npm run build` ... returned `Permission denied and could not request permission from user`"
...
Max iterations (10) reached without passing
=== Gate 'build' FAILED — stopping pipeline === downstreamSkipped=["test"]
Gate 'test' skipped (a previous gate failed)
The select gate (which only needs file edits) passes, but every gate that needs to execute a command (build, then test) is blocked.
Root cause
The Copilot CLI advertises a new set of session modes (agent, plan, autopilot) and no longer exposes bypassPermissions. Our worker still keys off the old mode name:
apps/workers/coder-acp-copilot/src/acp-client.ts:361-373
const availableModes = sessionResult.modes?.availableModes?.map((m) => m.id) ?? [];
if (availableModes.includes("bypassPermissions")) {
await connection.setSessionMode({ sessionId: sessionResult.sessionId, modeId: "bypassPermissions" });
onLog(`Set session mode to bypassPermissions`);
} else {
onLog(`bypassPermissions mode not available (available: ${availableModes.join(", ")})`);
}Because bypassPermissions is not in the list, no mode is set and the session stays in the default agent mode. In agent mode, execute tool calls are denied non-interactively ("could not request permission from user") — the worker's requestPermission auto-approve handler is never even consulted for these commands. The --yolo flag passed in apps/workers/coder-acp-copilot/src/index.ts:156 is no longer sufficient on its own.
Proposed fix
Update the mode selection to use the new autopilot mode (the replacement for bypassPermissions/yolo), while keeping bypassPermissions as a fallback for older CLI versions. Something like:
const preferred = ["bypassPermissions", "autopilot"];
const target = preferred.find((m) => availableModes.includes(m));
if (target) {
await connection.setSessionMode({ sessionId: sessionResult.sessionId, modeId: target });
onLog(`Set session mode to ${target}`);
} else {
onLog(`No bypass/autopilot mode available (available: ${availableModes.join(", ")})`);
}This should be verified against the Copilot CLI version currently deployed to integration.
Impact
- All
coder-acp-copilotruns that require executing build/test commands fail in integration. - Criteria like
builds_successfullyand any test-execution criteria cannot pass.
References
apps/workers/coder-acp-copilot/src/acp-client.ts:361-373(mode selection)apps/workers/coder-acp-copilot/src/index.ts:156(--yoloargs)apps/workers/coder-acp-copilot/src/acp-client.ts:54-76(auto-approverequestPermissionhandler)
Activity