spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

Fix sweep script crashing on locked issues (#25649)Browse files
The sweep job (https://github.com/anthropics/claude-code/actions/runs/21983111029/job/63510453226)
was silently failing when closeExpired tried to comment on a locked issue,
causing a 403 from the GitHub API.

Two issues:

1. closeExpired didn't skip locked issues like markStale already does.
   Adding the same `if (issue.locked) continue` guard fixes this.

2. The error was swallowed by `main().catch(console.error)` which logs
   to stderr but exits 0, so CI reported success despite the crash.
   Replaced the main() wrapper with top-level await so unhandled errors
   properly crash the process with a non-zero exit code.

## Test plan

YOLO
Chris Lloyd authored on Feb 13, 2026 · GitHub committed on Feb 13, 2026 parent b374a30 · commit edfb5437a4f9
1 changed file+9 -14compared with b374a30
Mscripts/sweep.ts
@@ -115,6 +115,7 @@
115115
116116 for (const issue of issues) {
117117 if (issue.pull_request) continue;
118+ if (issue.locked) continue;
118119 const base = `/repos/${owner}/${repo}/issues/${issue.number}`;
119120
120121 const events = await githubRequest<any[]>(`${base}/events?per_page=100`);
@@ -144,20 +145,14 @@
144145
145146 // --
146147
147-async function main() {
148- const owner = process.env.GITHUB_REPOSITORY_OWNER;
149- const repo = process.env.GITHUB_REPOSITORY_NAME;
150- if (!owner || !repo)
151- throw new Error("GITHUB_REPOSITORY_OWNER and GITHUB_REPOSITORY_NAME required");
148+const owner = process.env.GITHUB_REPOSITORY_OWNER;
149+const repo = process.env.GITHUB_REPOSITORY_NAME;
150+if (!owner || !repo)
151+ throw new Error("GITHUB_REPOSITORY_OWNER and GITHUB_REPOSITORY_NAME required");
152152
153- if (DRY_RUN) console.log("DRY RUN — no changes will be made\n");
153+if (DRY_RUN) console.log("DRY RUN — no changes will be made\n");
154154
155- const labeled = await markStale(owner, repo);
156- const closed = await closeExpired(owner, repo);
155+const labeled = await markStale(owner, repo);
156+const closed = await closeExpired(owner, repo);
157157
158- console.log(`\nDone: ${labeled} ${DRY_RUN ? "would be labeled" : "labeled"} stale, ${closed} ${DRY_RUN ? "would be closed" : "closed"}`);
159-}
160-
161-main().catch(console.error);
162-
163-export {};
158+console.log(`\nDone: ${labeled} ${DRY_RUN ? "would be labeled" : "labeled"} stale, ${closed} ${DRY_RUN ? "would be closed" : "closed"}`);