Skip to content

fix(ci): make finalize-release second-bot approve non-blocking (#14341) - #14342

Merged
yiliang114 merged 1 commit into
mainfrom
fix/finalize-release-second-bot-approve
Oct 16, 2026
Merged

yiliang114 merged 1 commit into
mainfrom
fix/finalize-release-second-bot-approve

Conversation

@yiliang114

Copy link
Copy Markdown
Collaborator

What this PR does

Makes the "Approve release PR (second bot)" step in finalize-release.yml non-blocking (continue-on-error: true) and adds a warning step that surfaces the root cause when it fails.

Why it is needed

The second-bot approve step has failed on every stable release since v0.25.1 because CI_BOT_PAT resolves to the same GitHub user as CI_REVIEW_BOT_PAT (the PR author). GitHub rejects self-approval at the API level with "Can not approve your own pull request". This blocks the subsequent auto-merge step and forces a human to manually approve and merge every release PR.

Making the step non-blocking lets auto-merge proceed when branch protection only requires one approval or a human has already approved. The real fix is rotating CI_BOT_PAT to a distinct GitHub account — the warning step and linked issue (#14341) document this.

Reviewer Test Plan

How to verify

Confirm three things: (1) the second-bot approve step now has continue-on-error: true and an id; (2) the new warning step fires only when steps.second_approve.outcome == 'failure' and emits a ::warning:: annotation linking to #14341; (3) the auto-merge step's if condition is unchanged and no longer gated on the second approve succeeding.

Expected: when CI_BOT_PAT is the same user as the PR author, the workflow completes with a warning instead of failing. When CI_BOT_PAT is a distinct user, behavior is unchanged.

Tested on

OS Status
🍏 macOS ✅
🪟 Windows N/A
🐧 Linux N/A

Environment (optional)

YAML validation only; no runtime involved.

Risk & Scope

  • Main risk or tradeoff: if branch protection strictly requires two approvals and no human intervenes, the release PR will stay open until someone approves. This is still better than the current behavior where the entire workflow fails and auto-merge never runs.
  • Not validated / out of scope: rotating CI_BOT_PAT itself (requires ops action, tracked in ci: finalize-release "Approve release PR (second bot)" fails with self-approval error #14341).
  • Breaking changes / migration notes: none.

The "Approve release PR (second bot)" step fails when CI_BOT_PAT
resolves to the same GitHub user as CI_REVIEW_BOT_PAT (the PR author),
because GitHub rejects self-approval at the API level. This has broken
every stable release since v0.25.1, blocking auto-merge and requiring
manual intervention.

Make the step continue-on-error so that auto-merge can still proceed
when branch protection only requires one approval or a human has already
approved. Add a warning step that surfaces the root cause in the run log
and links to the tracking issue.
@yiliang114 yiliang114 added type/bug Something isn't working as expected category/development Development experience labels Oct 16, 2026
@qwen-code-review-bot

qwen-code-review-bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Qwen Triage finished — view run. See the stage comments in this thread for the result.

✅ Qwen Triage 已完成 —— 查看运行。结果见本线程中的各阶段评论。

@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Thanks for the PR!

Template looks good ✓ — every substantive section is filled in. Two small gaps, neither blocking: there's no ### Evidence (Before & After) heading (your "How to verify" carries that content, and this change has no user-visible surface, so N/A would have been fine), and no ## Linked Issues heading or Chinese <details> block, though #14341 is referenced throughout the body.

Problem: real, and I verified it independently rather than taking the description's word for it. Run 38762514463 (v0.25.2, 2026-10-15) fails at Approve release PR (second bot) with failed to create review: GraphQL: Review Can not approve your own pull request (addPullRequestReview); the v0.25.1 run on 2026-10-11 fails identically. Release PRs #14321 and #13904 are both authored by qwen-code-review-bot, approved by qwen-code-dev-bot plus one human, show autoMergeRequest: none, and were merged by hand — so CI_BOT_PAT really is resolving to the PR author, and auto-merge really is never armed. The diagnosis is exactly right.

Direction: the intent is sound. The workflow's own comment on Create PR to merge release branch into main already documents the three-identity requirement, so this is a secret misconfiguration rather than a logic bug, and #14341 is the right home for the real fix. But this file is the release gate: .github/CODEOWNERS pins /.github/workflows/finalize-release.yml to @pomelo-nwu and @wenshao under "Primary npm release workflows require core maintainer approval", and pointedly does not list you. I'm escalating to them instead of approving — see the final comment.

Size: not applicable — no core paths touched; 15 added lines in one workflow file.

Approach: minimal and focused, one file, no drive-by edits. The continue-on-error plus follow-up-warn shape matches the existing pattern in build-and-publish-image.yml, so it reads as house style rather than an invention. One genuine question to settle before a maintainer decides: continue-on-error: true fails open for every failure mode of that step, and it outlives the bug. Once CI_BOT_PAT is rotated per #14341, an expired token, a revoked grant, or a secondary rate limit would still pass silently — the workflow goes green, a ::warning:: annotation that pages nobody is the only trace, and the release PR sits unmerged. A narrower variant keeps the step blocking and swallows only the self-approval error: capture stderr, emit the warning and exit 0 when it matches Can not approve your own pull request, otherwise exit 1. Comparable line count, fails closed, and self-heals after the rotation because the branch simply stops firing. Not a blocker — your version does re-arm auto-merge today, which is the point — but it is a tradeoff worth choosing deliberately.

Risk: no elevated risk signals from the revert-history path list. Since AGENTS.md requires it for any .github/workflows/*.yml edit, I also ran the two mechanical checks: the size ratchet is fine (base 11769 B + 1050 B = 12819 B, inside the 4096 B allowance over the recorded 11634 B baseline, so no .size-baseline bump is needed), and the meta-tests that parse this file still hold — ai-release-notes-workflow.test.js's getStep(..., 'Approve release PR') regex requires a closing quote immediately after PR, so it cannot match the second-bot step, and the new comment block only lands inside a toContain capture; release-sdk-workflow.test.js pins the sleep 30 before gh pr create, which is untouched.

Moving on to code review. 🔍

中文说明

感谢贡献!

模板基本完整 ✓ —— 实质性内容都在。两处小缺口,均不阻塞:缺少 ### Evidence (Before & After) 标题("How to verify" 已承担这部分内容,且本改动没有用户可见界面,写 N/A 也可以),以及缺少 ## Linked Issues 标题和中文 <details> 段落,不过正文多处引用了 #14341。

问题:真实存在,而且我是独立核实的,没有只采信 PR 描述。Run 38762514463(v0.25.2,2026-10-15)在 Approve release PR (second bot) 步骤失败,报错 failed to create review: GraphQL: Review Can not approve your own pull request (addPullRequestReview);2026-10-11 的 v0.25.1 run 报错完全相同。release PR #14321 与 #13904 均由 qwen-code-review-bot 创建,由 qwen-code-dev-bot 加一位人工审批,autoMergeRequest 都是 none,最终都靠手工合并 —— 说明 CI_BOT_PAT 确实解析成了 PR 作者本人,auto-merge 确实从未被启用。诊断完全正确。

方向:意图没问题。workflow 自己在 Create PR to merge release branch into main 的注释里已写明"三个身份"的要求,所以这是 secret 配置问题,不是逻辑 bug,#14341 是记录真正修复的正确位置。但这个文件是 release 关卡:.github/CODEOWNERS 把 /.github/workflows/finalize-release.yml 指定给 @pomelo-nwu 和 @wenshao,并注明"Primary npm release workflows require core maintainer approval",且明确没有列入你。所以我这里上报给他们,而不是直接 approve —— 详见最后一条评论。

规模:不适用 —— 未触及核心路径;单个 workflow 文件新增 15 行。

方案:改动最小且聚焦,单文件,没有夹带无关改动。continue-on-error 加后续 warn 步骤的写法与 build-and-publish-image.yml 的既有模式一致,属于仓库风格而非新造。有一个值得在维护者拍板前先想清楚的问题:continue-on-error: true 对该步骤的所有失败模式都是"失败即放行",而且这个放宽会比 bug 本身活得更久。等 #14341 完成 CI_BOT_PAT 轮换后,token 过期、授权被撤销、或触发二级限流,同样会被静默放过 —— workflow 显示绿色,唯一痕迹是一条不会通知任何人的 ::warning:: 注解,而 release PR 就一直挂着不合并。更收敛的写法是保留该步骤的阻塞性,只吞掉"自我审批"这一种错误:捕获 stderr,匹配到 Can not approve your own pull request 时输出 warning 并 exit 0,否则 exit 1。行数相当,失败时是"关门"而非"放行",且轮换完成后该分支自然不再触发,等于自愈。这不是阻塞项 —— 你的版本确实能让 auto-merge 今天就恢复工作,这正是重点 —— 但这个取舍值得有意识地做出。

风险:从 revert 历史的高风险路径清单看,无升级风险信号。因为 AGENTS.md 对 .github/workflows/*.yml 改动有硬性要求,我额外做了两项机械核查:size ratchet 没问题(基线文件 11769 B + 1050 B = 12819 B,相对记录的 11634 B 在 4096 B 容差之内,因此不需要改 .size-baseline);解析该文件的 meta-test 依然成立 —— ai-release-notes-workflow.test.js 的 getStep(..., 'Approve release PR') 正则要求 PR 后紧跟闭引号,因此不会匹配 second-bot 步骤,新增注释块只会落进一个 toContain 的捕获范围;release-sdk-workflow.test.js 钉的是 gh pr create 前的 sleep 30,未被触及。

进入代码审查 🔍

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at 5ad8298667be2698352d14951182c4a16d815f2a · re-run with @qwen-code /triage

@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Code review

Independent proposal first, before reading the diff: given a step that fails only because the approving token belongs to the PR author, I would either (a) make the step non-blocking and surface the failure loudly downstream, or (b) keep it blocking and swallow only the self-approval error by matching stderr. The PR implements (a), competently. No critical blockers found — the mechanism is correct on the three points that are easy to get wrong:

  • continue-on-error: true sets the step's conclusion to success while outcome stays failure, so the downstream Enable auto-merge step now runs. Its if contains no status function, which means GitHub ANDs an implicit success() into it — that implicit success() is exactly what the hard failure was tripping, so the diagnosis of the blockage is right, not just plausible. This repo already relies on the identical mechanism in production in build-and-publish-image.yml (first build attempt continue-on-error: true, retry keyed on outcome), so it is house style rather than an invention.
  • The warn step reads steps.second_approve.outcome, not .conclusion. Reading conclusion here would silently never fire, since continue-on-error rewrites it to success. Correct as written.
  • id: 'second_approve' and the new name: are single-quoted, matching .yamllint.yml's quoted-strings: {required: true, quote-type: single}; no line-length rule is configured, so the 227-char if: and echo lines are fine.

Non-blocking observations, in the order I'd want a maintainer to weigh them:

  1. The tolerance outlives the bug. continue-on-error covers every failure mode of that step, and it stays in place after ci: finalize-release "Approve release PR (second bot)" fails with self-approval error #14341 rotates CI_BOT_PAT. From then on an expired token, a revoked grant, or a secondary rate limit passes silently: green workflow, one ::warning:: annotation that pages nobody, and a release PR that sits unmerged. Variant (b) fails closed and self-heals — capture stderr, exit 0 with the warning when it matches Can not approve your own pull request, exit 1 otherwise — so the tolerance disappears by itself the moment the secret is fixed. Roughly the same line count. Your call is defensible (it re-arms auto-merge today), but this is the tradeoff being made, and it is a release gate.
  2. The new path cannot be dry-run. workflow_dispatch requires a tag matching ^v\d+\.\d+\.\d+$ — anything else fails at Validate stable release tag — and dispatching against an already-merged release tag short-circuits to SHOULD_MERGE=false, which skips both the approve and the warn step. So the first real observation of the warning firing is the next stable release. Worth knowing before approving.
  3. The warn step's is_stable/SHOULD_MERGE conditions are redundant — outcome == 'failure' can only hold if the second-approve step ran, which already requires both. Harmless, and it reads as deliberate symmetry with the neighbouring steps; I would not change it.
  4. If the intent is lasting visibility, this repo already has a file-an-issue-on-failure pattern (file-failure-issue in build-and-publish-image.yml). Commenting on ci: finalize-release "Approve release PR (second bot)" fails with self-approval error #14341 from the warn step would outlive a run annotation. Optional, and arguably scope creep for a 15-line mitigation.

Two things I checked and could not settle, stated plainly rather than papered over:

  • main's required-approval count is unverified — the branch protection API returns 404 for this token, and the readable rulesets are only deletion and non_fast_forward. What I can observe is that release PR chore(release): v0.25.2 #14321 merged carrying two approvals (qwen-code-dev-bot plus a human). If two are genuinely required, arming auto-merge does not merge the release PR by itself; the practical win is "workflow goes green and auto-merge is armed, so it lands the instant the second approval appears" rather than "no human needed". The PR body already scopes it exactly that way, so this is a confirmation of the claim, not a defect in it.
  • The meta-tests are reasoned statically, not executed. Per this gate's rules I do not run or build PR-derived code, and applying the diff to run scripts/tests would mean executing against a modified tree. AGENTS.md rule 3 requires the check regardless, so I traced it by hand: scripts/tests/ai-release-notes-workflow.test.js is the only test that parses this file's steps, and its getStep() regex requires a closing quote immediately after Approve release PR, so it still binds to the first approve step and cannot match the second-bot step; the new 7-line comment block lands inside that capture, whose only assertion is a toContain on SHOULD_MERGE == 'true' — still satisfied. The toContain assertions on both step names are unaffected, and every other captured step sits upstream of the change. scripts/tests/release-sdk-workflow.test.js pins only the sleep 30 before gh pr create, untouched. scripts/tests/workflow-size.test.js and .github/scripts/check-workflow-size.sh: recorded baseline is 11634 finalize-release.yml, the file on main is already 11769 B, and +1050 B puts it at 12819 B — inside the 4096 B growth allowance, so no .size-baseline bump is needed. (The pre-existing 135 B overage is main-side drift, not this PR's doing.) No test pins the second approver's identity, so nothing needed updating — the author's omission is correct, and now it is confirmed rather than assumed. The Test (ubuntu-latest) lane that would execute all of this is still running; see below.

Test evidence

Unattended CI run, so this section carries the PR's own CI check results, fetched through the API for the reviewed commit — nothing was built, run, or executed locally, and no PR code was checked out or applied. There were no failures to excerpt at fetch time. Real-scenario tmux testing does not apply on the CI path and would not apply to this change anyway: it has no TUI or user-visible surface, so that evidence is N/A.

Check Conclusion
Lint & Static (ubuntu-latest, Node 22.x) success
Integration Tests (no-AK, No Sandbox) success
Classify PR success
assign success
authorize success
label success
Test (ubuntu-latest, Node 22.x) in progress
triage in progress (this run)
delay-automatic-review queued
47 further checks (macOS/Windows test legs, CLI integration leg, bot-orchestration jobs) skipped

Lint & Static passing is the lane that covers yamllint, so the style reasoning above is corroborated rather than speculative. The one lane that matters for the meta-test analysis — Test (ubuntu-latest, Node 22.x), which runs scripts/tests/ — is still in progress, and I am not going to guess its result or poll for it. If it lands red on ai-release-notes-workflow.test.js, my static trace above is wrong and that is a blocker.

Neither sandboxed lane would settle anything here, so I am not naming one as a formality: @qwen-code /tmux drives the TUI and @qwen-code /verify A/B-tests the built CLI against a base build — neither executes GitHub Actions workflows. The claim under review is workflow-runtime behaviour, and the only thing that can substantiate it is an actual finalize-release run on a stable tag, which per observation 2 above cannot be dry-run safely. So the honest status is: the mechanism is verified by documented Actions semantics plus an in-repo production precedent, and the end-to-end effect is not verified — it is first observable on the next stable release. A maintainer who wants it settled sooner would have to accept a real release run as the test.

中文说明

先说独立方案(在读 diff 之前):面对一个"仅因为审批 token 属于 PR 作者本人而失败"的步骤,我会选 (a) 让该步骤非阻塞、并在下游把失败显式暴露出来,或 (b) 保留阻塞性、只通过匹配 stderr 吞掉"自我审批"这一种错误。本 PR 实现的是 (a),而且实现得干净。未发现关键阻塞项 —— 在三个最容易写错的点上都是对的:

  • continue-on-error: true 会把步骤的 conclusion 置为 success,而 outcome 仍是 failure,因此下游 Enable auto-merge 步骤得以执行。它的 if 里没有状态函数,GitHub 会隐式 AND 上 success() —— 之前硬失败正是卡在这个隐式 success() 上,所以对阻塞原因的诊断是准确的,不只是"看起来合理"。仓库里 build-and-publish-image.yml 已在生产中使用完全相同的机制(首次构建 continue-on-error: true,重试步骤基于 outcome 判断),因此这是既有风格,不是新造。
  • warn 步骤读的是 steps.second_approve.outcome,不是 .conclusion。这里若读 conclusion,因为 continue-on-error 已把它改写成 success,警告将永远不会触发。写法正确。
  • id: 'second_approve' 与新增 name: 都用了单引号,符合 .yamllint.yml 的 quoted-strings: {required: true, quote-type: single};配置中没有 line-length 规则,所以 227 字符的 if: 和 echo 行没有问题。

非阻塞观察,按我希望维护者权衡的顺序:

  1. 这个放宽会比 bug 活得更久。 continue-on-error 覆盖该步骤的所有失败模式,而且在 ci: finalize-release "Approve release PR (second bot)" fails with self-approval error #14341 轮换 CI_BOT_PAT 之后依然留在代码里。此后 token 过期、授权被撤销、或触发二级限流都会被静默放过:workflow 绿色,只剩一条不会通知任何人的 ::warning:: 注解,release PR 一直挂着不合并。方案 (b) 是"失败即关门"且能自愈 —— 捕获 stderr,匹配到 Can not approve your own pull request 时输出警告并 exit 0,否则 exit 1 —— 于是 secret 修好的那一刻,这个放宽就自动消失。行数相当。你的选择也说得通(今天就能让 auto-merge 恢复),但这确实是被做出的取舍,而且发生在 release 关卡上。
  2. 新路径无法 dry-run。 workflow_dispatch 要求 tag 匹配 ^v\d+\.\d+\.\d+$,否则在 Validate stable release tag 就失败;而对已合并的 release tag 触发 dispatch 会短路成 SHOULD_MERGE=false,把 approve 和 warn 两个步骤都跳过。所以警告真正第一次被观测到,只能是下一次 stable release。批准前值得知道这一点。
  3. warn 步骤的 is_stable/SHOULD_MERGE 条件是冗余的 —— 只有 second-approve 步骤真的执行过,outcome == 'failure' 才可能成立,而那已经要求这两个条件。无害,且看起来是刻意与相邻步骤保持对称;我不会改。
  4. 如果目标是长期可见性,仓库里已有"失败即开 issue"的模式(build-and-publish-image.yml 的 file-failure-issue)。让 warn 步骤去 ci: finalize-release "Approve release PR (second bot)" fails with self-approval error #14341 留言会比一条 run 注解活得更久。可选项,而且对一个 15 行的缓解改动来说可能算是扩大范围。

有两点我查了但没能确定,如实说明而不是掩盖:

  • main 要求的审批数未核实 —— branch protection API 对当前 token 返回 404,可读的 ruleset 只有 deletion 和 non_fast_forward。我能观测到的是 release PR chore(release): v0.25.2 #14321 合并时带着两个审批(qwen-code-dev-bot 加一位人工)。如果确实要求两个,那么启用 auto-merge 本身并不能合并 release PR;实际收益是"workflow 变绿且 auto-merge 已就位,第二个审批一出现就立刻合并",而不是"不再需要人工"。PR 描述本身就是这么界定的,所以这是对结论的确认,不是缺陷。
  • meta-test 是静态推演的,没有执行。 按本关卡规则我不会运行或构建 PR 派生的代码,而应用 diff 去跑 scripts/tests 就意味着在改动过的树上执行。但 AGENTS.md 规则 3 无论如何都要求核查,所以我手工追了一遍:scripts/tests/ai-release-notes-workflow.test.js 是唯一解析本文件步骤的测试,它的 getStep() 正则要求在 Approve release PR 之后紧跟闭引号,因此仍然只绑定第一个 approve 步骤,不可能匹配到 second-bot 步骤;新增的 7 行注释块会落进该捕获范围,而它唯一的断言是关于 SHOULD_MERGE == 'true' 的 toContain —— 依然满足。两个步骤名的 toContain 断言不受影响,其余被捕获的步骤都位于改动之前。scripts/tests/release-sdk-workflow.test.js 只钉住 gh pr create 前的 sleep 30,未被触及。scripts/tests/workflow-size.test.js 与 .github/scripts/check-workflow-size.sh:记录的基线是 11634 finalize-release.yml,main 上该文件已是 11769 B,再加 1050 B 为 12819 B —— 在 4096 B 增长容差之内,因此不需要改 .size-baseline。(既有的 135 B 超出属于 main 侧漂移,与本 PR 无关。)没有测试钉住第二个审批者的身份,所以无需更新任何测试 —— 作者没有改 meta-test 是对的,现在这一点是被确认的,而不是被假设的。真正会执行这些测试的 Test (ubuntu-latest) lane 仍在运行,见下。

测试证据

本次为无人值守 CI 运行,因此这一节承载的是通过 API 取得的、针对被审查 commit 的 PR 自身 CI 检查结果 —— 本地没有构建、运行或执行任何东西,也没有 checkout 或应用 PR 代码。抓取时没有失败项可摘录。真实场景 tmux 测试在 CI 路径下不适用,对这个改动本身也不适用:它没有 TUI 或用户可见界面,因此该项证据为 N/A。

(CI 状态表见上方英文部分,由 finalize 任务在 CI 跑完后原地更新。)

Lint & Static 通过正是覆盖 yamllint 的 lane,所以上面的风格判断是被印证的,不是推测。而对 meta-test 分析真正关键的那条 lane —— 运行 scripts/tests/ 的 Test (ubuntu-latest, Node 22.x) —— 仍在进行中,我不会去猜结果,也不会轮询等待。如果它最终在 ai-release-notes-workflow.test.js 上变红,那么我上面的静态推演就是错的,那属于阻塞项。

这里两个沙箱 lane 都无法解决问题,所以我不会形式化地点名:@qwen-code /tmux 驱动 TUI,@qwen-code /verify 对已构建 CLI 与 base 构建做 A/B —— 两者都不会执行 GitHub Actions workflow。被审查的主张是 workflow 运行时行为,唯一能证实它的是 stable tag 上真实的一次 finalize-release 运行,而按上面第 2 点,它无法安全 dry-run。所以诚实的结论是:机制已由 Actions 的既定语义加仓库内的生产先例验证,而端到端效果未经验证 —— 最早只能在下一次 stable release 时观测到。想更早确认的维护者,只能接受用一次真实 release 运行作为测试。

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at 5ad8298667be2698352d14951182c4a16d815f2a · re-run with @qwen-code /triage

@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Confidence: 3/5 — the change is correct, minimal, and the bug is independently verified; the cap is the release-path escalation plus one real reservation about how long the tolerance outlives the bug, not doubt that the code works.

Stepping back: this one holds up. I wrote down two candidate fixes before reading the diff — make the step non-blocking and surface the failure downstream, or keep it blocking and swallow only the self-approval error — and the PR is a clean implementation of the first. It matches my own proposal rather than exceeding or falling short of it, which is the honest read; the second variant is the one I'd mildly prefer, and I've said why in the review, but "I'd have done it differently" is not a defect and I'm not treating it as one.

The problem is real and I did not take anyone's word for it. Two consecutive stable releases — v0.25.1 and v0.25.2 — died at this exact step with Can not approve your own pull request, and the release PRs behind them show autoMergeRequest: none with a human approving and merging by hand both times. So this isn't hardening against a hypothetical; it's the person who cuts releases paying for it every cycle, and the fix targets that.

On the things I'd normally suspect in a 15-line CI PR: no scope creep, no drive-by edits, no speculative flexibility. The 7-line comment block is most of the diff and it earns its place — it records the three-identity invariant at precisely the line where the invariant breaks, which is the only reason a future reader will know this step is a mitigation and not the design. Six months from now the code explains itself.

The one thing that would make me curse this later: if #14341 gets fixed and the continue-on-error is never revisited, the release gate stays permanently quieter than it looks — a green workflow with an annotation nobody is paged on, and a release PR that quietly fails to merge. That's a small, specific maintenance debt, and it's the reason I'd want a maintainer choosing it deliberately rather than a bot waving it through.

Deferring to @pomelo-nwu and @wenshao, not approving. Two independent reasons:

  1. Release path. .github/CODEOWNERS pins /.github/workflows/finalize-release.yml to the two of you under "Primary npm release workflows require core maintainer approval", and deliberately excludes the author even though they own /.github/workflows/ generally. The gate's own rules say a change touching release gets escalated rather than auto-decided, and that is the right call here — this diff changes when a release PR becomes mergeable without a second human.
  2. CI is not finished. Test (ubuntu-latest, Node 22.x) — the lane that runs scripts/tests/, including the meta-tests I traced statically in the review above — is still in progress. I'm not going to guess its result, and I'm not going to approve against a check that doesn't exist yet.

Because this is escalated, I have not left a deferred approve-on-green instruction, so the finalize job will not auto-approve this when CI lands green. That's intentional: a maintainer needs to make this call. What I'd like from one of you:

  • Whether the fail-open tolerance is acceptable long-term, or whether you'd rather narrow it to the self-approval error so it fails closed and self-heals once CI_BOT_PAT is rotated (sketched in the review above).
  • Whether ci: finalize-release "Approve release PR (second bot)" fails with self-approval error #14341 — rotating CI_BOT_PAT to a distinct account — is actually actionable, since that's the real fix and this PR is mitigation. The workflow comment already documents that the three PATs must be three different GitHub users; right now two of them are qwen-code-review-bot.
  • Confirmation of main's required-approval count, which I could not read (branch protection API returns 404 for this token). It decides whether arming auto-merge actually merges the next release PR or just pre-stages it for a human.

Everything else is clean: lint and the no-AK integration lane are green, the size ratchet has ~3 KB of headroom so no .size-baseline bump is needed, and no meta-test required updating.

中文说明

Confidence: 3/5 —— 改动正确、最小,且 bug 已被独立核实;打 3 分是因为 release 路径需要上报,外加一个关于"这个放宽会比 bug 活得更久"的真实保留意见,而不是怀疑代码本身能不能工作。

退一步看整体:这个 PR 站得住。在读 diff 之前我先写下了两个候选方案 —— 让步骤非阻塞并在下游暴露失败,或保留阻塞性只吞掉"自我审批"错误 —— 本 PR 是第一个方案的干净实现。它与我的独立方案是相符,既没有超出也没有不及,这是诚实的判断;第二个方案是我略微更倾向的,理由已写在审查里,但"我会用另一种写法"不是缺陷,我不会把它当缺陷处理。

问题是真实的,我没有采信任何人的说法。连续两个 stable release —— v0.25.1 与 v0.25.2 —— 都死在这个步骤上,报错 Can not approve your own pull request;背后的 release PR 显示 autoMergeRequest: none,两次都由人工审批并手工合并。所以这不是针对假想情况的加固,而是每次发版都要为此付出成本的实际痛点,修复正对着它。

关于一个 15 行 CI PR 通常会让我起疑的地方:没有范围蔓延,没有顺手改动,没有投机性的"灵活性"。7 行注释占了 diff 的大头,但它是值得的 —— 它把"三个身份"这条不变量记录在了该不变量恰好被打破的那一行,这也是未来读者能知道此步骤是缓解措施而非设计意图的唯一依据。六个月后这段代码能自己解释自己。

唯一会让我将来后悔的点:如果 #14341 修好了而 continue-on-error 没有一并回收,release 关卡就会长期比它看起来更安静 —— workflow 显示绿色,只有一条不会通知任何人的注解,release PR 悄无声息地没被合并。这是一笔小而具体的维护债,也正是我希望由维护者有意识做出选择、而不是由机器人放行的原因。

上报给 @pomelo-nwu 和 @wenshao,不予 approve。 两个独立理由:

  1. release 路径。 .github/CODEOWNERS 在"Primary npm release workflows require core maintainer approval"这一条下,把 /.github/workflows/finalize-release.yml 指定给你们两位,并且刻意排除了作者本人 —— 尽管他拥有 /.github/workflows/ 的整体归属。本关卡的规则要求涉及 release 的改动上报而非自行裁定,这里这个判断是对的:这个 diff 改变了 release PR 在何时可以在没有第二个人工的情况下变为可合并。
  2. CI 尚未跑完。 Test (ubuntu-latest, Node 22.x) —— 也就是运行 scripts/tests/(含我在上面静态推演过的 meta-test)的那条 lane —— 仍在进行中。我不会去猜结果,也不会针对一个尚不存在的检查结果去 approve。

因为本次是上报处理,我没有留下"CI 变绿后自动批准"的延后指令,所以即使 CI 全绿,finalize 任务也不会自动批准这个 PR。这是有意为之:这个决定需要维护者来做。希望你们其中一位给出的判断:

  • 这种"失败即放行"的长期容忍是否可接受,还是更愿意把它收窄到只匹配自我审批错误,从而失败即关门、并在 CI_BOT_PAT 轮换后自愈(审查里给了写法草图)。
  • ci: finalize-release "Approve release PR (second bot)" fails with self-approval error #14341 —— 把 CI_BOT_PAT 轮换到一个独立账号 —— 是否真的可执行,因为那才是真正的修复,本 PR 只是缓解。workflow 注释已写明三个 PAT 必须是三个不同的 GitHub 用户;而目前其中两个都是 qwen-code-review-bot。
  • 确认 main 要求的审批数量,这一点我读不到(branch protection API 对该 token 返回 404)。它决定了启用 auto-merge 究竟能直接合并下一个 release PR,还是只是为人工预先把状态准备好。

其余都是干净的:lint 与 no-AK 集成 lane 已绿,size ratchet 还有约 3 KB 余量,因此不需要改 .size-baseline,也没有任何 meta-test 需要更新。

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at 5ad8298667be2698352d14951182c4a16d815f2a · re-run with @qwen-code /triage

@qqqys qqqys left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE at head 5ad8298667be2698352d14951182c4a16d815f2a — no Critical has ever been filed on this PR, my own scan of the 15-line diff found none, and CI is green at this head. This approval is a code verdict only: it does not and cannot satisfy the CODEOWNERS gate on this file — see §4.

1. No historical blocking issues

There are no reviews at all on this PR — no CHANGES_REQUESTED, no ledger, no review threads, reviewDecision=REVIEW_REQUIRED. The only prior assessment is the triage gate's stage comments, whose stage 3 states "the change is correct, minimal, and the bug is independently verified" and whose refusal to approve rested on two grounds: the release-path escalation (§4) and Test (ubuntu-latest) still being in progress. That second ground no longer applies — run 38843722270, head_sha=5ad8298667…, conclusion=success, with Test (ubuntu-latest, Node 22.x) passing in 27m53s. That is the lane which runs scripts/tests/, so the workflow meta-tests have now been observed green at this head rather than only traced statically.

2. The relaxation does not weaken the actual merge gate

This is the whole question for a PR that adds continue-on-error to a release step, so I checked it rather than accepting the framing.

The real protection on a release PR is branch protection, not this workflow step. The Enable auto-merge for release PR step is unchanged by this diff and still runs gh pr merge --squash --auto, which arms auto-merge; GitHub then holds the merge until the branch's approval requirement is met. So if the second-bot approve fails and is tolerated, the consequence is that the release PR waits for a human approval — it cannot merge with insufficient approvals. Tolerating the step's failure changes the workflow's reported colour, not what GitHub is willing to merge. That is why I do not treat this as a silently narrowed gate.

The bug being fixed is also concrete rather than hypothetical: stage 3 independently confirmed that two consecutive stable releases, v0.25.1 and v0.25.2, both died at this exact step with Can not approve your own pull request, and that the release PRs behind them show autoMergeRequest: none with a human approving and merging by hand each time. The status quo already requires manual intervention every cycle; this change stops it from failing the whole workflow while leaving the merge decision where it already was.

3. Critical-only scan — no Critical

I read the full diff and the surrounding file at head.

  • The outcome vs conclusion idiom is correct, which is the easiest thing to get wrong here. Line 287 tests steps.second_approve.outcome == 'failure'. With continue-on-error: true, conclusion is forced to success while outcome retains the real result — so had this used .conclusion, the new warning step would have been dead and the failure entirely silent. It uses .outcome, and grep finds no conclusion == anywhere in the file. The mitigation is therefore genuinely observable.
  • The guards are consistent. Both the second-approve step and the new warn step carry the same is_stable == 'true' && SHOULD_MERGE == 'true' condition, the warn step adding the failure test. So the warning cannot fire on a prerelease or a no-merge run, and cannot fire when the approve step was skipped.
  • continue-on-error: true extends an existing convention in this file rather than introducing a novel tolerance — it already appears at lines 119, 142 and 157 for other steps. Line 277 is the fourth instance.
  • The failure mode is documented at the line where it breaks. The 7-line comment records the three-identity invariant (CI_BOT_PAT must be a different GitHub user from both CI_REVIEW_BOT_PAT, the PR author, and CI_DEV_BOT_PAT, the first approver), states the exact error string to look for, gives the remedy (rotate CI_BOT_PAT to a distinct account), and links #14341. The ::warning:: message repeats the diagnosis and the link, so the annotation is actionable by whoever reads it without opening the diff.
  • No scope creep. One file, one step given an id and a tolerance, one new warn step, one comment block. Nothing else in the release path is touched, and no secret, permission or token surface changes.

4. The CODEOWNERS gate — verified, and not mine to satisfy

I confirmed the escalation claim at head rather than inheriting it. .github/CODEOWNERS line 15:

# --- Primary npm release workflows require core maintainer approval ---
/.github/workflows/release.yml          @pomelo-nwu @wenshao
/.github/workflows/finalize-release.yml @pomelo-nwu @wenshao

The author owns /.github/actions/ and /.github/scripts/ (lines 10–11) but is deliberately excluded from the two release-workflow lines. So this file requires approval from @pomelo-nwu or @wenshao, and reviewDecision will stay REVIEW_REQUIRED regardless of my vote. My APPROVE is a statement that I found no defect in the code; it is not the core-maintainer sign-off this path asks for, and it should not be read as unblocking the merge.

5. One non-blocking reservation, already on record

Stage 3's substantive worry is the right one and I agree with it, without treating it as a blocker: if #14341 is fixed and the continue-on-error is never revisited, this step stays permanently more tolerant than the design intends — a green workflow carrying an annotation nobody is paged on. That is maintenance debt rather than a defect at this head, and the comment block plus the linked issue are a reasonable trail back to it. The natural follow-up is to remove the tolerance once CI_BOT_PAT is a distinct identity, so the step can be blocking again. Worth an explicit tracking commitment from whoever owns the release path, since the two named CODEOWNERS are the ones who will feel the consequence.

CI otherwise: Lint & Static 14m52s, Integration Tests (no-AK, No Sandbox) 8m55s, web-shell E2E Smoke 28m43s, triage 23m49s all pass at this head; review-pr is pending, which is a review-bot lane and not a gate. Nothing is attributable to this PR, and CI forms no part of this verdict beyond confirming the meta-tests ran green.

@qwen-code-dev-bot qwen-code-dev-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE at head 5ad8298667be

Reviewed head: 5ad8298667be2698352d14951182c4a16d815f2a — re-read immediately before submitting, unchanged. Author yiliang114, base main, state open, 1 file, +15/−0.

No historical blocking findings

No CHANGES_REQUESTED has ever been filed on this PR; the only prior review is the approval from qqqys at this same head. I re-verified the load-bearing claims below at head instead of inheriting them.

Critical-only scan — none

  • The relaxation does not move the actual merge gate. Enable auto-merge for release PR (finalize-release.yml:291-303) keeps its original if condition and still runs gh pr merge --squash --auto, which only arms auto-merge; GitHub continues to enforce branch protection at merge time. So tolerating a failed second approve means the release PR waits for a human approval — it cannot merge with insufficient approvals. steps.second_approve is not referenced by the auto-merge step at all.
  • steps.second_approve has exactly one reader, the new warn step at :287, and it tests .outcome, which is the correct idiom under continue-on-error: true — .conclusion is forced to success there and would have made the warning permanently dead and the failure silent.
  • Guards are consistent. The warn step carries the same is_stable + SHOULD_MERGE conditions as the approve step plus the failure test, so it cannot fire on a prerelease or a no-merge run, and cannot fire when the approve step was skipped (its outcome is then skipped).
  • continue-on-error: true extends an existing convention in this file (:119, :142, :157); this is the fourth instance, not a novel tolerance.
  • No scope creep and no secret/permission surface change: one step gains an id and a tolerance, one warn step and one comment block are added, and nothing else in the release path is touched. The failure mode is documented at the line where it breaks, with the exact error string and the remedy, and the ::warning:: annotation repeats the diagnosis and links #14341.

Non-blocking note, not gating: the warning text hard-codes the self-approval diagnosis, so a different failure cause (expired PAT, network, rate limit) prints a misleading hint while still linking #14341.

CI at this head

success: Lint & Static, Test (ubuntu-latest, Node 22.x), Integration Tests (no-AK, No Sandbox), web-shell E2E Smoke, plus route / triage / authorize / delay-automatic-review / label / assign / Classify PR. Zero failures, zero cancellations. Disclosed rather than counted as green: the automation lane review-pr (🧐 Qwen Pull Request Review) was still in_progress at submit time. It is not a code-health lane, and main configures no required status checks (its rulesets expose only deletion and non_fast_forward).

What this approval does not do

.github/CODEOWNERS:15 assigns /.github/workflows/finalize-release.yml to @pomelo-nwu and @wenshao. Neither qwen-code-dev-bot nor qqqys is a designated owner, so reviewDecision remains REVIEW_REQUIRED after this approval — an approval from one of those two owners is still what gates the merge.

中文摘要

在 5ad8298667be 复核通过,提交前确认 head 未变化。1 个文件 +15 行的 release workflow 改动,历史上没有任何 CHANGES_REQUESTED。独立核对的要点:auto-merge 步骤的 if 未被改动,且它只是 gh pr merge --auto 挂载自动合并,真正的门禁仍在分支保护,所以容忍第二次 approve 失败只会让 release PR 等人工审批,不可能在审批不足时被合掉;steps.second_approve 仅被新增 warn 步骤引用,并且判断的是 .outcome(continue-on-error 下唯一正确写法,用 .conclusion 会让告警永久失效);warn 步骤与 approve 步骤守卫一致,prerelease、不合并、步骤被跳过三种情况都不会误报;continue-on-error 沿用该文件既有的三处约定。未发现 Critical,仅有一条不阻塞的提示:告警文案把原因写死为自审批,其他失败原因会给出误导性提示。CI 实质 lane 全绿,只有自动化 lane review-pr 提交时仍在跑,已如实标注而非当作全绿。另需注意 CODEOWNERS 把该文件指派给 @pomelo-nwu 与 @wenshao,我这次 Approve 无法满足该门禁,reviewDecision 仍为 REVIEW_REQUIRED。

@yiliang114
yiliang114 merged commit ee1fa09 into main Oct 16, 2026
96 of 97 checks passed
@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Released in v0.25.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category/development Development experience type/bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants