fix: reflect --auto-approve flag in settings override so #wrapToolForAcpPermission sees yolo mode

This commit is contained in:
Theo Mathieu
2026-06-10 08:31:30 +02:00
committed by can1357
parent c110a624c3
commit fbb48faf81
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -988,6 +988,10 @@ export async function runRootCommand(
// Runtime override (not persisted): every settings.get("tools.approvalMode") downstream
// sees this value. The wrapper still honours --auto-approve / --yolo on top of it.
settingsInstance.override("tools.approvalMode", parsedArgs.approvalMode);
} else if (parsedArgs.autoApprove) {
// --auto-approve / --yolo without an explicit --approval-mode: reflect in settings so
// setup-time checks (e.g. #wrapToolForAcpPermission) also see the yolo intent.
settingsInstance.override("tools.approvalMode", "yolo");
}
if (parsedArgs.mode === "rpc" || parsedArgs.mode === "rpc-ui") {
applyRpcDefaultSettingOverrides(settingsInstance);
@@ -3532,6 +3532,8 @@ export class AgentSession {
*
* In `yolo` mode, skips the gate unless the user policy explicitly requires a
* prompt or deny (matching the behaviour of the normal approval wrapper).
* `--auto-approve` / `--yolo` CLI flags also reach here because `main.ts`
* reflects them into a `tools.approvalMode` settings override at startup.
*/
#wrapToolForAcpPermission<T extends AgentTool>(tool: T): T {
const bridge = this.#clientBridge;