fix(ci): review comment poller deadlocked on its own run

The poller job set GITHUB_RUN_ID in env: to point at the CI run.
The Actions runner sets the GITHUB_* defaults itself and ignores
the override. Thus the poller read its own run id and watched
itself. Its own run stays in_progress while the poller runs, so
runs_all_completed() was never true. The comment froze at
'waiting for jobs to start' and the job burned its full 3000s
timeout on every PR.

Rename the variable to CI_RUN_ID. Also drop the GITHUB_REPOSITORY
override — it was a no-op for the same reason, and the runner
default already holds the correct value.
This commit is contained in:
ethernet
2026-08-10 12:52:53 -04:00
parent 7e04718ec3
commit d5ddd442d7
2 changed files with 15 additions and 7 deletions
+6 -3
View File
@@ -58,9 +58,12 @@ jobs:
- name: Run live comment poller
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
# The CI run to report on — not this run.
GITHUB_RUN_ID: ${{ github.event.workflow_run.id }}
# The CI run to report on — not this run. The name must not be
# GITHUB_RUN_ID: the runner sets the GITHUB_* defaults itself and
# ignores an env: override, so that name silently resolves to THIS
# run. The poller then watches itself, which stays in_progress for
# as long as the poller runs, and it waits out its whole timeout.
CI_RUN_ID: ${{ github.event.workflow_run.id }}
# Sibling runs for the same commit that the comment also covers,
# one workflow name per line (a name can contain a comma).
# The poller resolves each name to its runs through the API.
+9 -4
View File
@@ -12,8 +12,13 @@ The comment is identified by the ``<!-- hermes-ci-review-bot -->`` marker
previous comment from an earlier run.
This runs from ``.github/workflows/ci-review-comment.yml``, a separate
``workflow_run`` workflow. Thus ``GITHUB_RUN_ID`` names the CI run to report
on, not the run that contains this script. The poller reports on runs that
``workflow_run`` workflow. Thus ``CI_RUN_ID`` names the CI run to report
on, not the run that contains this script. (The variable cannot be
called ``GITHUB_RUN_ID``: the Actions runner sets the ``GITHUB_*``
defaults itself and ignores an ``env:`` override, so that name would
silently resolve to the poller's own run — which stays ``in_progress``
for as long as the poller runs, deadlocking it against itself.)
The poller reports on runs that
it does not belong to. This is also how it covers a workflow that CI does
not contain: ``WATCH_WORKFLOWS`` names sibling workflows that the same
commit triggered (the Docker image build). Their jobs join the comment.
@@ -721,7 +726,7 @@ def main() -> int:
token = os.environ.get("GITHUB_TOKEN", "")
repo = os.environ.get("GITHUB_REPOSITORY", "")
run_id = os.environ.get("GITHUB_RUN_ID", "")
run_id = os.environ.get("CI_RUN_ID", "")
pr_number = os.environ.get("PR_NUMBER", "")
run_url = os.environ.get("RUN_URL", "")
@@ -737,7 +742,7 @@ def main() -> int:
print("GITHUB_REPOSITORY is required", file=sys.stderr)
return 1
if not run_id:
print("GITHUB_RUN_ID is required", file=sys.stderr)
print("CI_RUN_ID is required", file=sys.stderr)
return 1
# Build commit info line from env vars (set by ci-review-comment.yml).