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

Ouverte
#18,858 10 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
64/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
bash, shell
Domaine
tooling

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
Shell
Étoiles
22
Forks
2
Merge moyen
2 h
PR mergées (30 j)
960

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de melodic-software/claude-code-plugins

Toutes les issues de melodic-software/claude-code-plugins

Issues similaires

Plus d'issues Shell/Bash

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.