kshitijk4poor
f512d6f020
feat(plugins): pre_tool_call approve action escalates to human gate
...
Extend the pre_tool_call plugin hook return contract with a new directive:
{"action": "approve", "message": "why this needs human confirmation"}
Previously a pre_tool_call hook could only veto a tool call (action: block)
or allow it silently. It could not escalate to the existing human-approval
flow. This unlocks user-defined runtime approval rules on ANY tool (HTTP
writes, file writes to sensitive paths, email sends), enforced at runtime —
resolving #51221 as a pure plugin, with no core approval.py rule schema.
Mechanism:
- get_pre_tool_call_directive() returns (action, message) for block|approve;
get_pre_tool_call_block_message() kept as a block-only back-compat shim.
- resolve_pre_tool_block() is the single dispatch-site chokepoint: fetches
the directive and, for approve, invokes the human gate; fail-closed to a
block on denial, timeout, or gate exception. ALL FOUR tool-dispatch sites
now call it: tool_executor (concurrent + sequential), agent_runtime_helpers,
and model_tools.handle_function_call.
- request_tool_approval() escalates via the SAME machinery as Tier-2
dangerous commands: session/permanent allowlist, prompt_dangerous_approval
(CLI) / submit_pending (gateway), [o]nce/[s]ession/[a]lways/[d]eny,
timeout fail-closed, approvals.cron_mode for cron contexts.
Architecture: extracted the shared decision core into _run_approval_gate(),
called by BOTH check_dangerous_command() and request_tool_approval() so the
fail-closed / cron / gateway / yolo / persist policy lives in ONE place and
cannot drift. Fixed a latent divergence — the plugin path now honors --yolo.
Approval grain: [a]lways is keyed on tool_name + a hash of the reason (an
explicit plugin rule_key overrides), so distinct reasons on the same tool
persist independently instead of one 'always' blanketing the whole tool.
Non-interactive: cron honors approvals.cron_mode (parity with commands); any
other non-interactive non-gateway context fails CLOSED for the plugin path
(the command path keeps its historical fail-open default, unchanged).
No new config schema, no new env vars, no new hook events.
2026-07-05 12:48:11 +05:30
..
2026-05-22 03:33:01 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-06-21 13:33:48 -07:00
2026-05-28 22:26:25 -07:00
2026-07-01 17:17:01 +05:30
2026-07-01 05:35:26 -07:00
2026-06-30 15:51:17 -07:00
2026-06-11 10:49:47 -07:00
2026-06-29 01:26:24 -07:00
2026-06-29 01:26:24 -07:00
2026-06-29 01:26:24 -07:00
2026-07-03 03:27:47 -07:00
2026-05-28 22:26:25 -07:00
2026-06-29 01:26:24 -07:00
2026-06-25 22:02:22 -07:00
2026-07-01 05:09:35 -07:00
2026-07-03 03:27:47 -07:00
2026-06-28 12:25:15 -05:00
2026-06-28 13:49:08 -07:00
2026-05-28 22:26:25 -07:00
2026-05-09 13:35:39 -07:00
2026-06-29 02:24:57 -07:00
2026-07-01 05:23:17 -07:00
2026-07-01 05:04:41 -07:00
2026-05-28 22:26:25 -07:00
2026-07-02 13:10:30 +05:30
2026-05-30 07:31:25 -07:00
2026-06-28 14:25:10 -07:00
2026-06-27 15:59:00 -07:00
2026-06-28 13:49:08 -07:00
2026-07-01 05:04:41 -07:00
2026-06-28 12:14:21 -05:00
2026-06-21 15:23:47 -07:00
2026-07-01 20:01:55 +03:00
2026-07-01 05:04:41 -07:00
2026-06-28 02:42:01 -07:00
2026-06-21 07:26:18 -07:00
2026-05-28 22:26:25 -07:00
2026-06-25 22:02:22 -07:00
2026-06-21 17:46:38 +05:30
2026-05-28 22:26:25 -07:00
2026-06-28 04:13:19 -07:00
2026-06-19 06:31:08 -07:00
2026-05-28 22:26:25 -07:00
2026-05-17 02:29:41 -07:00
2026-05-29 03:44:49 -07:00
2026-07-01 04:08:37 -07:00
2026-06-18 12:48:36 +10:00
2026-06-22 06:42:30 -07:00
2026-07-04 02:37:33 -07:00
2026-06-07 02:09:20 -07:00
2026-06-22 18:48:07 -05:00
2026-05-28 22:26:25 -07:00
2026-06-29 15:32:20 +10:00
2026-06-27 04:57:15 +05:30
2026-06-30 17:29:03 -07:00
2026-07-01 00:13:36 -07:00
2026-06-26 01:11:11 -07:00
2026-06-21 13:28:04 +05:30
2026-07-01 14:23:01 +05:30
2026-05-28 22:26:25 -07:00
2026-07-02 04:20:43 -07:00
2026-06-28 14:33:03 -07:00
2026-05-28 22:26:25 -07:00
2026-06-16 14:30:11 -04:00
2026-06-30 03:07:40 -07:00
2026-06-30 03:16:22 -07:00
2026-07-03 03:27:47 -07:00
2026-05-28 22:26:25 -07:00
2026-06-29 11:01:08 +10:00
2026-06-24 15:23:23 +10:00
2026-07-04 13:38:59 -07:00
2026-05-29 11:49:54 +10:00
2026-06-26 19:15:18 -07:00
2026-06-18 09:09:21 +10:00
2026-06-10 19:23:06 +10:00
2026-07-01 14:37:22 +05:30
2026-05-28 22:26:09 -07:00
2026-06-04 19:40:30 -07:00
2026-05-30 07:01:22 -07:00
2026-06-17 13:45:25 -07:00
2026-05-28 22:26:25 -07:00
2026-07-01 02:44:53 -07:00
2026-05-28 22:26:25 -07:00
2026-07-01 01:00:31 -07:00
2026-06-15 14:00:42 +05:30
2026-07-03 14:18:20 +10:00
2026-05-28 22:26:25 -07:00
2026-06-23 03:17:47 +05:30
2026-06-30 02:50:24 -07:00
2026-06-27 04:01:12 +05:30
2026-06-26 20:45:32 +05:30
2026-07-01 17:48:32 +05:30
2026-06-01 16:55:04 -07:00
2026-06-30 17:32:28 -07:00
2026-07-01 03:03:05 -07:00
2026-05-28 22:26:25 -07:00
2026-07-01 14:37:22 +05:30
2026-05-28 22:26:25 -07:00
2026-05-21 16:40:04 +05:30
2026-06-18 22:13:07 -07:00
2026-05-15 01:33:13 -07:00
2026-06-19 16:59:54 -07:00
2026-06-25 12:38:33 -07:00
2026-07-04 15:30:50 -07:00
2026-05-30 07:28:11 -07:00
2026-06-21 12:02:30 -07:00
2026-06-30 14:29:42 -07:00
2026-06-25 09:20:13 +10:00
2026-07-04 13:40:59 -07:00
2026-05-28 22:26:25 -07:00
2026-06-25 13:52:06 -07:00
2026-05-28 22:26:25 -07:00
2026-07-02 02:13:30 -07:00
2026-07-01 15:42:19 +05:30
2026-07-02 11:48:03 -07:00
2026-06-30 04:23:27 -05:00
2026-06-11 19:50:08 -05:00
2026-06-07 03:57:21 -07:00
2026-07-03 05:30:16 -05:00
2026-05-28 22:26:25 -07:00
2026-05-30 07:58:08 -07:00
2026-05-28 22:26:25 -07:00
2026-06-21 16:02:56 +05:30
2026-06-27 04:39:54 -07:00
2026-05-28 22:26:25 -07:00
2026-06-19 11:46:25 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-05-16 13:06:56 -07:00
2026-06-11 04:37:01 -07:00
2026-06-15 04:22:07 -07:00
2026-06-30 16:56:15 -07:00
2026-07-04 14:10:33 +05:30
2026-06-28 04:47:39 -07:00
2026-06-14 02:09:45 -07:00
2026-06-24 00:52:18 +05:30
2026-05-15 14:00:01 -07:00
2026-06-25 23:30:41 +05:30
2026-05-28 22:26:25 -07:00
2026-07-01 04:54:46 -07:00
2026-05-28 22:26:25 -07:00
2026-06-18 10:19:33 -07:00
2026-06-30 20:01:16 +05:30
2026-05-28 22:26:25 -07:00
2026-06-29 11:35:41 +10:00
2026-06-21 11:11:23 -07:00
2026-06-06 18:30:39 -07:00
2026-05-25 15:18:45 -07:00
2026-05-20 01:46:40 -05:00
2026-05-25 06:13:36 -07:00
2026-06-30 04:23:27 -05:00
2026-06-13 14:42:51 -07:00
2026-06-17 13:45:25 -07:00
2026-06-19 11:57:43 -07:00
2026-07-01 15:37:58 +05:30
2026-07-05 12:48:11 +05:30
2026-05-28 22:26:25 -07:00
2026-06-12 00:30:51 -05:00
2026-06-13 14:35:21 -07:00
2026-06-20 23:23:47 -07:00
2026-05-28 22:26:25 -07:00
2026-06-20 10:26:45 -07:00
2026-06-12 01:07:38 -07:00
2026-06-15 05:51:47 -07:00
2026-05-18 22:19:50 -07:00
2026-07-01 00:12:11 -07:00
2026-06-27 04:41:22 -07:00
2026-06-07 23:04:54 -07:00
2026-07-01 01:39:10 -07:00
2026-06-20 10:26:45 -07:00
2026-05-17 02:29:41 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-06-30 15:49:36 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-06-25 22:03:02 -07:00
2026-06-06 18:29:52 -07:00
2026-05-28 22:26:25 -07:00
2026-06-01 01:58:48 -07:00
2026-05-19 14:17:38 -07:00
2026-06-11 18:03:11 -04:00
2026-07-01 00:40:56 -07:00
2026-06-18 12:26:20 +05:30
2026-06-27 21:07:53 -07:00
2026-06-16 13:08:34 -07:00
2026-06-21 16:39:48 -07:00
2026-06-20 23:23:47 -07:00
2026-06-04 18:06:21 -07:00
2026-06-26 12:09:52 +10:00
2026-06-26 12:09:52 +10:00
2026-06-08 22:46:57 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-06-22 15:41:23 +10:00
2026-05-28 22:26:25 -07:00
2026-06-28 01:15:39 -07:00
2026-05-28 22:26:25 -07:00
2026-06-29 11:35:41 +10:00
2026-06-27 19:29:00 -07:00
2026-07-04 14:17:11 +05:30
2026-07-01 01:05:28 -07:00
2026-06-26 15:26:08 +05:30
2026-06-25 23:42:42 +05:30
2026-06-07 18:06:27 -07:00
2026-05-29 13:35:39 +10:00
2026-05-31 00:50:19 -07:00
2026-06-30 16:39:41 -07:00
2026-06-03 06:36:46 -07:00
2026-05-28 22:26:25 -07:00
2026-05-31 17:46:56 -05:00
2026-05-25 01:41:19 -07:00
2026-05-31 17:46:56 -05:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-05-15 12:11:32 -07:00
2026-06-10 02:57:39 -07:00
2026-05-13 17:32:22 -07:00
2026-06-10 02:57:39 -07:00
2026-05-29 13:24:12 -07:00
2026-05-18 22:29:45 -07:00
2026-05-25 05:15:55 -07:00
2026-06-19 07:04:58 -07:00
2026-05-24 18:04:54 -07:00
2026-07-03 05:30:16 -05:00
2026-06-19 07:26:56 -07:00
2026-07-01 01:18:53 -07:00
2026-05-28 22:26:25 -07:00
2026-06-29 21:11:58 -07:00
2026-06-29 21:11:58 -07:00
2026-06-29 21:11:58 -07:00
2026-07-04 15:30:50 -07:00
2026-07-04 15:30:50 -07:00
2026-05-28 22:26:25 -07:00
2026-05-31 00:11:52 -07:00
2026-05-28 22:26:25 -07:00
2026-06-30 00:19:49 -07:00
2026-06-04 18:04:47 -07:00
2026-06-25 01:45:06 +05:30
2026-06-14 16:47:57 -07:00
2026-05-28 04:52:42 -07:00
2026-06-29 10:00:49 -07:00
2026-07-03 20:14:27 +05:30
2026-06-29 10:00:49 -07:00
2026-06-29 10:00:49 -07:00
2026-07-01 00:49:38 -07:00
2026-06-27 04:40:05 -07:00
2026-06-27 03:08:41 +05:30
2026-06-27 15:59:00 -07:00
2026-06-23 03:10:53 +05:30
2026-06-14 02:07:32 -07:00
2026-05-21 02:38:45 +05:30
2026-06-29 21:11:58 -07:00
2026-05-25 03:35:33 -07:00
2026-06-21 11:35:09 -07:00