Skip to content

The agent that grows with you

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

ethernetd5ddd442d75d
diff --git a/.github/workflows/ci-review-comment.yml b/.github/workflows/ci-review-comment.yml
index c93d3c44475..216d0c05dbd 100644
--- a/.github/workflows/ci-review-comment.yml
+++ b/.github/workflows/ci-review-comment.yml
@@ -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.
diff --git a/scripts/ci/live_comment.py b/scripts/ci/live_comment.py
index d94508d6d49..708906d3ae6 100644
--- a/scripts/ci/live_comment.py
+++ b/scripts/ci/live_comment.py
@@ -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).