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

Đang mở
#18,858 10 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
64/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bash, shell
Lĩnh vực
tooling

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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).

Ngôn ngữ chính
Shell
Star
22
Fork
2
Merge trung bình
2 giờ
Pull request đã merge (30 ngày)
960

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của melodic-software/claude-code-plugins

Tất cả issue của melodic-software/claude-code-plugins

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.