Skip to content

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.

TypeScript

Fix issues being auto-closed despite human activity (#26360)

Chris Lloyd1718a574950c
diff --git a/.github/workflows/claude-issue-triage.yml b/.github/workflows/claude-issue-triage.yml
index 95ed66f9..e86144d9 100644
--- a/.github/workflows/claude-issue-triage.yml
+++ b/.github/workflows/claude-issue-triage.yml
@@ -45,7 +45,7 @@ jobs:
ALLOWED LABELS — you may ONLY use labels from this list. Never invent new labels.
Type: bug, enhancement, question, documentation, duplicate, invalid
- Lifecycle: needs-repro, needs-info
+ Lifecycle: needs-repro, needs-info, stale, autoclose
Platform: platform:linux, platform:macos, platform:windows, platform:wsl, platform:ios, platform:android, platform:vscode, platform:intellij, platform:web, platform:aws-bedrock
API: api:bedrock, api:vertex
@@ -85,10 +85,12 @@ jobs:
**If EVENT is "issue_comment" (comment on existing issue):**
3. Evaluate lifecycle labels based on the full conversation:
+ - If the issue has `stale` or `autoclose`, remove the label — a new human comment means the issue is still active:
+ `gh issue edit ${{ github.event.issue.number }} --remove-label "stale" --remove-label "autoclose"`
- If the issue has `needs-repro` or `needs-info` and the missing information has now been provided, remove the label:
`gh issue edit ${{ github.event.issue.number }} --remove-label "needs-repro"`
- If the issue doesn't have lifecycle labels but clearly needs them (e.g., a maintainer asked for repro steps or more details), add the appropriate label.
- - Comments like "+1", "me too", "same here", or emoji reactions are NOT the missing information. Only remove labels when substantive details are actually provided.
+ - Comments like "+1", "me too", "same here", or emoji reactions are NOT the missing information. Only remove `needs-repro` or `needs-info` when substantive details are actually provided.
- Do NOT add or remove category labels (bug, enhancement, etc.) on comment events.
GUIDELINES:
diff --git a/scripts/sweep.ts b/scripts/sweep.ts
index 41d09ac3..4709290b 100644
--- a/scripts/sweep.ts
+++ b/scripts/sweep.ts
@@ -70,11 +70,8 @@ async function markStale(owner: string, repo: string) {
);
if (alreadyStale) continue;
- const isEnhancement = issue.labels?.some(
- (l: any) => l.name === "enhancement"
- );
const thumbsUp = issue.reactions?.["+1"] ?? 0;
- if (isEnhancement && thumbsUp >= STALE_UPVOTE_THRESHOLD) continue;
+ if (thumbsUp >= STALE_UPVOTE_THRESHOLD) continue;
const base = `/repos/${owner}/${repo}/issues/${issue.number}`;
@@ -109,6 +106,10 @@ async function closeExpired(owner: string, repo: string) {
for (const issue of issues) {
if (issue.pull_request) continue;
if (issue.locked) continue;
+
+ const thumbsUp = issue.reactions?.["+1"] ?? 0;
+ if (thumbsUp >= STALE_UPVOTE_THRESHOLD) continue;
+
const base = `/repos/${owner}/${repo}/issues/${issue.number}`;
const events = await githubRequest<any[]>(`${base}/events?per_page=100`);
@@ -120,6 +121,22 @@ async function closeExpired(owner: string, repo: string) {
if (!labeledAt || labeledAt > cutoff) continue;
+ // Skip if a non-bot user commented after the label was applied.
+ // The triage workflow should remove lifecycle labels on human
+ // activity, but check here too as a safety net.
+ const comments = await githubRequest<any[]>(
+ `${base}/comments?since=${labeledAt.toISOString()}&per_page=100`
+ );
+ const hasHumanComment = comments.some(
+ (c) => c.user && c.user.type !== "Bot"
+ );
+ if (hasHumanComment) {
+ console.log(
+ `#${issue.number}: skipping (human activity after ${label} label)`
+ );
+ continue;
+ }
+
if (DRY_RUN) {
const age = Math.floor((Date.now() - labeledAt.getTime()) / 86400000);
console.log(`#${issue.number}: would close (${label}, ${age}d old) — ${issue.title}`);