feat(approvals): make dangerous command approval timeout configurable (#3886)

* feat(approvals): make dangerous command approval timeout configurable

Read `approvals.timeout` from config.yaml (default 60s) instead of
hardcoding 60 seconds in both the fallback CLI prompt and the TUI
prompt_toolkit callback.

Follows the same pattern as `clarify.timeout` which is already
configurable via CLI_CONFIG.

Closes #3765

* fix: add timeout default to approvals section in DEFAULT_CONFIG

---------

Co-authored-by: acsezen <asezen@icloud.com>
This commit is contained in:
Teknium
2026-03-30 00:02:02 -07:00
committed by GitHub
parent c288bbfb57
commit 947faed3bc
3 changed files with 25 additions and 7 deletions

View File

@@ -241,7 +241,8 @@ def approval_callback(cli, command: str, description: str) -> str:
lock = cli._approval_lock
with lock:
timeout = 60
from cli import CLI_CONFIG
timeout = CLI_CONFIG.get("approvals", {}).get("timeout", 60)
response_queue = queue.Queue()
choices = ["once", "session", "always", "deny"]
if len(command) > 70:

View File

@@ -407,6 +407,7 @@ DEFAULT_CONFIG = {
# off — skip all approval prompts (equivalent to --yolo)
"approvals": {
"mode": "manual",
"timeout": 60,
},
# Permanently allowed dangerous command patterns (added via "always" approval)