Repository navigation
skills(running-in-ci): cover nested fenced blocks in backtick-escape rule - #495
Merged
Merged
Conversation
…rule Extend the existing single-quoted-heredoc backtick-escape paragraph to cover the nested-fence variant (model escapes the inner three-backtick fence and inline spans inside it). Recommend a longer outer fence (four or five backticks) as the standard remedy. Evidence: PRQL/prql#5900 shipped with six visible `\\`...\\`` spans in its body, the first backslash-backtick corruption observed in PRQL's evidence gist history.
max-sixty
added a commit
that referenced
this pull request
May 15, 2026
…unneeded guidance (#504) ## Bug Linux Claude Code v2.1.142's bubblewrap-backed subprocess sandbox wraps bash commands using the legacy `shell-quote` quote function with the regex `/(["\\$`!])/g`, which escapes `!` to `\!` in any argv token that mixes `'` with whitespace. That landed `\!=` in `jq` filters, `assert\!()` in code references, `feat(api)\!:` in conventional-commit titles, etc. The same binary contains a **fixed** `'\''`-wrap quoting path for the macOS `sandbox-exec` route — both paths coexist, only the Linux-bwrap path still uses the buggy quoter. See [anthropics/claude-code#35701](anthropics/claude-code#35701) (closed as stale; multiple duplicates closed since). ## Fix 1. **`action.yaml`**: set `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=0` on the `claude-code-action` invocation. This disables the bwrap sandbox and routes bash through the fixed `'\''`-wrap path. Trade-off: loses subprocess env isolation. Applied at the composite-action level, so all `max-sixty/tend@v1` consumers pick it up automatically once tagged. 2. **Skills**: with the bug worked around, the bang-trap guidance can go. Removed across `triage`, `notifications`, `review-runs`, `review-reviewers`, and `running-in-ci`: - "Don't use `!` in comment body" / "use Write tool for bodies with `!`" - `!=` rewrite warnings in `jq` recipes (and the awkward `(.status == "completed") | not` rephrase) - `--title-file` and `git commit -F` workarounds - `||` not `if !` rationale comments - `<<'EOF'`/`<<EOF` interpolation footgun warning 3. **Body composition**: standardized on Write tool + `--body-file` for substantial PR/comment/gist bodies. Removed the inline `gh ... --body "$(cat <<'EOF' ...)"` heredoc patterns from `review-reviewers`'s gist seed and step summary and the line-wrap example in `running-in-ci`. Write-tool composition is reviewable, sandbox-independent, and bypasses the shell-quoting layer entirely. ## Kept on purpose - **Backtick-in-heredoc paragraph** (extended via origin/main merge with [#495](#495 nested-fence guidance). This is a model authoring habit, *not* the shell-quote bug — the workaround doesn't help. The paragraph now covers inline spans AND nested fences, recommending longer outer fences for nesting and bare backticks throughout. - **Corruption-scan tripwires in `review-reviewers`** (`grep -nP '\\!'` and `` grep -nP '\\\`' ``). If the workaround stops working — bug returns upstream, env var override, the sandbox surface changes — the scans catch it in the bot's own output. - **`no-preprocessor-poison-in-skills` pre-commit hook**. Different bug (slash-command preprocessor crashes on literal `` !` `` in plugin skill `.md` files, regressed twice per #234/#243/#244), unrelated to the Bash-tool rewrite. ## Validation posture Workaround is empirically targeted: the bug reproduces in CI (bwrap sandbox active), does not reproduce locally (`sandbox-exec` on the fixed path), and the env-var docstring inside the binary explicitly documents the opt-out. If a regression slips, `review-reviewers`'s `grep -nP '\\!'` / `` grep -nP '\\\`' `` scans against the bot's own output fire on the next run. Easy revert via `git revert <commit>` if anything misbehaves. --------- Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extend the existing
<<'EOF' ... EOFbacktick-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 (
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```markdownouter fence and contains an inner```bashfence 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: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 for May 2026 records the scans.Classification
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
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-filevia the Write tool helps with delivery but not authoring — the model still has to author with bare backticks, since Write preserves data verbatim.Notes
$GITHUB_REPOSITORY+!in a comment body #381, docs: clear website-build cruft #432) — same paragraph, different shape, same delivery channel.