Skip to content

flow_alarm: read the command word, not the raw text, at the stop-starting cap - #2178

Merged
remigiusz-antczak merged 1 commit into
mainfrom
land/wave-flowalarm
Nov 1, 2026
Merged

remigiusz-antczak merged 1 commit into
mainfrom
land/wave-flowalarm

Conversation

@remigiusz-antczak

Copy link
Copy Markdown
Collaborator

Summary

flow_alarm.py's stop-starting hook now denies a command that can run gh pr create, not every command whose text names it, so greps, echoes and commit messages pass at the cap (tests 10 → 22).

  • A command that names the text is allowed only when every command in it is a known text tool; gh counts as one outside pr create, pr new and api, and a command word that is a path never does.
  • Every step that drops text before parsing (comments, heredoc bodies, line joins) keeps it when the input is ambiguous, so doubt means deny.
  • A follow-up round closes 5 bypasses an independent review found: git-running assignment prefixes, the pr new alias, flags between pr and create, and mentions hidden in a comment or heredoc body.
  • The hook docstring and the changelog list the shapes that still pass. This is a flow alarm, not a security boundary.

Closes #2165

Verification

Run on this head:

  • Tests: test_flow_alarm.py 22/22; run-ci-tests.sh --affected with the derived files rebuilt first, as CI does: 6/6 selected suites pass.
  • Changelog fragments 23/23, size ratchet ok, privacy gate clean.

🤖 Generated with Claude Code

…ting cap

At the stop-starting cap the hook denied every Bash command whose raw text
matched `gh pr create`, so a grep, an echo, a commit message or an issue body
that only named the command was blocked, while a quoted or escaped form was not
matched at all. The hook now denies a command that names the text unless every
command in it is a known text tool, and every step that drops text before
parsing keeps it when the input is ambiguous (keep means deny).

An independent review found five ways to run the command past the first
version: an assignment prefix that makes git run its value, the `pr new` alias
and flags between `pr` and `create`, and a mention that sat only in a comment
or heredoc body escaping the file-write and git rules. Each is now denied and
pinned by a regression test; a command word that is a path is no longer a
text tool, and the residual list in the docstring and changelog names what
still passes.

Tests: test_flow_alarm 22/22; run-ci-tests --affected 6/6 suites; changelog fragments 23/23
Closes #2165

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@remigiusz-antczak
remigiusz-antczak merged commit ef4142d into main Nov 1, 2026
11 checks passed
@remigiusz-antczak
remigiusz-antczak deleted the land/wave-flowalarm branch November 1, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flow_alarm.py: the stop-starting hook denies any command that mentions the PR-create command, not only ones that run it

1 participant