nodejs / nodejs/node-core-utils

checkGitHubCI blocks indefinitely on orphaned check suites stuck in QUEUED

未关闭
#1,160 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
JavaScript
星标
313
派生
137
平均合并
2 天 8 小时
30 天内合并 PR
24

描述

Problem

checkGitHubCI() in pr_checker.js blocks landing with ✘ GitHub CI is still running when any GitHub Actions check suite has status !== 'COMPLETED'. However, GitHub occasionally creates check suites that remain stuck in QUEUED status with 0 check runs indefinitely — they are never dispatched and will never complete.

This has blocked at least two recent PRs on nodejs/node:

  • #64991Test macOS suite stuck 3+ days, landed manually
  • #64830 — same Test macOS suite stuck, landed manually

In both cases, the orphaned suite:

  • Has status: QUEUED, conclusion: null
  • Has 0 check runs (never started executing)
  • Has a valid workflowRun (Test macOS, workflow ID 858952)
  • Was created at the same time as sibling suites that completed fine
  • Never gets re-triggered by request-ci because GitHub sees it as already "queued"
  • The only workaround is a collaborator manually running git node land --yes

The commit-queue.sh pre-check (gh pr checks | grep pending) passes fine because it evaluates individual check runs (all completed), not suite containers.

Data

PR #64991, SHA 94a47d6f15b2:

  • 25 GitHub Actions suites total
  • 24 completed (success/skipped)
  • 1 orphaned: suite 84102428609, Test macOS, QUEUED, 0 check runs, created 2026-08-05T13:19:48Z

No newer run of Test macOS exists for this SHA — request-ci does not re-trigger a workflow GitHub considers already "queued."

Proposed fix

Consider a suite as orphaned and skip it if:

  • status !== 'COMPLETED'
  • checkRuns.nodes.length === 0 (nothing has ever executed inside it)
  • Suite age exceeds a configurable threshold (suggesting 3 hours since createdAt — legitimate suites dispatch runs within seconds)
if (status !== 'COMPLETED') {
  const runCount = checkRuns?.nodes?.length ?? 0;
  const ageMs = Date.now() - new Date(createdAt).getTime();
  if (runCount === 0 && ageMs > ORPHANED_SUITE_TIMEOUT) {
    cli.warn(`Ignoring orphaned check suite with no runs (status: ${status}, age: ${Math.round(ageMs / 3600000)}h)`);
    continue;
  }
  pendingJobs.push({ app: app.slug, status, conclusion });
  continue;
}

GraphQL change: add createdAt to the checkSuites query in PRCommits.gql.

Trade-offs

What this fixes: Orphaned suites no longer block the commit queue forever.

Risk: If someone adds commit-queue before request-ci has finished triggering all workflows, a suite that should have run but hasn't started yet (0 runs, within the threshold) could age past the timeout and get skipped — landing the PR without that test suite's results.

However, the current workaround (git node land --yes) already bypasses ALL checks — including real failures. A targeted skip of empty aged-out suites is strictly safer than the current manual workaround.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 pr_checker.js 中的 checkGitHubCI() 开始,检查 PRCommits.gql 中的 checkSuites 查询,然后将其 suite 数据与 commit-queue.sh 的预检查行为进行比较。定义并验证可配置的年龄阈值,使空的、已过期的 QUEUED suite 不再阻止 landing,同时活动中的 suite 仍保持待处理状态;确认警告会标识出被跳过的孤立 suite。

由索引模型根据 Issue 内容生成。

评估

技术栈
github-actions, graphql, javascript
领域
ci-cd, cli
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。