fix: prevent barnacle vetoing clawsweeper proof

This commit is contained in:
Shadow
2026-05-15 22:25:11 -05:00
parent 372a8e4d22
commit 90ae151154
2 changed files with 37 additions and 0 deletions

View File

@@ -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}.`);

View File

@@ -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")]);