From f258d1b9e896e2ed472f167102032b62f2261d1b Mon Sep 17 00:00:00 2001 From: "serhii.sakal" Date: Thu, 23 Apr 2026 10:29:01 -0400 Subject: [PATCH] fix: add explicit sort parameters to issues query in auto-close-duplicates The issues endpoint is called without sort parameters, defaulting to sort=created&direction=desc (newest first). Since the script filters for issues created more than 3 days ago, the first pages are full of recent issues that all get filtered out, wasting API calls. With the 20-page safety limit, older issues may never be reached in repos with high issue volume. Sort by created ascending so the oldest issues (most likely to pass the 3-day filter) appear on the first pages. Fixes #52407 Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/auto-close-duplicates.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/auto-close-duplicates.ts b/scripts/auto-close-duplicates.ts index 2ad3bd3112..43c02ae1fa 100644 --- a/scripts/auto-close-duplicates.ts +++ b/scripts/auto-close-duplicates.ts @@ -122,7 +122,7 @@ async function autoCloseDuplicates(): Promise { while (true) { const pageIssues: GitHubIssue[] = await githubRequest( - `/repos/${owner}/${repo}/issues?state=open&per_page=${perPage}&page=${page}`, + `/repos/${owner}/${repo}/issues?state=open&sort=created&direction=asc&per_page=${perPage}&page=${page}`, token );