From 51dccd43cc33c34eae823d931114ad16656d5397 Mon Sep 17 00:00:00 2001 From: wenshao Date: Sun, 26 Jul 2026 19:00:54 +0800 Subject: [PATCH] ci(autofix): number the status comment like every other round message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `effective_round` counts rounds already finished, and "Push and report" posts ROUND + 1 as the round it just performed. The status comment used the raw value, so the same round showed two numbers in one thread — observed on #7724 at 10:10 UTC: the report said "round 6/100" while the status said "AutoFix round 5 finished". Display ROUND + 1 in both status messages, guarded so a missing or non-numeric round degrades to the raw value instead of failing the step. --- .github/workflows/qwen-autofix.yml | 12 ++++++++++++ scripts/tests/qwen-autofix-workflow.test.js | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/.github/workflows/qwen-autofix.yml b/.github/workflows/qwen-autofix.yml index e87c9738a5c..e2aae4231e0 100644 --- a/.github/workflows/qwen-autofix.yml +++ b/.github/workflows/qwen-autofix.yml @@ -2966,6 +2966,12 @@ jobs: set -uo pipefail MARKER='' ROUND_DISPLAY="${EFFECTIVE_ROUND:-${ROUND}}" + # ROUND counts rounds already DONE; every other message numbers the + # round being performed (the report posts ROUND + 1). Match it, or + # the same round carries two different numbers in one thread. + if [[ "${ROUND_DISPLAY}" =~ ^[0-9]+$ ]]; then + ROUND_DISPLAY="$((ROUND_DISPLAY + 1))" + fi BODY="$(printf '%s\n\nšŸ”„ **AutoFix is working on this PR** — round %s/%s. [Watch live progress](%s); this round posts its report here when it finishes.\n\n
\näø­ę–‡čÆ“ę˜Ž\n\nšŸ”„ **AutoFix ę­£åœØå¤„ē†ę­¤ PR** —— 第 %s/%s 轮。[ęŸ„ēœ‹å®žę—¶čæ›åŗ¦](%s)ļ¼›ęœ¬č½®ē»“ęŸåŽä¼šåœØę­¤å‘åøƒęŠ„å‘Šć€‚\n\n
' \ "${MARKER}" "${ROUND_DISPLAY}" "${MAX_ROUNDS}" "${RUN_URL}" \ "${ROUND_DISPLAY}" "${MAX_ROUNDS}" "${RUN_URL}")" @@ -3747,6 +3753,12 @@ jobs: exit 0 fi ROUND_DISPLAY="${EFFECTIVE_ROUND:-${ROUND}}" + # ROUND counts rounds already DONE; every other message numbers the + # round being performed (the report posts ROUND + 1). Match it, or + # the same round carries two different numbers in one thread. + if [[ "${ROUND_DISPLAY}" =~ ^[0-9]+$ ]]; then + ROUND_DISPLAY="$((ROUND_DISPLAY + 1))" + fi # 'fixed'/'noop' are the two outcomes that published a round report; # anything else means the round stopped before publishing one. if [[ "${OUTCOME:-}" == 'fixed' || "${OUTCOME:-}" == 'noop' ]]; then diff --git a/scripts/tests/qwen-autofix-workflow.test.js b/scripts/tests/qwen-autofix-workflow.test.js index 730ce9864e5..bf4afc7ff16 100644 --- a/scripts/tests/qwen-autofix-workflow.test.js +++ b/scripts/tests/qwen-autofix-workflow.test.js @@ -4885,6 +4885,18 @@ describe('qwen-autofix workflow', () => { "STATUS_ID: '${{ steps.post_status.outputs.comment_id }}'", ); expect(finalizeStatusCommentStep).not.toContain('--paginate'); + // Both status messages number the round being PERFORMED, like every other + // message the loop posts. `effective_round` counts rounds already done and + // "Push and report" prints ROUND + 1, so using it raw made the status say + // "round 5 finished" in the same thread where the report said "round 6/100" + // — observed on #7724. Same round must not carry two numbers. + for (const statusStep of [ + postStatusCommentStep, + finalizeStatusCommentStep, + ]) { + expect(statusStep).toContain('ROUND_DISPLAY="$((ROUND_DISPLAY + 1))"'); + expect(statusStep).toContain('^[0-9]+$'); + } // Tells a round that published a report from one that died before it. expect(finalizeStatusCommentStep).toContain("== 'fixed'"); expect(finalizeStatusCommentStep).toContain(