## 问题描述 Agent 工具派发的子代理(subagent)内部的工具调用(Bash/Read 等)不触发 PermissionRequest 层 hooks,也不触发 PreToolUse 层 hooks——两层治理(权限自动审批/命令形态闸)对子代理全部失效,权限请求直达用户弹窗。 ## 复现步骤 1. 注册一个 PermissionRequest 或 PreToolUse hook(如向日志追加一行记录载荷); 2. 主会话调用任意 Bash 命令 → hook 正常触发; 3. 通过 Agent 工具派发一个会执行 Bash 命令的子代理 → hook 零触发(同形态命令)。 ## 实测证据 - PermissionRequest 层:主会话 104 次触发 vs 子代理 0 次(探针台账); - PreToolUse 层:入口探针法,子代理执行 Bash 命令窗口(7.3 秒·1 次调用)探针零记录,主会话同命令即时记录; - 另注意到两层载荷结构不一致:PreToolUse 载荷约 20 个字段(含 session_id/transcript_path/permission_mode/toolCallId),PermissionRequest 载荷仅 hookEventName/toolName/toolInput 三字段——后者无会话上下文可供 hook 判定。 ## 期望行为 子代理工具调用纳入两层 hook 派发(或提供 subagent 专属事件),并统一两层载荷的会话上下文字段。 ## 环境 ZCode 3.11.2 · Windows 10 26100 · GLM-5.3
Activity
github-actions commentedon Sep 11, 2026
👋 感谢你的反馈,我们已经收到。
status: 待评估,你可以随时补充信息。needs: 更多信息标签并 @ 你。👋 Thanks — we've received your issue.
status: 待评估(Triage); feel free to add context.needs: 更多信息and ping you.panda920 commentedon Oct 11, 2026
感谢反馈!这条与 #361 说的是同一件事,我们合并到 #361 统一跟进,后续进展会在那边同步。
本 issue 先关闭,欢迎到 #361 补充信息或点 👍。
Thanks for the report! This is the same as #361, so we're tracking it there and will post updates in that thread.
Closing this one as a duplicate — feel free to add details or a 👍 on #361.