You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: Extensions hooking tool_execute_before (extensions/python) mutate tool kwargs (e.g., sanitizing or expanding placeholders in tool inputs), but the framework invokes the tool with the ORIGINAL arguments — the mutated kwargs are never re-assigned after the hook completes. This makes argument transformation hooks impossible without core edits.
Reproduction: Register a tool_execute_before extension that changes a tool's args; the executed tool receives the pre-hook values.
Proposed fix: Re-assign the mutated arguments after the tool_execute_before hook chain runs (one line: tool.args = tool_args / equivalent re-read of hook output). We run this as a local patch in production (fork commit d7ed0ef) since 2026-09 with no regressions.
Offer: Happy to open a PR if the direction is accepted.
Activity
fix: v2.13-compatible blocking, path-scoped matching, fail-open evalu…
Li-john1021 commentedon Oct 14, 2026
你好,我想认领这个问题。
已核对:
tool_execute_before在_execute_tool_request/process_tools/execute_tool_call(parallel)三处调用后,未把 hook 可能就地修改过的tool_args再写回tool.args。不少工具(以及 MCP 工具初始args={})会读self.args,因此会出现 hook 已改、执行仍用旧值的分叉。计划按 issue 建议做最小修复:hook 链结束后补上
tool.args = tool_args,并加回归测试覆盖两条主 dispatch 路径。若已有他人在推进,请告诉我,我这边先停下。