fix(guardrails): the foreground-wait guard refuses a Monitor tool call

オープン
#18,858 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
64/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
bash, shell
領域
tooling

調査の方向性

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 の本文から書いたものです。

説明

host-run

Steps to reproduce

  1. In an interactive Claude Code session with the guardrails plugin enabled, call the Monitor tool with a command holding an until loop, for example until [ -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-66 exits unless the tool name is Bash, and hooks.json registers the hook only under Bash|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 which tool_name and fields it carries.
  • plugins/guardrails/hooks/block-foreground-wait.test.sh has 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時間
マージ済み PR(30日)
960

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

melodic-software/claude-code-plugins のほかの issue

melodic-software/claude-code-plugins の issue をすべて見る

似ている issue

Shell/Bash の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。