From 90ae151154bf5eefbeaeb0b05a13c8fe41bbb6ad Mon Sep 17 00:00:00 2001 From: Shadow Date: Fri, 15 May 2026 22:25:11 -0500 Subject: [PATCH] fix: prevent barnacle vetoing clawsweeper proof --- scripts/github/barnacle-auto-response.mjs | 17 +++++++++++++++++ test/scripts/barnacle-auto-response.test.ts | 20 ++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/scripts/github/barnacle-auto-response.mjs b/scripts/github/barnacle-auto-response.mjs index c11fb84a351..d96098d82e2 100644 --- a/scripts/github/barnacle-auto-response.mjs +++ b/scripts/github/barnacle-auto-response.mjs @@ -828,6 +828,16 @@ function isAutomationActor(context) { return isAutomationUser(context.payload.sender, context.actor ?? ""); } +function isClawSweeperProofSufficientLabelEvent(context) { + const senderLogin = context.payload.sender?.login ?? context.actor ?? ""; + return ( + context.payload.action === "labeled" && + context.payload.label?.name === PROOF_SUFFICIENT_LABEL && + isAutomationUser(context.payload.sender, senderLogin) && + /clawsweeper/i.test(senderLogin) + ); +} + function isGitHubAppPullRequestAuthor(pullRequest) { return isAutomationUser(pullRequest.user); } @@ -1075,6 +1085,13 @@ export async function runBarnacleAutoResponse({ github, context, core = console return; } + if (isClawSweeperProofSufficientLabelEvent(context)) { + core.info( + `Skipping PR auto-response checks for #${pullRequest.number} because ClawSweeper owns ${PROOF_SUFFICIENT_LABEL}.`, + ); + return; + } + if (isGitHubAppPullRequestAuthor(pullRequest)) { await removeLabels(github, context, pullRequest.number, [activePrLimitLabel], labelSet); core.info(`Skipping active PR limit for GitHub App-authored PR #${pullRequest.number}.`); diff --git a/test/scripts/barnacle-auto-response.test.ts b/test/scripts/barnacle-auto-response.test.ts index fc976ae9188..058555e2875 100644 --- a/test/scripts/barnacle-auto-response.test.ts +++ b/test/scripts/barnacle-auto-response.test.ts @@ -810,6 +810,26 @@ describe("barnacle-auto-response", () => { expect(calls.removeLabel).toEqual([]); }); + it("does not let Barnacle veto ClawSweeper's sufficient proof label add", async () => { + const { calls, github } = barnacleGithub([file("src/gateway/server.ts")]); + + await runBarnacleAutoResponse({ + github, + context: barnacleContext({}, [PROOF_SUFFICIENT_LABEL], { + action: "labeled", + label: { name: PROOF_SUFFICIENT_LABEL }, + sender: { login: "openclaw-clawsweeper[bot]", type: "Bot" }, + }), + core: { + info: () => undefined, + }, + }); + + expect(calls.removeLabel).toEqual([]); + expect(calls.addLabels).toEqual([]); + expect(calls.update).toEqual([]); + }); + it("actions manually applied candidate labels", async () => { const { calls, github } = barnacleGithub([file("extensions/example/openclaw.plugin.json")]);