From a40fcf00c3b5a74b567e15dd16a1fdd4b864afb6 Mon Sep 17 00:00:00 2001 From: boomzero Date: Tue, 6 Oct 2026 13:17:12 +0800 Subject: [PATCH 1/2] Never bump the version on a PR edit UpdateVersion also runs on edited events, and AI reviewers (cubic, Sourcery) edit PR descriptions on the author's behalf, so the [bot] actor guard does not catch them. On #1057 such an edit bumped the manual 4.0.0 to 4.0.1 minutes after the PR was opened; the same path explains the prerelease-only 3.0.0. An edit now only refreshes this PR's own latest entry and otherwise exits. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01E5dr7XTsCeoamqLSiT9rLp --- Update/UpdateVersion.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Update/UpdateVersion.js b/Update/UpdateVersion.js index 1b5ff2e3..810d341c 100644 --- a/Update/UpdateVersion.js +++ b/Update/UpdateVersion.js @@ -79,6 +79,12 @@ function extractReleaseNotes(body) { return match ? match[1].trim() : ""; } var CurrentNotes = extractReleaseNotes(String(process.argv[5] || "")); +// Editing a PR (including AI reviewers adding summaries on the author's behalf) must never bump the version; +// it may only refresh this PR's own entry. Versions are bumped on opened/synchronize runs. +if (eventAction === "edited" && !(LastPR == CurrentPR && NpmVersion == LastJSVersion)) { + console.log("PR edited, but the latest version entry is not this PR's. Not bumping the version."); + process.exit(0); +} if (LastJSVersion != NpmVersion) { console.warn("Assuming you manually ran npm version."); } else if (!(LastPR == CurrentPR && NpmVersion == LastJSVersion)) { From 6b1612cf1f60f4b50c9dedb5a5f7519df2489d82 Mon Sep 17 00:00:00 2001 From: Zhu Chenrui Date: Tue, 6 Oct 2026 14:31:57 +0800 Subject: [PATCH 2/2] Update Update/UpdateVersion.js Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Signed-off-by: Zhu Chenrui --- Update/UpdateVersion.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Update/UpdateVersion.js b/Update/UpdateVersion.js index 810d341c..c44748eb 100644 --- a/Update/UpdateVersion.js +++ b/Update/UpdateVersion.js @@ -81,9 +81,15 @@ function extractReleaseNotes(body) { var CurrentNotes = extractReleaseNotes(String(process.argv[5] || "")); // Editing a PR (including AI reviewers adding summaries on the author's behalf) must never bump the version; // it may only refresh this PR's own entry. Versions are bumped on opened/synchronize runs. -if (eventAction === "edited" && !(LastPR == CurrentPR && NpmVersion == LastJSVersion)) { - console.log("PR edited, but the latest version entry is not this PR's. Not bumping the version."); - process.exit(0); +if (eventAction === "edited") { + if (LastPR != CurrentPR) { + console.log("PR edited, but the latest version entry is not this PR's. Not bumping the version."); + process.exit(0); + } + if (NpmVersion != LastJSVersion) { + console.warn("PR edited and owns the latest entry, but package.json and XMOJ.user.js are out of sync; skipping the metadata refresh."); + process.exit(0); + } } if (LastJSVersion != NpmVersion) { console.warn("Assuming you manually ran npm version.");