From fdf8ffaf3cae3e3e37b3a06d07be00e1a6ee2841 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Wed, 29 Apr 2026 13:58:06 -0700 Subject: [PATCH] fix(ci): exempt automation PRs from Barnacle PR limit Treat ClawSweeper and Clownfish head refs as automation PRs for Barnacle's active-PR-limit close path, and cover the behavior with a regression test. --- .github/workflows/labeler.yml | 8 +++++--- scripts/github/barnacle-auto-response.mjs | 10 +++++++--- test/scripts/barnacle-auto-response.test.ts | 18 ++++++++++++------ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index fd8ec78ff8c..dbc38db73ec 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -375,10 +375,12 @@ jobs: return false; }; - const isClawsweeperPullRequest = - typeof headRefName === "string" && headRefName.startsWith("clawsweeper/"); + const automationPrHeadPrefixes = ["clawsweeper/", "clownfish/"]; + const isAutomationPullRequest = + typeof headRefName === "string" && + automationPrHeadPrefixes.some((prefix) => headRefName.startsWith(prefix)); - if ((await isPrivilegedAuthor()) || isClawsweeperPullRequest) { + if ((await isPrivilegedAuthor()) || isAutomationPullRequest) { if (labelNames.has(activePrLimitLabel)) { try { await github.rest.issues.removeLabel({ diff --git a/scripts/github/barnacle-auto-response.mjs b/scripts/github/barnacle-auto-response.mjs index 7273db8a201..0f8e40d526c 100644 --- a/scripts/github/barnacle-auto-response.mjs +++ b/scripts/github/barnacle-auto-response.mjs @@ -237,10 +237,14 @@ const candidateActionRules = [ ]; const normalizeLogin = (login) => login.toLowerCase(); +const automationPrHeadPrefixes = ["clawsweeper/", "clownfish/"]; -export function isClawsweeperPullRequest(pullRequest) { +export function isAutomationPullRequest(pullRequest) { const headRefName = pullRequest.headRefName ?? pullRequest.head?.ref ?? ""; - return typeof headRefName === "string" && headRefName.startsWith("clawsweeper/"); + return ( + typeof headRefName === "string" && + automationPrHeadPrefixes.some((prefix) => headRefName.startsWith(prefix)) + ); } export function extractIssueFormValue(body, field) { @@ -1031,7 +1035,7 @@ export async function runBarnacleAutoResponse({ github, context, core = console if (pullRequest && labelSet.has(activePrLimitOverrideLabel)) { labelSet.delete(activePrLimitLabel); } - if (pullRequest && isClawsweeperPullRequest(pullRequest)) { + if (pullRequest && isAutomationPullRequest(pullRequest)) { await removeLabels(github, context, pullRequest.number, [activePrLimitLabel], labelSet); } diff --git a/test/scripts/barnacle-auto-response.test.ts b/test/scripts/barnacle-auto-response.test.ts index d64e2202340..82379eff4bc 100644 --- a/test/scripts/barnacle-auto-response.test.ts +++ b/test/scripts/barnacle-auto-response.test.ts @@ -290,20 +290,26 @@ describe("barnacle-auto-response", () => { ); }); - it("does not close ClawSweeper PRs for the active PR limit", async () => { - for (const headRef of [ - { head: { ref: "clawsweeper/openclaw-openclaw-73880" } }, - { headRefName: "clawsweeper/openclaw-openclaw-73880" }, + it("does not close automation PRs for the active PR limit", async () => { + for (const automationPullRequest of [ + { head: { ref: "clawsweeper/openclaw-openclaw-73880" }, login: "app/openclaw-clawsweeper" }, + { headRefName: "clawsweeper/openclaw-openclaw-73880", login: "app/openclaw-clawsweeper" }, + { + head: { ref: "clownfish/ghcrawl-156993-autonomous-smoke" }, + login: "app/openclaw-clownfish", + }, + { headRefName: "clownfish/ghcrawl-156993-autonomous-smoke", login: "app/openclaw-clownfish" }, ]) { const { calls, github } = barnacleGithub([]); + const { login, ...pullRequest } = automationPullRequest; await runBarnacleAutoResponse({ github, context: barnacleContext( { - ...headRef, + ...pullRequest, user: { - login: "app/openclaw-clawsweeper", + login, }, }, ["r: too-many-prs"],