OPT108 — Comment Filter Runs After the Runner Starts
Anti-pattern: A workflow triggered by issue_comment or
pull_request_review_comment provisions a runner for every comment, then a
step-level condition or early return rejects comments whose body or author does
not match. Rejected comments still pay runner startup and job setup.
Detection heuristic: Find a comment-triggered job whose steps filter on the
comment body or author but whose job-level if: does not carry that admission
condition. Require the step-level filter or explicit early return; a workflow
that intentionally processes every comment is not a finding. Confirm the cost
with the share and compute of short successful runs before sizing it.
Fix recipe (safest first):
- Copy the handler's existing rejection condition to the job-level
if:so GitHub skips the job before allocating a runner. - Preserve every accepted command, custom command override, author class and event type. Keep the in-handler check as a defence-in-depth guard until the workflow fixture proves the two conditions agree.
- Exercise accepted and rejected comments against the real job condition, including multiline input and automation-authored comments where relevant.
Sizing: Runner-minute effect is a saving: the affected jobs' measured
billed compute on rejected comments. From the sampled run list, a successful
issue_comment or pull_request_review_comment run that finished in under 30
seconds counts as a rejected comment. The saving is that share of the sampled
runs, times the workflow's 30-day run volume, times those runs' mean billed
minutes for the affected jobs (each job rounded up to the minute), capped at
those jobs' measured billed compute over the same volume. A job's minutes are
credited only once across findings. YAML job ids resolve through the workflow
job graph to API display names; a known skip contributes zero to the mean, while
an unreadable affected-job timing is excluded. If no affected job identity can
be resolved in the sampled job lists, the finding stays unsized rather than
treating the unresolved job as a known skip. At least 3 short runs must be priced.
When runs were not collected, the run list could not be read, or no successful
comment run finished under 30 seconds, the finding stays unsized and says why.
There is no wall-clock effect on the pull-request path: comment runs do not
gate a merge.
Public evidence: OpenClaw pull request #149664 moved existing comment admission rules to job-level conditions so ignored comments no longer acquired hosted runners, while preserving accepted commands and meaningful automation events.
Risk: MEDIUM. Moving a condition earlier can suppress a command or actor that the handler previously accepted. Preserve the handler's exact semantics and prove both accepted and rejected cases before removing its inner guard.