From d5ddd442d75dcd839552bbf16140d4231c0fecb6 Mon Sep 17 00:00:00 2001 From: ethernet Date: Mon, 10 Aug 2026 12:52:53 -0400 Subject: [PATCH] fix(ci): review comment poller deadlocked on its own run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .github/workflows/ci-review-comment.yml | 9 ++++++--- scripts/ci/live_comment.py | 13 +++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-review-comment.yml b/.github/workflows/ci-review-comment.yml index c93d3c4447..216d0c05db 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 d94508d6d4..708906d3ae 100644 --- a/scripts/ci/live_comment.py +++ b/scripts/ci/live_comment.py @@ -12,8 +12,13 @@ The comment is identified by the ```` 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).