Skip to content

skills(running-in-ci): extend bang-escape guidance to git commit -m - #427

Merged
max-sixty merged 2 commits into
mainfrom
hourly/review-25700356158
May 12, 2026
Merged

max-sixty merged 2 commits into
mainfrom
hourly/review-25700356158

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Problem

running-in-ci's bang-escape paragraph covers gh ... --body / gh pr create --title corruption with --body-file and $(cat …) recipes, but does not cover git commit -m "…". A bot-authored commit on max-sixty/worktrunk just shipped to permanent git history with backslash-bang corruption in both the title and body of the message:

test: hoist ansi_strip() out of assert\! args for coverage

Codecov treats expressions inside an assert\!'s panic-message arm as a
separate branch from the assertion itself, so the `result.ansi_strip()`
calls inside the format\! arguments registered as uncovered ...

Source: worktrunk@148a9f54. Verified literal backslash-bang via gh api repos/.../commits/<sha> --jq '.commit.message' | od -c — bytes are a s s e r t \ ! (not a JSON-escape artifact).

The mechanism is the same as the --title corruption tend#318 / #320 / #422 addressed: git commit -m "msg" passes the message as a literal string argument, the Bash-tool preprocessor rewrites every ! to \! in command strings before bash parses, and git stores those argument bytes verbatim into the commit object. Rust code is especially exposed because assert!, format!, panic!, eprintln!, vec! are everywhere — a fix-test-coverage commit that quotes those identifiers will ship corrupted.

Prior review-reviewers evidence (April) explicitly claimed git commit was immune ("the commit message on the same branch is clean ... confirming the corruption is specific to --title string arguments, not git commit"). That claim was based on commits whose messages happened to have no ! or were composed via -F. The corruption shape on -m is identical to --title and just hadn't been observed in the wild yet.

Fix

Add a short paragraph after the existing --title recipe in the Comment Formatting section, explicitly calling out git commit -m and providing the git commit -F /tmp/commit-msg.txt recipe. git commit -F reads the file directly, so the preprocessor never sees the bang.

The example at line ~592 (git commit -m "skills(running-tend): ...") is left as-is — its title has no !, so it's still safe, and the new paragraph clarifies that -F becomes mandatory only when the message contains code references or breaking-change markers.

Evidence

Evidence gist for the worktrunk-bot run that produced this: https://gist.github.com/9675d1510da32c68a68c1d45137b21e0.

Related: tend#318 (--body-file workaround), tend#320 / tend#422 (--title workaround), tend#423 (bang-escape in single-quoted heredocs), tend#424 (review-reviewers backslash-backtick scan).

The bang-escape paragraph already covers `--body-file` / `--title`
surfaces but not `git commit -m`. Recent worktrunk-bot fix commit
shipped to permanent git history with `assert\!` and `format\!` in
the message body via `git commit -m "..."` — the Bash-tool
preprocessor rewrites every `!` in command arguments, and git stores
the literal argument bytes when reading from `-m`.

Add a short paragraph (and `-F file` recipe) covering the same trap
for git commit messages. `git commit -F` reads the file directly,
so the preprocessor never sees the bang.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@tend-agent tend-agent added the claude-behavior Behavioral issues found by review-reviewers label May 11, 2026
The new paragraph used `!` inside inline code spans (`assert!`, `format!`,
`panic!`, and the bare `!` token), which trips the
no-preprocessor-poison-in-skills pre-commit hook. The hook forbids bang
immediately followed by backtick because Claude Code's slash-command
preprocessor treats that as command substitution and crashes the session.

Rewrite to follow the existing convention in the file: when an inline code
span needs to show a macro, follow the bang with parens (`assert!(...)`),
and use plain prose ("exclamation mark") elsewhere.

No semantic change to the guidance itself.
@max-sixty
max-sixty merged commit 9d165c4 into main May 12, 2026
5 checks passed
@max-sixty
max-sixty deleted the hourly/review-25700356158 branch May 12, 2026 04:56
max-sixty pushed a commit that referenced this pull request May 15, 2026
…rule (#495)

## Summary

Extend the existing `<<'EOF' ... EOF` backtick-escape rule to cover
nested fenced code blocks. The current rule warns about escaping *inline
code spans* (`` \`foo\` ``); the same single-quoted-heredoc mechanic
also corrupts *nested fences* when the model defensively escapes the
inner three-backtick fence (`` \`\`\`bash ``) to keep it from closing
the outer fence. The fix is the standard markdown idiom: use a longer
outer fence (four or five backticks) so the inner three-backtick fence
renders intact without escaping.

## Evidence

[PRQL/prql#5900](PRQL/prql#5900) (`tend
ci-fix: transient classifier ignores repeat occurrences`, opened by
prql-bot 2026-05-15T08:56:34Z). The body wraps a proposed skill addition
in a `` ```markdown `` outer fence and contains an inner `` ```bash ``
fence plus several inline code spans. The model escaped the inner fence
and all inline backticks inside the inner section, producing visibly
corrupted markdown — the rendered body shows `` \`\`\`bash ``, ``
\`rustup-init\` ``, `` \`composer connect timeout\` ``, `` \`docker pull
rate limit\` ``, `` \`gh issue search\` ``, and trailing `` \`\`\` ``
(six distinct corrupted spans). Direct API spot-check:

````
$ gh api repos/PRQL/prql/issues/5900 --jq '.body' | grep -c '\\`'
6
````

This is the first such occurrence in the PRQL evidence gist's tracked
corruption-scan history (prior ticks all reported `backslash-backtick:
clean`); the [evidence
log](https://gist.github.com/tend-agent/5686b1fca82c08d385d9031a79be4a3e)
for May 2026 records the scans.

## Classification

- **Failure class**: structural. The trigger is deterministic — a body
composed in a single-quoted heredoc that contains a nested fenced block
+ the model's defensive instinct to escape the inner fence. Replayed,
this produces the same corruption every time. The existing rule already
classifies the inline-code-span variant as authored (not
preprocessor-injected); the nested-fence variant is the same shape with
a different originating model habit.
- **Evidence level**: structural / 1 occurrence — sufficient under
[`review-gates.md`](https://github.com/max-sixty/tend/blob/main/plugins/tend-ci-runner/skills/review-reviewers/review-gates.md):
*"Structural: no decision point — the same conditions produce the same
failure every time... One clear occurrence is sufficient evidence for a
targeted fix."*
- **Change magnitude**: targeted fix — one sentence appended to an
existing paragraph. Within the Gate-2 magnitude budget for
structural-fix scope.

## Change

`plugins/tend-ci-runner/skills/running-in-ci/SKILL.md`: extend the
existing backtick-escape paragraph (already covering inline spans like
`` \`foo\` ``) with a second sentence covering nested fenced blocks.
Recommend a longer outer fence (four or five backticks outside, three
inside) as the standard remedy. Adds a parenthetical noting that
`--body-file` via the Write tool helps with delivery but not authoring —
the model still has to author with bare backticks, since Write preserves
data verbatim.

## Notes

- #5900 itself is left as-is for now; its body is readable and stands as
the in-evidence example for this fix. A clean re-author can follow once
this skill update lands.
- This change does not touch the inline-code-span rule (#423) or the
bang-escape rules (#404, #427, #381, #432) — same paragraph, different
shape, same delivery channel.

Co-authored-by: tend-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-behavior Behavioral issues found by review-reviewers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants