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(