From 4efc5c06f796c4a74b7c58c67a5526c996337eda Mon Sep 17 00:00:00 2001 From: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com> Date: Fri, 14 Aug 2026 23:35:06 -0400 Subject: [PATCH] Measure stale unmarking from the stale window, not just the label date The unmark check asked whether there was activity since the stale label was applied, while the marking check asked whether there was activity in the last 90 days. When the label was older than the window both could be true at once, so an item was unmarked one night and marked again the next, posting a fresh stale comment each time. This happened to esphome/esphome#10867: labelled in December, commented on six days later, then closed and locked. Reopening it in August let the January comment clear the label, and the next run marked it stale again because that comment was long outside the 90 day window. Measure from whichever of the label date and the stale cutoff is later, so activity that is itself stale can no longer clear the label. --- .github/workflows/stale.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index d868630..43a4764 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -228,7 +228,11 @@ jobs: continue; } - if (await hasRealActivitySince(item, labeledAt)) { + // Measure from whichever is later, so activity that is + // itself older than the stale window cannot clear the label + // on an item that was marked long ago. + const since = labeledAt > staleCutoff ? labeledAt : staleCutoff; + if (await hasRealActivitySince(item, since)) { const kind = isPr ? 'PR' : 'issue'; console.log(`Unmarking ${kind} #${item.number}: real activity since it was marked stale`); if (!DRY_RUN) {