diff --git a/scripts/github/barnacle-auto-response.mjs b/scripts/github/barnacle-auto-response.mjs index c4fcd47afc4..6d13644dbbf 100644 --- a/scripts/github/barnacle-auto-response.mjs +++ b/scripts/github/barnacle-auto-response.mjs @@ -238,6 +238,11 @@ const candidateActionRules = [ const normalizeLogin = (login) => login.toLowerCase(); +export function isClownfishPullRequest(pullRequest) { + const headRefName = pullRequest.headRefName ?? pullRequest.head?.ref ?? ""; + return typeof headRefName === "string" && headRefName.startsWith("clownfish/"); +} + export function extractIssueFormValue(body, field) { if (!body) { return ""; @@ -1026,6 +1031,9 @@ export async function runBarnacleAutoResponse({ github, context, core = console if (pullRequest && labelSet.has(activePrLimitOverrideLabel)) { labelSet.delete(activePrLimitLabel); } + if (pullRequest && isClownfishPullRequest(pullRequest)) { + await removeLabels(github, context, pullRequest.number, [activePrLimitLabel], labelSet); + } const rule = rules.find((item) => labelSet.has(item.label)); if (!rule) { diff --git a/test/scripts/barnacle-auto-response.test.ts b/test/scripts/barnacle-auto-response.test.ts index 5a331a0d7dd..d79d0d31cdd 100644 --- a/test/scripts/barnacle-auto-response.test.ts +++ b/test/scripts/barnacle-auto-response.test.ts @@ -290,6 +290,41 @@ describe("barnacle-auto-response", () => { ); }); + it("does not close clownfish PRs for the active PR limit", async () => { + for (const headRef of [ + { head: { ref: "clownfish/clawsweeper-openclaw-openclaw-73880" } }, + { headRefName: "clownfish/clawsweeper-openclaw-openclaw-73880" }, + ]) { + const { calls, github } = barnacleGithub([]); + + await runBarnacleAutoResponse({ + github, + context: barnacleContext( + { + ...headRef, + user: { + login: "app/openclaw-clownfish", + }, + }, + ["r: too-many-prs"], + ), + core: { + info: () => undefined, + }, + }); + + expect(calls.removeLabel).toContainEqual( + expect.objectContaining({ name: "r: too-many-prs" }), + ); + expect(calls.createComment).not.toContainEqual( + expect.objectContaining({ + body: expect.stringContaining("more than 10 active PRs"), + }), + ); + expect(calls.update).not.toContainEqual(expect.objectContaining({ state: "closed" })); + } + }); + it("still adds candidate labels to broad contributor PRs", async () => { const { calls, github } = barnacleGithub([ file("ui/src/app.ts"),