fix(guardrails): the foreground-wait guard refuses a Monitor tool call
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by logging the JSON that arrives on stdin in plugins/guardrails/hooks/block-foreground-wait.sh and triggering a Monitor call, to see which tool_name and fields it carries. Compare that with the early exit at lines 65-66 and the Bash|PowerShell matcher in the plugin's hooks.json, which should mean the hook never fires for Monitor at all. Fix the tool-name handling and add a Monitor case to plugins/guardrails/hooks/block-foreground-wait.test.sh; done when that test passes and a real Monitor call is no longer refused.
由索引模型根据 Issue 内容生成。
描述
Steps to reproduce
- In an interactive Claude Code session with the
guardrailsplugin enabled, call the Monitor tool with a command holding anuntilloop, for exampleuntil [ -s <file> ]; do sleep 60; done; echo done.
Expected behavior
The call runs. Monitor is the tool the guard's own message recommends: "Run the command with run_in_background set to true, or watch it with the Monitor tool".
Actual behavior
The call is refused with PreToolUse:Monitor hook error: [command hook 10]: BLOCKED: This until loop waits in the foreground. Run the command with run_in_background set to true, or watch it with the Monitor tool, and read the result when it finishes. (observed 2026-11-23 in the Software Factory Part Two session).
Severity
Low.
Severity justification
The refusal sends a session to the tool it then refuses; a session can wait for subagent notifications instead, so nothing is lost, but a correct wait is turned away.
Suggested fix location
plugins/guardrails/hooks/block-foreground-wait.sh:65-66exits unless the tool name isBash, andhooks.jsonregisters the hook only underBash|PowerShell, so how the Monitor call reached it is not known: the hook payload was not visible. First step: capture the PreToolUse payload of a Monitor call and see whichtool_nameand fields it carries.plugins/guardrails/hooks/block-foreground-wait.test.shhas no Monitor case; add one.
Environment
Claude Code with guardrails 4.2.0 (installed cache), WSL2 Ubuntu.
session: Software Factory Part Two (workshop 08 alignment pass, ledger Q2113).
- 主要语言
- Shell
- 星标
- 22
- 派生
- 2
- 平均合并
- 2 小时
- 30 天内合并 PR
- 960
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
melodic-software/claude-code-plugins 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
melodic-software/claude-code-plugins#19225 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 65/100
melodic-software/claude-code-plugins#17779 · 2 条评论 ·
维护者通常 1 天内回复
-
recurring
难度 4/5 3-5 天 新手友好度 25/100
melodic-software/claude-code-plugins#19274 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 25/100
melodic-software/claude-code-plugins#19270 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 53/100
melodic-software/claude-code-plugins#19269 ·
维护者通常 1 天内回复
查看 melodic-software/claude-code-plugins 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
nais/attest-sign#139 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
community-scripts/core#303 ·
维护者通常 1 天内回复
-
severity: low
难度 1/5 1 小时以内 新手友好度 72/100
luainkernel/lunatik#2727 ·
维护者通常 1 天内回复
-
[quality] release publish.mjs integrity guards have no unit test可能已有人在做 @robarnold 今天认领。 未关闭agent/quality stage/040-covered-by-pr testing
难度 2/5 1-3 小时 新手友好度 75/100
marinatedconcrete/config#1155 ·
维护者通常 1 天内回复
-
bug report-to-upstream
难度 1/5 1 小时以内 新手友好度 75/100
flatpark/flatpark#1585 · 1 条评论 ·
维护者通常 1 天内回复