From fdb059cfed9424bc8acc0906b269152e6072eac8 Mon Sep 17 00:00:00 2001 From: bherbruck Date: Thu, 15 Oct 2026 23:57:15 -0400 Subject: [PATCH] Claim bot: let me /unclaim my own issues (#1595) An explicit /unclaim from the owner releases an owner-assigned issue; the sweep still never touches them. --- scripts/claim/claim.js | 4 ++-- scripts/claim/claim.test.js | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/claim/claim.js b/scripts/claim/claim.js index f3cf632a..8cfd1955 100644 --- a/scripts/claim/claim.js +++ b/scripts/claim/claim.js @@ -223,8 +223,8 @@ async function unclaim(github, context) { await react(github, context, '+1'); // nothing to release return; } - if (assignees.includes(context.repo.owner)) { - await react(github, context, 'eyes'); // never touched by the bot + if (assignees.includes(context.repo.owner) && user !== context.repo.owner) { + await react(github, context, 'eyes'); // only the owner releases their own issues return; } const allowed = assignees.includes(user) || (await isMaintainer(github, context, user)); diff --git a/scripts/claim/claim.test.js b/scripts/claim/claim.test.js index c61da8a1..f2fe47df 100644 --- a/scripts/claim/claim.test.js +++ b/scripts/claim/claim.test.js @@ -170,10 +170,13 @@ test('unclaim by a maintainer releases, by a stranger does not', async () => { assert.equal(find(w.calls, 'react')[1].content, 'eyes'); }); -test('unclaim never touches an issue assigned to the owner', async () => { - const { github, calls } = fake(); - await claim.handleComment({ github, context: ctx('/unclaim', { user: 'bherbruck', assignees: ['bherbruck'], labels: ['in progress'] }), now: NOW }); - assert.equal(find(calls, 'removeLabel'), undefined); +test('unclaim on an owner-assigned issue works only for the owner', async () => { + let w = fake(); + await claim.handleComment({ github: w.github, context: ctx('/unclaim', { user: 'carol', assignees: ['bherbruck'], labels: ['in progress'] }), now: NOW }); + assert.equal(find(w.calls, 'removeLabel'), undefined); + w = fake(); + await claim.handleComment({ github: w.github, context: ctx('/unclaim', { user: 'bherbruck', assignees: ['bherbruck'], labels: ['in progress'] }), now: NOW }); + assert.ok(find(w.calls, 'removeLabel')); }); const issue = (number, assignees = ['bob']) => ({