Repository navigation
fix(review): remove re-introduced \\!-backtick poison from skill comments - #243
Merged
Merged
Conversation
…ents PR #226 rewrote the CI-polling code block in `running-in-ci/SKILL.md` and `review/SKILL.md` to include the comment `# Use \`||\` rather than \`if \!\` — the Bash tool escapes \`\!\` as \`\\!\``, re-introducing the exact \\!\` sequence that PR #234 fixed on 2026-04-10. Claude Code's slash-command preprocessor treats \\!\` as "execute the next backticked string as a shell command", consumes text through the next backtick, and runs ` — the Bash tool escapes ` as bash. The em-dash is not a command, so bash reports: Error: Shell command failed for pattern "\!\` — the Bash tool escapes \`": /bin/bash: line 1: —: command not found When the preprocessor fails, the prompt body is not delivered. Every /review invocation produces the same 5-line trace with no assistant turn — the model never sees the review instructions. Evidence from the past hour on max-sixty/worktrunk: - Run 24287041911 — tend-review on PR #2077 (fix/issue-2075), 16:49Z. Session artifact is 5 lines, ends with the stderr above. No review posted. - Run 24287289871 — tend-review on PR #2077, 17:03Z. Same 5-line trace, same stderr, no review posted. Both target the same PR because the bot pushed a commit that retriggered pull_request_target; the PR currently has zero bot reviews despite two review-workflow runs. Earlier review runs in the hour (24281048388 at 11:00Z, 24280957116 at 10:54Z) succeeded, which dates the regression to the 76debaf merge that shipped PR #226. Fix: rephrase both comments to avoid any \\!\` sequence, matching the approach used in PR #234. The guidance content is preserved verbatim in spirit; only the backticks around `if \!` and `\!` are dropped. After the fix, `grep -rn '\!\`' plugins/` returns no matches. Gate assessment: - Evidence level: Critical (clearly wrong outcome — 100% of reviews on the affected PR are empty; also regresses a fix that was already shipped as PR #234) - Classification: Structural — the slash-command preprocessor runs deterministically and will fail on every \\!\` sequence regardless of the model's approach - Occurrences this run: 2 on the same PR (same mechanism as #234) - Change type: Targeted fix (3 lines per file, 2 files) - Both gates pass
4 tasks
tend-agent
pushed a commit
that referenced
this pull request
Apr 11, 2026
…v vars
tend-triage run 24286871206 (2026-04-11 16:40Z) on max-sixty/worktrunk
issue #2076 posted a comment with two visible rendering failures that
both originate in a single `cat > /tmp/comment.md << 'EOF'` heredoc:
1. The literal string "${GITHUB_REPOSITORY}" appears in three markdown
links (e.g.
https://github.com/${GITHUB_REPOSITORY}/blob/.../reference/config.md#L136-L141).
The single-quoted heredoc disabled variable expansion, so the env
var never interpolated.
2. The greeting "Thanks for the suggestion\!" renders as "Thanks for the
suggestion\\!" — the Bash tool pre-escapes every `\!` to `\\!` before
bash sees the heredoc, which makes the quoting mode irrelevant (both
`<< 'EOF'` and `<<EOF` produce `\\!`).
The bot never verified the posted output, declared the task complete,
and the broken comment is still live on worktrunk#2076 as of this
commit (comment id 4229779789).
The prior `\!`-escape-in-comment-heredoc occurrence was recorded as
below-threshold in run 24281303125 (2026-04-11 11:55Z), where the
review bot wrote `if \!is_builtin` inside an inline-suggestion heredoc,
noticed the escaped `\\!` via a post-write verify, and recovered by
rewriting the comment via python3. That tracking entry's explicit
follow-up condition was "If this surface produces a second occurrence,
promote to a one-paragraph addition in running-in-ci/SKILL.md under
the existing \!-escape paragraph." Run 24286871206 is that second
occurrence, and it's worse: the bot did not recover, and the broken
artifact is public.
Extending the GitHub URLs paragraph in running-in-ci is the narrow
targeted fix the prior finding pointed to. The new prose explicitly
tells the bot to:
- Scan for literal `${GITHUB_REPOSITORY}` in the rendered comment, and
rewrite heredocs as unquoted `<<EOF` or use the Write tool instead.
- Use the Write tool for any comment body containing an exclamation
mark, because the Bash tool rewrites `\!` to `\\!` regardless of the
heredoc quoting mode.
The new paragraph is carefully written to contain no `` \!` `` sequence
so it can't trip the slash-command preprocessor (the same footgun
PR #234 and the sibling PR #243 in this hour's cycle both address).
Verified with `grep -rn '\!\`' plugins/` returning zero matches.
This branch also carries PR #243's comment-rewrite on line 147 as a
dependency so that `/review` can actually run on this PR without
hitting the preprocessor error. If PR #243 merges first, the merge
of this branch is a no-op on those lines.
Gate assessment:
- Evidence level: High — structural, 2 occurrences in the same surface
(heredoc-write comment body), second occurrence produced a live
public broken artifact.
- Classification: Structural — the Bash tool's `\!`-escape is
deterministic; single-quoted heredocs are standard bash semantics.
The bot has no decision point that would produce different behavior.
- Change type: Targeted fix (two-sentence addition to an existing
paragraph).
- Both gates pass.
This was referenced Apr 11, 2026
tend-agent
pushed a commit
that referenced
this pull request
Apr 11, 2026
The Claude Code slash-command preprocessor treats a backtick-enclosed token beginning with an exclamation mark as shell command substitution. Any plugin skill file loaded by /review (or another slash command) that contains this sequence crashes the session before the assistant turn runs. The pattern has regressed twice already: PR #217 introduced it, PR #234 removed it, PR #226 reintroduced it, PR #243 removed it again. Each regression broke 100% of tend-review runs until the next fix merged. Add a local pre-commit hook that rejects the pattern at commit time. The check constructs its search string as chr(33)+chr(96) so the hook file itself is safe from the pattern it is searching for. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This was referenced Apr 11, 2026
max-sixty
added a commit
that referenced
this pull request
Apr 19, 2026
The Bash tool no longer rewrites exclamation marks to backslash-bang in
heredocs. Verified: both `<<EOF` and `<< 'EOF'` now pass `!` through
unchanged. Drop the guidance to use Write + `--body-file` for comment
bodies containing `!`, and drop "unescaped bangs" from the bot-comment
corruption signals.
The `${GITHUB_REPOSITORY}` heredoc-quoting guidance stays (that's bash
semantics, not a Claude Code bug), as does the bang-backtick pre-commit
guard (separate slash-command preprocessor issue, #234/#243/#244).
Co-Authored-By: Claude <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Apr 19, 2026
The Bash tool no longer rewrites exclamation marks to backslash-bang in
heredocs. Verified locally — both `<<EOF` and `<< 'EOF'` now pass `!`
through unchanged.
Changes:
- `running-in-ci`: drop the paragraph telling agents to use the Write
tool + `--body-file` for comment bodies containing `!`. Heredocs with
`gh ... --body` work fine again.
- `review-reviewers`: drop "unescaped bangs" from the bot-comment
corruption signals — no longer a thing to watch for.
Kept intentionally:
- The `${GITHUB_REPOSITORY}` heredoc-quoting warning (bash semantics
around single-quoted heredocs, not a Claude Code bug).
- The `.pre-commit-config.yaml` bang-backtick guard — that's a separate
slash-command preprocessor issue (#234/#243/#244), not the heredoc bug.
> _This was written by Claude Code on behalf of @max-sixty_
Co-authored-by: Claude <[email protected]>
tend-agent
added a commit
that referenced
this pull request
Apr 25, 2026
The original PR's new callout contained `!` in a code span, producing the backtick-bang-backtick byte sequence the `forbid bang-backtick in plugin skill files` pre-commit hook rejects (and which would crash the Claude Code slash-command preprocessor — tend#234, #243, #244). Rephrase the single occurrence as "literal exclamation mark" to match the prose used later in the same paragraph. Co-Authored-By: Claude <[email protected]>
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
PR #226 (76debaf) re-introduced the exact
\\!`poison pattern that PR #234 fixed on 2026-04-10. Everytend-reviewrun onmax-sixty/worktrunksince that PR landed has failed silently at the slash-command preprocessor stage — the/reviewinvocation produces a 5-line session artifact with aShell command failedstderr and no assistant turn. No review is posted on the target PR.Root cause
PR #226 ("filter CI polling by run URL, not workflow name") rewrote the CI-polling code block in two files to include the explanatory comment:
Claude Code's slash-command preprocessor treats
\\!`as a prefix meaning "execute the next backticked string as a shell command" — and does so regardless of markdown code fences. When the preprocessor hits the sequence\!` — the Bash tool escapes `it runs— the Bash tool escapesas a shell command. The em-dash is not a valid command, so bash reports:When the preprocessor fails, the prompt body is not delivered and Claude never gets the review instructions. This is identical to the failure mode documented in #234 — PR #226 simply rewrote the comment in a way that restored the poison.
Evidence
Two
tend-reviewruns on max-sixty/worktrunk PRfix/issue-2075(worktrunk#2077) in the past hour, both failed identically:fix/issue-2075fix/issue-2075Both session artifacts end with the same
<local-command-stderr>from the preprocessor. The last successful review run on worktrunk was 24281048388 at 11:00Z (PR #2074), which ran before #226 landed; the failure window begins after the v1 tag picked up the #226 commit.Reference session for run 24287041911:
c3229e75-698b-48af-905e-ecf240b1dcba.jsonl(5 lines total: 2 queue-operation, 1 local-command-caveat, 1 command-args2077, 1 local-command-stderr with the preprocessor error).Fix
Rephrase both comments to drop the backticks around
`if \!`and`\!`, matching the approach #234 used. The guidance content is preserved; only the poison characters are removed. No behavior change for humans reading the skill — the model still gets the same instruction.After the fix,
grep -rn '\!\' plugins/returns zero matches. Theif !shell patterns that remain inplugins/install-tend/skills/install-tend/scripts/oauth-token.shandplugins/tend-ci-runner/scripts/token-report.share in.sh` files which the slash-command preprocessor does not load, so they are not affected.Gate assessment
\\!`sequence in a loaded file will produce the same failure regardless of which model or session runs it.\!\` sequence #234 previously fixed the same surface; fix(ci-runner): replace if-not polling loop with || to avoid bash escaping #217 and fix(ci-runner): filter CI polling by run URL, not workflow name #226 have each reintroduced the pattern. This is the third "regression of the backtick-bang poison" in two days.Why this keeps regressing and a guardrail suggestion
The underlying problem is that the skill file's own text documents the
\!-escape gotcha, and the most natural way to write that documentation is to put the offending string in backticks for clarity. Each time someone rewrites this paragraph (PR #217, PR #226) the poison reappears by accident.A CI pre-commit check — e.g.,
grep -rn '\!\' plugins/ && exit 1` — would catch this mechanically. I considered adding it as part of this PR but held off: a guardrail belongs in a separate PR so the hotfix can merge fast.Test plan
tend-reviewrun on this PR completes with an assistant session longer than 5 lines and posts an actual review (self-approval is blocked by GitHub, but the bot must at least read the diff and comment).grep -rn '\!\' plugins/` returns no matches.tend-mentionandtend-notificationsskill loads ofrunning-in-cino longer showShell command failed for patternin tool_results.