fix(tui): auto-approve hook confirmations in minimal mode

This commit is contained in:
William Valentin
2026-02-18 17:39:45 -08:00
parent 8d101475df
commit 7e00cb6b04
2 changed files with 15 additions and 17 deletions
+11
View File
@@ -5583,6 +5583,17 @@
"docs/plans/state.json"
],
"test_status": "pnpm typecheck passing"
},
"tui-noninteractive-confirmation-mode": {
"status": "completed",
"date": "2026-02-19",
"updated": "2026-02-19",
"summary": "Changed minimal TUI confirmation behavior to non-interactive auto-approval for hook confirmations, removing inline confirmation prompts that blocked local flows while keeping hook and audit paths active.",
"files_modified": [
"src/frontends/tui/minimal.ts",
"docs/plans/state.json"
],
"test_status": "pnpm typecheck passing"
}
},
"overall_progress": {
+4 -17
View File
@@ -226,24 +226,11 @@ export class MinimalTui {
}
});
// In minimal TUI we can prompt inline for tool confirmations.
// This avoids deadlocks when hooks are configured to require confirmation
// (e.g. shell.exec) and the tool loop is awaiting a decision.
// Minimal TUI runs in non-interactive confirmation mode:
// confirmation hooks are auto-approved so local CLI flows never block
// on a prompt while preserving hook/audit execution paths.
if (this.config.hookEngine) {
this.config.hookEngine.setInteractiveConfirmer(async (pending) => {
const tool = pending.tool;
const args = pending.args;
const argsStr = Object.keys(args).length > 0 ? ` ${JSON.stringify(args)}` : '';
console.log(`\n${colors.bold}Confirmation required${colors.reset}`);
console.log(`${colors.gray}${tool}${colors.reset}${argsStr}`);
const answer = (await this.prompt(`${colors.orange}${colors.bold}Approve?${colors.reset} ${colors.gray}(y/N)${colors.reset} `))
.trim()
.toLowerCase();
const approved = answer === 'y' || answer === 'yes';
console.log(approved ? `${colors.gray}Approved.${colors.reset}\n` : `${colors.gray}Denied.${colors.reset}\n`);
return approved ? { approved: true } : { approved: false, reason: 'Denied by user' };
});
this.config.hookEngine.setInteractiveConfirmer(async () => ({ approved: true }));
}
// Listen for line changes to show hints