Skip to content

Add 7-day grace period for new Known Build Error issues - #55232

Merged
MichaelSimons merged 1 commit into
mainfrom
michaelsimons-stale-known-issue-grace-period
Jul 10, 2026
Merged

MichaelSimons merged 1 commit into
mainfrom
michaelsimons-stale-known-issue-grace-period

Conversation

@MichaelSimons

Copy link
Copy Markdown
Member

Summary

Adds a grace period to the stale-known-build-errors job in the stale workflow so that newly-opened Known Build Error issues aren't immediately marked stale before they've had time to accumulate any hits.

Problem

When a new KBE issue is opened, it naturally has 0 hits in the 1-month count. The stale workflow runs twice daily and would immediately label the issue as stale and post the warning comment — even though the issue was just created and hasn't had a chance to be matched against any builds yet.

This was observed in #55215, where the issue was marked stale on the same day it was opened.

Fix

Skip any issue whose created_at is less than 7 days ago (NEW_ISSUE_GRACE_DAYS). The resulting timeline for a new KBE with 0 hits:

  • Days 0–7: Grace period — completely ignored by stale logic
  • Day 7+: Gets labeled stale + warning comment
  • Day 14+: Auto-closed (7 days after stale label was applied)

Newly-opened KBE issues were immediately being marked stale because they
had 0 hits (not yet enough time to accumulate any). This adds a grace
period so the stale logic skips issues less than 7 days old.

Fixes behavior seen in #55215 where the issue was marked stale on the
same day it was opened.

Co-authored-by: Copilot App <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 13:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the stale-known-build-errors workflow logic to avoid prematurely staling newly-created “Known Build Error” (KBE) issues that haven’t had time to accumulate hit-count data.

Changes:

  • Introduces a 7-day grace period (NEW_ISSUE_GRACE_DAYS) for newly created KBE issues.
  • Skips applying stale logic (and associated warnings) to KBE issues created within the grace window.

Comment on lines +60 to +66
// Skip issues within the grace period so newly-opened KBEs
// aren't immediately marked stale before they can accumulate hits.
const issueAgeDays = (Date.now() - new Date(issue.created_at).getTime()) / MS_PER_DAY;
if (issueAgeDays < NEW_ISSUE_GRACE_DAYS) {
console.log(` #${issue.number}: skipping (created ${issueAgeDays.toFixed(1)} days ago, within ${NEW_ISSUE_GRACE_DAYS}-day grace period)`);
continue;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While true, I would rather keep the code simpler over supporting an edge case like this. Won't fix.

@lbussell lbussell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's review comment seems accurate - up to you whether you want to fix that or not.

@MichaelSimons
MichaelSimons merged commit 4c08478 into main Jul 10, 2026
33 checks passed
@MichaelSimons
MichaelSimons deleted the michaelsimons-stale-known-issue-grace-period branch July 10, 2026 16:16
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants