Repository navigation
Description
Environment
- ZCode 3.14.3 (build 3.14.3.7762), macOS arm64; bundled CLI reports
zcode 0.16.9. - Project hooks enabled in
.zcode/config.json(hooks.enabled: true), trust granted viahooks trust grant --workspace … --all-current --bundle-digest …(status showsworkspace_hooks_trusted_persistent).
What happens
Trusted project hooks fire for the main session's own tool calls only. They never fire for tool calls made by:
Agent-tool subagents — a dispatched general-purpose subagent runningBashproduces zero hook entries (no secondsession_id, noagent_typeanywhere in the log).- Dynamic-workflow agents (
CreateWorkflowruns) — a one-agent workflow whose actor runsgit config --get user.namevia Bash was allowed through, while the identical command in the main session is refused by the same trusted PreToolUse guard. The actor's session produced zero hook entries.
A probe logger on every event recorded 164/164 entries from the main session id across a session that included both subagent dispatches and two workflow runs. The CreateWorkflow submission itself is hooked (tool_name: "CreateWorkflow"), so the main-session tool surface is covered — only the child runtimes are not.
Additionally, SessionStart and UserPromptSubmit hooks configured identically in the same trusted project config never fired in a fresh session (0 entries each), while PreToolUse, PostToolUse and Stop all fired normally. Session was yolo mode.
Reproduction
- Put a process hook on
PreToolUse(all tools) in<workspace>/.zcode/config.jsonthat appends its stdin payload to a log file;hooks.enabled: true. - Grant trust; open a fresh session in that workspace.
- Run any Bash command → log entry appears with the main
session_id. - Dispatch a subagent that runs one Bash command → no entry.
- Run a one-agent
CreateWorkflowscript whose agent runs one Bash command → no entry from the agent's session.
Expectation
Child runtimes (subagent_child, workflow_child) should run their tool calls through the same trusted configured hook runner as the main session. The source appears to intend this: apps/zcode-cli/packages/core/src/runtime/helpers/runtime-tools.ts (initializeRuntimeTooling / createRuntimeHookRunner) builds a ConfiguredHookRunner for every AgentRuntime when config.hooks?.enabled || deps.workspaceHookSnapshot, gated by workspaceHookAdmission — so this reads like incomplete plumbing (for example, workspaceHookSnapshot/executionPort not being passed to child runtimes) rather than a design decision.
Impact
Hooks cannot enforce any safety policy on dispatched work, which blocks porting hook-guarded workflows (start-up canaries, git-mutation guards) to dynamic workflows and subagents.
Activity
github-actions commentedon Sep 27, 2026
👋 感谢你的反馈,我们已经收到。
status: 待评估,你可以随时补充信息。needs: 更多信息标签并 @ 你。👋 Thanks — we've received your issue.
status: 待评估(Triage); feel free to add context.needs: 更多信息and ping you.neudysrd commentedon Oct 4, 2026
Hitting the same thing on 3.14.4 (Linux x64). I spent some time in the shipped CLI bundle (
resources/glm/zcode.cjs, build of 2026-09-28) to see where it breaks, and found a few things that might help whoever picks this up. To be clear, this comes from reading the code; I haven't run a patched build.For subagents it's not only project hooks. The
subagent_childruntime gets a hand-built config with nohookskey, and its deps include neitherhookRunnernorworkspaceHookSnapshot. So user hooks in~/.zcode/cli/config.jsonand plugin hooks don't fire for subagent tool calls either. That matches what I see in practice: our plugin's PreToolUse guard catches things in the main session and never anything a subagent does.Workflow actors look like a separate case. Both kinds spread the parent's runtime config (
let{systemPrompt:t,...n}=e.deps.runtimeConfig): the/expertand saved-workflow children (createWorkflowChildRuntime), and theCreateWorkflowactors. So user and plugin hooks should reach them. Only the trusted workspace snapshot is missing, which lines up with your report. Actor session ids are built fromdwf-<runId>-<actorRef>. The fix is probably different for each kind.Even once hooks fire, PreToolUse won't say which agent is calling. The subagent sets
agentName: `zcode-${t.agentType}`, andagent_typeis mapped from it for SessionStart and Stop, but the PreToolUse payload never gets it. Anything per-agent, like "only the committer agent maygit commit", needsagent_typethere, plus the parent session id asked for in #236.Removing tools doesn't work as a stopgap. I looked at
disallowedTools: [Read], so subagents would have to go through a bounded reader instead. The tool does disappear, even in yolo mode. But then Edit and Write refuse any existing file withFile has not been read yet. Read it first before writing to it., and acatthrough Bash doesn't count as a read. So an agent without Read can't edit at all.For a sense of impact: in our measurements, around 89% of the whole-file-read volume our output-size guard would block comes from subagents. Today the guard sees about a tenth of it.
Happy to test a build if that helps.
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.