Skip to content

skills(running-in-ci): cover issue and PR bodies in bang-escape guidance - #404

Merged
max-sixty merged 1 commit into
mainfrom
hourly/review-25624020037
May 10, 2026
Merged

max-sixty merged 1 commit into
mainfrom
hourly/review-25624020037

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Problem

The bang-escape rule in running-in-ci enumerates "comment body, jq script, markdown heredoc, anything" but does not name issue body or PR body as surfaces. The Bash-tool preprocessor rewrites every literal exclamation mark to backslash-bang before bash parses the command, so any gh issue create --body "$(cat <<EOF ... EOF)" whose body quotes code references with ! ships visibly corrupted to GitHub. The "anything" catchall doesn't reliably trigger when "issue body" isn't on the listed surface set.

Evidence

This morning's tend-nightly run on max-sixty/worktrunk opened issue #2663 ("Nightly drift cleanup") with five backslash-bang corruption sites in the body:

src/help.rs:125 emits `<\!-- ⚠️ AUTO-GENERATED ... -->`
... `eprintln\!("---")` before `Result: ...`
... `assert\!(\!repo.root_path().join("marker.txt").exists())`
... `anyhow::ensure\!(e.kind() == ErrorKind::NotFound, e)` ... `if e.kind() \!= ErrorKind::NotFound`
... `is_dirty()` could be `Ok(\!self.dirty_files()?.is_empty())`

(That output is from gh issue view 2663 --json body --jq .body — confirms the corruption is in GitHub's stored body, not local rendering.)

The body was composed in the nightly survey path, which doesn't have its own body-composition guidance and inherits from running-in-ci. The maintainer engaged with the issue and merged five of the resulting fix PRs (#2664–#2668) within ~30m, so the corruption did not block the workflow — but every code reference in the issue is visibly wrong.

Fix

Extend the listed surfaces in the bang-escape rule from "comment body" alone to "issue body, PR body, comment body". Name the listed gh subcommands that need --body-file (gh issue create / gh issue edit / gh pr create / gh pr edit / gh issue comment / gh pr comment). Add a one-line trap example: code references like eprintln!(...) / assert!(...) / <!-- ... --> / != quoted in survey or triage bodies are the common shape.

This follows #319 ("running-in-ci: cover PR/issue titles in bang-escape guidance") which extended the same rule to titles via the same incremental enumeration.

Cumulative evidence

The watch item "review-reviewers corruption-scan recipe doesn't cover PR/issue bodies" has carried in evidence gist for prior months awaiting concrete recurrence; this run's #2663 body provides it.

Gate assessment

  • Single-occurrence, but a near-duplicate path was already extended in running-in-ci: cover PR/issue titles in bang-escape guidance #319 with maintainer approval.
  • Mechanism is well-understood: documented Bash-tool preprocessor rewrite, fix is the existing Write+--body-file pattern.
  • High visibility: the corrupted body anchors a 7-PR cascade that the maintainer engaged with directly.

This is a one-line documentation change with a clear precedent and concrete reproduction.

The rule previously enumerated "comment body" but not issue/PR body, even
though the same Bash-tool preprocessor rewrites exclamation marks to
backslash-bang on every body-composition path. A nightly survey-issue body
quoting Rust macros (`eprintln\!()`, `assert\!()`) and HTML comments (`<\!-- -->`)
shipped visibly corrupted to GitHub. Extending the listed surfaces to issue
body / PR body, and naming code references as a common trap, follows the
shape of #319 (which extended the rule to titles).
@tend-agent tend-agent added the claude-behavior Behavioral issues found by review-reviewers label May 10, 2026
@max-sixty
max-sixty merged commit 149d441 into main May 10, 2026
3 checks passed
@max-sixty
max-sixty deleted the hourly/review-25624020037 branch May 10, 2026 15:01
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