feat(approval): generic config-driven tool-call approval gate - #662
Open
hashbender wants to merge 1 commit into
Open
feat(approval): generic config-driven tool-call approval gate#662hashbender wants to merge 1 commit into
hashbender wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a human-in-the-loop approval gate for designated tool calls. Default OFF — with no config the behaviour is unchanged everywhere.
Why
Some deployments need certain tools (e.g.
send_email,delete_*, API write-back tools) to require human sign-off before executing, without blocking every call and without a custom wrapper per tool. The existing dangerous-command engine has all the right primitives (inline ask, session/permanent allowlist, Kanban staging); this wires those to named or glob-matched tool names.Two approval modes
force_deferredpending/actions/<id>.json, opens a Kanban approval card, returns a non-error"staged"result so the agent continuesExecution-on-approval is Hermes-native: approving the card mints an agent-assigned execution card; the dispatcher wakes a worker, which replays the staged call with a one-shot per-pending-id token (consumed on first match so it passes through exactly once; TTL + status state machine guard against double-execution).
Decision ladder in
check_tool_approvalapprovals.mode == off→ allow.pending_id→ allow + consume.Config example
Files
tools/tool_gate.pysummarize_tool_call,approve_action,replay_pending_action, Kanban card helpers. Optional Mattermost notification is no-op unless credentials are set.tools/approval.pycheck_tool_approval+ helpers beforecheck_execute_code_guard.tools/write_approval.pyACTIONSsubsystem +update_pending()atomic helper.agent/tool_executor.pyagent/agent_runtime_helpers.pyinvoke_tool).gateway/run.pykind == "tool"prompts.tests/tools/test_tool_gate.pytests/run_agent/test_tool_gate_dispatch.pyTest plan
tests/tools/test_tool_gate.py— 27 unit tests passtests/run_agent/test_tool_gate_dispatch.py— 3 integration tests pass (sequential + concurrent)upstream/main(not the fork's feature branches)🤖 Generated with Claude Code
Mirror-of: NousResearch#56811
NousResearch#56811