Repository navigation
skills(review-reviewers): add bash-tool-safe corruption-scan recipe - #359
Conversation
The Step-2 subagent prompt lists corruption signals (literal ${,
unescaped bangs, broken heredoc markers) but doesn't say how to scan.
Each run improvises inline, and inline jq/grep with a literal backslash-
bang is itself mangled by the Bash-tool exclamation-mark preprocessor —
jq aborts with Invalid escape, the run reports zero matches, and the
corrupted comment slips through.
Add a recipe: dump bodies to a file first, then scan the file with
grep -F for fixed strings and grep -P for backslash-bang.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
The recipe doesn't run as written: gh api rejects --arg ("unknown flag"), and its built-in --jq has no way to accept jq variables — so the filter sees $BOT and $WIN undefined and aborts. Inlining the shell vars into the filter (matching the gh issue list ... --jq ".[] | select(.title | contains(\"$MONTH\"))" pattern already used elsewhere in this file) avoids the issue.
| > gh api "repos/$ARGUMENTS/issues/$n/comments?per_page=100" \ | ||
| > --jq '.[] | select(.user.login == $BOT and .created_at > $WIN) | "=== #'$n' \(.id) ===\n\(.body)\n"' \ | ||
| > --arg BOT "$BOT_LOGIN" --arg WIN "<window-start>" >> /tmp/bot-output/all.txt |
There was a problem hiding this comment.
| > gh api "repos/$ARGUMENTS/issues/$n/comments?per_page=100" \ | |
| > --jq '.[] | select(.user.login == $BOT and .created_at > $WIN) | "=== #'$n' \(.id) ===\n\(.body)\n"' \ | |
| > --arg BOT "$BOT_LOGIN" --arg WIN "<window-start>" >> /tmp/bot-output/all.txt | |
| > gh api "repos/$ARGUMENTS/issues/$n/comments?per_page=100" \ | |
| > --jq ".[] | select(.user.login == \"$BOT_LOGIN\" and .created_at > \"<window-start>\") | \"=== #$n \(.id) ===\n\(.body)\n\"" \ | |
| > >> /tmp/bot-output/all.txt |
gh api rejects --arg (it's a jq CLI flag, not a gh api flag), and its built-in -q/--jq filter has no facility for passing variables — $BOT and $WIN are undefined, so the filter aborts. Inlining via shell quoting matches the pattern used in the gh issue list ... --jq ".[] | select(.title | contains(\"$MONTH\"))" block above.
gh api has no --arg flag and its built-in --jq doesn't accept jq variables, so the original filter referenced undefined $BOT/$WIN and aborted. Inline the shell vars into the filter, matching the pattern at line 79. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
You're right — verified |
…eck (#966) Drops the `47 * * * *` cron from `review-reviewers`, leaving `workflow_dispatch`. Its recent output had converged on maintaining its own evidence machinery, at the fleet's highest per-run cost and a seven-day quota ceiling that twice took the user-facing workflows down with it; each adopter's daily `tend-review-runs` already reviews that repo's runs from the inside and routes bundled-skill defects upstream, so this removes the direct loop rather than the only one. The skill is scoped to match: it described itself as hourly and told the session to analyze "the past hour". It now states the window `list-recent-runs.sh` actually hands it — floor at the previous successful run of the workflow, clamped 6h back — which with no cron makes the clamp the normal case rather than an outage signal, and scopes its claims to that window. (An earlier revision of this PR described a cron-payload branch; #965 replaced that logic while this branch was open, and the text was rebased onto what merges.) <details><summary>What the sweep caught, and when</summary> Its unique catches — the ones no inside-out session would have found — cluster in April–June: rubber-stamped APPROVEs over visibly failing checks (#667), backslash-backtick corruption in already-published comment bodies across repos (#359, #405, #424, #562), stale PRs silently dropping mentions (#391), and the stale/re-anchored approval family (#798, #821, #884). The last two weeks are dominated by fixes to its own machinery — evidence-gist plumbing, survey-window arithmetic, matrix branch naming, run→output attribution — while per-run cost climbed from $5.31 to $10.49. That is the shape the cost gate in #960 was written for. </details> Re-enable by dispatching it after a change that could move bot behavior fleet-wide: a release, a harness switch, a model bump — within the hour of that change, per the window note in the overlay. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Fable 5 <[email protected]>
Problem
The Step-2 subagent prompt in
review-reviewerslists "Bot comment contains corruption (literal${, unescaped bangs, broken heredoc markers)" as a negative outcome signal but doesn't say how to scan. Each run improvises the scan inline, and the natural authorings —jqregex liketest("\\!")orgrep -P '\\!'written directly in a Bash command — get mangled by the same Bash-tool exclamation-mark preprocessor the scan is trying to detect:\!rewrites to\\!, jq aborts withInvalid escape "\!", the scan reports "zero matches", and the run silently passes a corrupted comment.Evidence
Two concrete cases observed today (run 25155760186 on
max-sixty/worktrunk):Detection failure. The prior
review-reviewersrun 25153406082 listedworktrunk-botcomment 4350585541 ("Good news — the spike at...") in its corruption scan and reported "zero matches" for\!. Today's grep on the same comment body finds clear\!corruption mid-comment inside a code span:The PR is already a substantive `\!` refactor. My own first-pass inline-jq scan reproduced the trap immediately —jq: error: Invalid escape "\!". Switching togrep -Fandgrep -P '\\!'against a file-dumped body found the corruption that the prior scan missed.Underlying recurrence (not fixed in this PR). Comment 4350585541 itself is the 2nd wild post-skills: restore bang-escape warning (bug still fires in CI harness) #318 occurrence of the bot shipping
\!corruption to a public comment (1st was issue #2309 on 2026-04-20, recorded in the gist). Recorded in the evidence gist for the recurrence-rate counter. Not addressed here because the existing skill warning already directs the right behavior; the bot just lapsed.Fix
Add one paragraph + one code block to the Step-2 subagent prompt: dump bot bodies to a file, then scan with
grep -F(literal${,anthropics/) andgrep -P '\\!'for backslash-bang. The file-then-scan two-step keeps the regex out of the bash-tool input where the preprocessor would touch it, andgrep -Pis robust to the rewrite —\!in the source becomes\\!after rewrite, and PCRE\\!still matches literal\!because!is not a regex metacharacter.Gate assessment
\!regardless of quoting form, so any inline scan authored with\!in its pattern will hit the same trap.Evidence gist (current month): https://gist.github.com/44ab1483b29406255dd36141650c894d