Repository navigation
running-in-ci: filter same-workflow checks in CI poller - #333
Merged
Merged
Conversation
A `tend-mention` session that pushes a commit or replies to an inline
review comment fires events that trigger a sibling `tend-mention` run on
the same PR. The handle job's concurrency group
(`tend-mention-handle-{PR#}`, `cancel-in-progress: false`) queues the
sibling behind the current run; if the poller waits for the sibling's
handle, the sibling waits for the current run to free the concurrency
lock — deadlock until the 15-min cap breaks it.
Run 24927643947 hit this on PR #328: 18 minutes / $1.16 for ~3 minutes
of productive work. Adding a same-workflow filter to the rollup poll
exits cleanly once non-sibling checks settle. For workflows with
`cancel-in-progress: true` (e.g. `tend-review`), the filter is a no-op —
older siblings are cancelled and not in IN_PROGRESS state.
tend-agent
commented
Apr 26, 2026
tend-agent
left a comment
Collaborator
Author
There was a problem hiding this comment.
The fix as written breaks the polling helper because the Bash-tool preprocessor rewrites != to \!= before bash parses the command — the very trap this skill warns about further down ("The same trap applies to jq and --jq filters with !="). I just confirmed it: running the new pending() from a Bash tool call (single-quoted heredoc, the works) yields jq: error: syntax error, unexpected INVALID_CHARACTER on every poll, then exits at the 15-min cap.
Replacing != $wf with == $wf | not matches the existing | test($own) | not style on the line above and avoids the rewrite entirely.
| | jq --arg own "/runs/$GITHUB_RUN_ID/" --arg wf "$GITHUB_WORKFLOW" ' | ||
| [.statusCheckRollup[] | ||
| | select((.detailsUrl // .targetUrl // "") | test($own) | not) | ||
| | select((.workflowName // "") != $wf) |
Collaborator
Author
There was a problem hiding this comment.
Suggested change
| | select((.workflowName // "") != $wf) | |
| | select((.workflowName // "") == $wf | not) |
2 tasks
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 CI-polling helper's exclusion filter so it also drops check runs whose
workflowNamematches$GITHUB_WORKFLOW. Without this, atend-mentionsession that pushes a commit or replies to an inline review comment ends up polling for its own queued sibling — a deadlock that only the 15-min cap breaks.Why
Run 24927643947 (
tend-mentionon PR #328) ran 18 minutes / $1.16 — about 4× the cost of an equivalent fix-and-reply session. The session log shows ~3 minutes of productive work followed by 15 minutes of polling that never converged, with the bot logging:The PENDING
handlejob belonged to a siblingtend-mentionrun 24927689625, triggered by the bot's own reply to the inline review comment viaPOST /pulls/{n}/comments/{id}/replies.tend-mention.yaml's handle job uses concurrency grouptend-mention-handle-{PR#}withcancel-in-progress: false, which queued the sibling behind the current run. Result: the sibling waited for the current run to finish; the current run's polling waited for the sibling'shandleto start — a guaranteed deadlock until the 15-min timer expired.Verified the chain:
tend-mention24927643947 started (review submission with inline comment).fd3f7a6and posted reply via the/repliesendpoint.tend-mention24927689625 created (pull_request_reviewevent, queued by concurrency group).cifor the new commit completed.tend-review24927685808 completed.handlejob.The sibling's
verifyjob (no concurrency) ran promptly and was COMPLETED by ~09:23, so it didn't gate polling. Only the queuedhandlejob did.tend-mention.yamlalready documents (lines ~17–28) that GitHub fires bothpull_request_reviewandpull_request_review_commentfor every newly-created inline comment, and the workflow correctly avoids the duplicate by not subscribing topull_request_review_comment.created. The remainingpull_request_review.submittedsubscription is the trigger for the sibling, and silencing that would drop legitimate user follow-up reviews. The proportionate fix is at the polling helper.Fix
Add a same-workflow filter to
pending()inplugins/tend-ci-runner/skills/running-in-ci/SKILL.md:with
$wf = $GITHUB_WORKFLOW. Same-workflow check runs are subject to concurrency rules (queueing forcancel-in-progress: falseworkflows liketend-mention, or cancelled-on-supersede forcancel-in-progress: trueworkflows liketend-review) and don't represent independent CI signals. Forcancel-in-progress: trueworkflows, the filter is a no-op — older siblings are cancelled and already not in IN_PROGRESS state. The fix is targeted to the deadlock case while remaining benign elsewhere.The accompanying comment block explains the failure mode in-place so a future reader doesn't re-derive it from the symptom.
Gate assessment
cancel-in-progress: false).jqfilter line + comment). Normal evidence bar; passes.Test plan
tend-mentionreplies to an inline review comment + polls CI on the same PR, the polling helper exits within 1–2 minutes after non-mention checks complete (rather than timing out at 15 min).