Repository navigation
fix(ci-runner): filter CI polling by run URL, not workflow name - #226
Conversation
The review skill hardcoded `grep -v "tend-review"` and the running-in-ci skill used `grep -v "$GITHUB_WORKFLOW"` to exclude the current workflow's own pending check. Both filters are structurally wrong: `gh pr checks` prints the job name, not the workflow name, so neither `"tend-review"` nor `$GITHUB_WORKFLOW` (which equals `"tend-review"`) matches the actual `review` check row. The filter keeps every line, the own-job row always reports `pending`, and the polling loop runs the full 10 iterations. Observed in worktrunk runs 24260154110 (PR #2062) and 24260939035 (PR #2063) this hour — both tend-review sessions timed out after 10 minutes, each logging "the filter didn't catch it" before recovering via manual per-check verification. Match on the run URL (`/runs/$GITHUB_RUN_ID/`) instead. Every GitHub Actions check row includes that URL, `$GITHUB_RUN_ID` is stable, and non-Actions checks (codecov, pre-commit.ci) pass through unchanged. Also incorporates #217's fix: replace `if \! cmd` with `cmd || {}`. The Bash tool escapes `\!` as `\\!`, so `if \!` always takes the else branch and the loop never short-circuits even when the filter is correct. Both fixes are required together — either alone leaves the loop stuck until the timeout. This PR supersedes #217. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…9977 # Conflicts: # plugins/tend-ci-runner/skills/review/SKILL.md # plugins/tend-ci-runner/skills/running-in-ci/SKILL.md
#234) ## Summary Every `/tend-ci-runner:review` invocation has been **silently broken** since PR #217 merged at 2026-04-10 20:07 UTC. PRs #225–#233 all received **zero reviews from the bot** — the review runs report `success` but the session artifacts show no assistant turn at all. This PR removes the poison and restores reviews. ## Root cause PR #217 (`fix(ci-runner): replace if-not polling loop with || to avoid bash escaping`) added an explanatory comment inside the CI-polling code block: ```markdown # Use `||` rather than `if \!` — the Bash tool escapes `\!` as `\\!`, which # prevents bash from recognizing the pipeline-negation reserved word... ``` Claude Code's slash-command preprocessor scans the loaded file for `` \!` `` (a prefix that means "execute the next backticked string as a shell command") **regardless of markdown code fences**. It found `` \!` `` inside `` `if \!` ``, consumed text through the next backtick, and ran `` — the Bash tool escapes ` `` as bash. The em-dash is not a command, so bash reported: ``` 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 <N>` session in this window produced the same 5-line trace — two internal `queue-operation` messages, the command caveat, the command invocation, the stderr — and then nothing. The model was never given instructions to follow. ## Evidence All tend-review sessions in the past hour's window ran this preprocessor and failed identically: | Run | PR | Branch | Session size | Review posted | |---|---|---|---|---| | 24261252532 | #224 | `review-runs-timeout-detection` | ~120 lines | ✅ APPROVED (ran **before** #217 merged at 20:07Z) | | 24262024783 | #225 | `tend-mention-dedup-review-events` | 5 lines | ❌ | | 24262028666 | #226 | `hourly/review-24261599977` | — | ❌ (checkout failure — infra race, separate issue) | | 24262305841 | #226 | `hourly/review-24261599977` | 5 lines | ❌ | | 24262406137 | #227 | `raise-job-timeouts` | 5 lines | ❌ | | 24262970448 | #228 | `mention-verify-paginate` | 5 lines | ❌ | | 24262987799 | #229 | `tend-claude-md-workflow-update-note` | 5 lines | ❌ | | 24263043865 | #230 | `raise-job-timeouts` | 5 lines | ❌ | | 24263117206 | #231 | `mention-review-inline-reply-prompt` | 5 lines | ❌ | | 24263177723 | #232 | `raise-job-timeouts` | 5 lines | ❌ | | 24263220447 | #233 | `tend-mention-dedup-review-events` | 5 lines | ❌ | Sample JSONL from run 24262987799 (PR #229): ```json {"type":"queue-operation"} {"type":"queue-operation"} {"type":"user","content":"<local-command-caveat>..."} {"type":"user","content":"<command-name>/review</command-name>\n<command-args>229</command-args>"} {"type":"user","content":"<local-command-stderr>Error: Shell command failed for pattern \"\!` — the Bash tool escapes `\": [stderr]\n/bin/bash: line 1: —: command not found</local-command-stderr>"} ``` No assistant turn. No Skill loads. No tool calls. No review. Confirmation via the target PRs: `gh pr view <N> --json reviews` returns `[]` for every one of PRs #225–#233. PR #224, reviewed before #217 landed, has the bot's APPROVED review. The same preprocessor error is also visible in the `tend-mention` run 24261917519 when it loaded `running-in-ci` via the Skill tool — there the error appeared as a tool_result and the model continued working, because skill-load failures are non-fatal. Only the top-level slash-command invocation is lethal. ## Gate assessment - **Evidence level**: Critical (wrong outcome — reviews 100% non-functional) - **Classification**: Structural (deterministic; every invocation fails the same way) - **Occurrences this run**: 9 (plus 1 non-fatal skill-load collision in tend-mention) - **Historical evidence**: N/A — this regression was introduced by #217 earlier today and has no prior tracking entries - **Change type**: Targeted fix (two-line comment rephrase in two files) - **Both gates**: pass ## Fix Rephrase the comments in `plugins/tend-ci-runner/skills/review/SKILL.md:294` and `plugins/tend-ci-runner/skills/running-in-ci/SKILL.md:142` to avoid any `` \!` `` sequence. The guidance content is unchanged: "Use `||` rather than `if`-based negation; the Bash tool escapes the exclamation mark to a literal backslash-exclamation." No `\!` now appears adjacent to a backtick anywhere in `plugins/`. `grep '\!\`' plugins/` after the fix returns zero matches. ## Test plan - [ ] A tend-review run on this PR completes with an assistant session longer than 5 lines and posts an actual review (self-approval blocked, but the bot must at least read the diff and comment) - [ ] `grep -r '\!\`' plugins/` returns no matches - [ ] `tend-mention` and `tend-notifications` skill loads of `running-in-ci` no longer show `Shell command failed for pattern` in tool_results 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: continuous-bot <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]>
|
@tend-agent resolve conflicts |
|
Merged |
tend-agent
left a comment
There was a problem hiding this comment.
The polling-filter fix itself is technically sound. I verified gh pr checks 226 on this PR's own data:
review pending 0 https://github.com/max-sixty/tend/actions/runs/24276481328/job/70891194230
lint pass 19s ...
test pass 7s ...
First column is the job name (review), not the workflow name (tend-review), so grep -v "tend-review" and grep -v "$GITHUB_WORKFLOW" both kept the own-job row and the loop deadlocked. Filtering on /runs/$GITHUB_RUN_ID/ correctly targets that row, and non-Actions checks (codecov, pre-commit.ci) use different URL hosts so they pass through.
Concern: unrelated content silently dropped in merge resolution
The merge commit 98e227d ("Merge remote-tracking branch 'origin/main' … # Conflicts: running-in-ci/SKILL.md") dropped four chunks from plugins/tend-ci-runner/skills/running-in-ci/SKILL.md that have nothing to do with the polling fix and are not mentioned in the PR title, description, or commit message. They are still present on main:
-
Triage skill loading instruction (between "auto-discovered." and "## Conduct"):
If you are going to propose a code fix for a bug, load `/tend-ci-runner:triage` first — it contains reproduction and testing gates that apply to all fix attempts, not just initial triage. -
"Review events with inline comments" bullet (in the "Replying to Comments" section, between the inline-review-comment bullet and the conversation-comments bullet):
- **Review events with inline comments** (review ID in prompt): A review may include inline comments. Fetch them by review ID and reply to each individually: ```bash gh api repos/{owner}/{repo}/pulls/{number}/reviews/{review_id}/comments \ --jq '.[] | {id: .id, path: .path, body: .body}'Reply to each comment using the inline review comment reply endpoint above.
-
Acknowledge-resolution guidance (in "Multi-way Conversations", before "If a maintainer has already addressed…"):
A comment that responds to concerns you raised in a review is directed at you — briefly acknowledge resolution or explain why concerns remain. -
Entire
## Self-conversation Guardsection (between "Multi-way Conversations" and "## Recheck Before Posting"):## Self-conversation Guard If you are responding to your own prior comment or review (not a human's reply to it), only respond if there is a distinct role boundary (e.g., you are the reviewer on your own PR and need to address review feedback). If there is no such role distinction, exit silently to avoid self-conversation loops.
These are all behavioral guardrails — particularly the self-conversation guard, which is load-bearing for self-authored review runs like this one. Pushing a fix to restore them now.
Note on PR description
The description says "This PR supersedes #217" but #217 is already merged. The two fixes coexist on main now; the wording is a leftover from drafting against an earlier base.
The merge commit 98e227d ("Merge remote-tracking branch 'origin/main' … # Conflicts: running-in-ci/SKILL.md") silently dropped four chunks unrelated to the polling-filter fix that motivated this PR. They were all present on main and remain technically correct guardrails: 1. The "load /tend-ci-runner:triage before proposing a code fix" instruction (between the repo-local skills paragraph and ## Conduct). 2. The "Review events with inline comments" bullet in the "Replying to Comments" section, including the pulls/{number}/reviews/{review_id}/comments fetch + reply pattern. 3. The "A comment that responds to concerns you raised in a review is directed at you" acknowledge-resolution line in the Multi-way Conversations section. 4. The entire ## Self-conversation Guard section, which is load-bearing for self-authored review runs like this one — without it the bot has no instruction to break out of replying to its own prior comments. Restoring all four leaves running-in-ci/SKILL.md identical to main except for the intended polling-loop replacement. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…onflict `git checkout --ours/--theirs <file>` replaces the entire file with one side's blob, silently dropping non-conflicting changes the other side already auto-merged in. The bot used this approach on #226 and quietly reverted four unrelated additions from main to running-in-ci/SKILL.md (the triage-loading instruction, the inline review-comment reply path, the multi-way ack line, and the entire Self-conversation Guard section). The loss was caught by a follow-up review run and restored in commit e2523da, but it would have shipped silently otherwise. Add a fourth bullet to "Merging Upstream into PR Branches" telling the bot to edit conflict markers in place (or use `git merge -X ours` at merge time, which is per-hunk and preserves auto-merged content). Co-Authored-By: Claude Opus 4.6 <[email protected]>
…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
…ression PR #226 (`fix(ci-runner): filter CI polling by run URL, not workflow name`) reintroduced the exact poisoned-text regression that PR #234 fixed. Its diff on plugins/tend-ci-runner/skills/review/SKILL.md and plugins/tend-ci-runner/skills/running-in-ci/SKILL.md reverted the CI-polling comment from the PR #234 wording back to the pre-#234 wording containing `` `if \!` ``, which the slash-command preprocessor scans and exec's as bash. Since #226 merged at 2026-04-11 15:01:22 UTC, every `/review` invocation has failed identically with the 5-line trace: queue/dequeue, command-caveat, command-name, local-command-stderr, then nothing. Three tend-review runs in this hour's window (PRs #240, #241, #242) all produced that exact trace and posted zero reviews. Rephrase the CI-polling comment in both files to avoid any `\!` adjacent to a backtick. The guidance is unchanged. Matches the wording that PR #234 already merged successfully — this is a straight restoration of that fix. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…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
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]>
Summary
The tend-review CI polling loop has been timing out after 10 minutes on every run, even when all required checks have actually passed. This PR fixes the root cause: the filter used to exclude the current workflow's own pending check was structurally wrong.
Root cause
Both skills try to filter the current workflow's check row out of
gh pr checksoutput. The review skill hardcodedgrep -v "tend-review"and running-in-ci usedgrep -v "$GITHUB_WORKFLOW". Both fail:gh pr checksprints the job name in the first column, not the workflow name.tend-reviewbut the single job is namedreview(seetend-review.yamljob idreview, noname:override).grep -v "tend-review"againstreview\tpending\t...\t.../runs/<id>/job/...matches no lines — the filter keeps the own-job row, the row ispending, and the loop never short-circuits.Verified structurally on live worktrunk data:
Observed impact (this hour)
Two tend-review runs on max-sixty/worktrunk timed out after the full 10-minute polling window:
tend-reviewbut the actual workflow name is justreview, so it didn't exclude it and timed out."reviewworkflow itself… the filter didn't catch it."Both runs recovered by manually polling individual test names, so PR outcomes were correct. But every tend-review session is wasting 10 minutes of compute on a broken polling loop.
The fix
Filter on the run URL (
/runs/$GITHUB_RUN_ID/) instead of the workflow or check name. Every GitHub Actions check row includes that URL,$GITHUB_RUN_IDis always set, and non-Actions checks (codecov, pre-commit.ci) have different URL hosts so they pass through unchanged.Also incorporates the
if \!→cmd || {}fix from #217. The Claude Bash tool escapes\!as\\!, soif \! cmdalways takes the else branch and the loop never short-circuits regardless of filter correctness. Verified in this session:Both fixes are required together — with a correct filter but broken
if \!, the loop still runs 10 iterations; with fixedif \!but a broken filter, the loop still runs 10 iterations. This PR supersedes #217 by combining both fixes.Gate assessment
tend-reviewworkflow check)Test plan
/runs/$GITHUB_RUN_ID/correctly matches only the current-run rowcmd || {}pattern works under Bash tool's\!escaping