Category: bug
Summary
The flag-commit-pr-skill-bypass.sh PreToolUse advisory fires on a hand-typed git commit -F - that already replicates the canonical /commit mechanic, contradicting the hook's own documented intent.
Observed
During PR babysitting (worker on #527), this well-formed commit triggered the advisory:
git commit -F - <<'EOF'
test(work-items): add needs-info eval for raw-marker clearing
...
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
EOF
Emitted additionalContext:
Commit/PR skill composition (advisory): direct git commit (missing the canonical -F - stdin form + --trailer Co-Authored-By line) ...
The message claims the -F - stdin form is missing — but it was used verbatim, and a Co-Authored-By trailer was present in the heredoc body.
Root cause
plugins/guardrails/hooks/flag-commit-pr-skill-bypass.sh lines 180-181:
if ! [[ "$COMMAND_LC" =~ (^|[[:space:]])(-f|--file)[[:space:]]+-([[:space:]]|$) ]] ||
! [[ "$COMMAND_LC" =~ --trailer ]]; then
!(A) || !(B) is !(A AND B) — it fires unless BOTH -F - AND --trailer are present. But the documented intent is the opposite:
- Header (lines 16-22): "A manual
git commit that already replicates the canonical shape (e.g. a hand-typed heredoc form) stays quiet — the guard targets the anti-pattern (git commit -m "...")".
- Inline comment (line 178): "Either marker present -> the caller already replicates the skill's mechanic; stay quiet."
To stay quiet when EITHER marker is present (fire only when NEITHER is), the condition must be !(A) AND !(B). The || should be &&.
Secondary issue
strip_literals() (lines 141-166) drops heredoc bodies wholesale, and the canonical /commit mechanic carries Co-Authored-By inside the -F - heredoc body, not via a --trailer flag. So --trailer is both (a) undetectable in the intended canonical form and (b) not actually the marker the canonical mechanic uses. The -F - / --file - stdin marker alone is the reliable signal that the caller replicated the canonical shape; requiring --trailer on top guarantees a false positive for the very heredoc form the header cites as "stays quiet."
Impact
False-positive advisory noise on well-formed commits; nudges toward /commit when the commit already replicates the canonical shape. Non-blocking (exits 0), so cosmetic — but it fires on the exact form the header documents as exempt.
Suggested fix
Change the fire condition to !(A) && !(B) (stay quiet when either -F - or --trailer is present), and consider dropping the --trailer requirement in favor of the -F - stdin marker alone, since the canonical mechanic passes the trailer through the heredoc body.
Filed by an automated PR-babysitting worker (self-observation). Not refiling #484/#465/#473/#499/#504/#511/#512/#524.
Category: bug
Summary
The
flag-commit-pr-skill-bypass.shPreToolUse advisory fires on a hand-typedgit commit -F -that already replicates the canonical/commitmechanic, contradicting the hook's own documented intent.Observed
During PR babysitting (worker on #527), this well-formed commit triggered the advisory:
Emitted
additionalContext:The message claims the
-F -stdin form is missing — but it was used verbatim, and aCo-Authored-Bytrailer was present in the heredoc body.Root cause
plugins/guardrails/hooks/flag-commit-pr-skill-bypass.shlines 180-181:!(A) || !(B)is!(A AND B)— it fires unless BOTH-F -AND--trailerare present. But the documented intent is the opposite:git committhat already replicates the canonical shape (e.g. a hand-typed heredoc form) stays quiet — the guard targets the anti-pattern (git commit -m "...")".To stay quiet when EITHER marker is present (fire only when NEITHER is), the condition must be
!(A) AND !(B). The||should be&&.Secondary issue
strip_literals()(lines 141-166) drops heredoc bodies wholesale, and the canonical/commitmechanic carriesCo-Authored-Byinside the-F -heredoc body, not via a--trailerflag. So--traileris both (a) undetectable in the intended canonical form and (b) not actually the marker the canonical mechanic uses. The-F -/--file -stdin marker alone is the reliable signal that the caller replicated the canonical shape; requiring--traileron top guarantees a false positive for the very heredoc form the header cites as "stays quiet."Impact
False-positive advisory noise on well-formed commits; nudges toward
/commitwhen the commit already replicates the canonical shape. Non-blocking (exits 0), so cosmetic — but it fires on the exact form the header documents as exempt.Suggested fix
Change the fire condition to
!(A) && !(B)(stay quiet when either-F -or--traileris present), and consider dropping the--trailerrequirement in favor of the-F -stdin marker alone, since the canonical mechanic passes the trailer through the heredoc body.Filed by an automated PR-babysitting worker (self-observation). Not refiling #484/#465/#473/#499/#504/#511/#512/#524.