Skip to content

feat: make dangerous command approval timeout configurable #3765

@acsezen

Description

@acsezen

Summary

The dangerous command approval prompt (the TUI dialog shown when a potentially dangerous terminal command is detected) has a hardcoded 60-second timeout. When it expires, the command is automatically denied. For users running complex agent workflows — especially with delegation subtasks that trigger approval — 60 seconds is often too short, leading to unnecessary timeouts and denied commands.

Proposal

Read the timeout from config.yaml under approvals.timeout, falling back to 60 seconds when unset:

approvals:
  mode: smart
  timeout: 120   # seconds for dangerous command approval prompt

Affected locations

  1. tools/approval.pyprompt_dangerous_approval() takes timeout_seconds=60 as a default. Should read from config via a helper like _get_approval_timeout().
  2. hermes_cli/callbacks.pyapproval_callback() hardcodes timeout = 60. Should read from CLI_CONFIG.get("approvals", {}).get("timeout", 60).

Why

  • Long-running agent tasks (delegation, MCP tool chains) can trigger multiple approval prompts. If the user is AFK or slow to respond, the 60s timeout kills the entire workflow.
  • The clarify callback already reads its timeout from config (CLI_CONFIG.get("clarify", {}).get("timeout", 120)), so this is consistent with existing patterns.
  • No behavior change for users who don't set the key — default stays at 60s.

Minimal diff

The change is small (~10 lines): add a _get_approval_timeout() helper in approval.py that reads approvals.timeout from config, and replace the hardcoded 60 in both locations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions