Compare commits

...

9 Commits

Author SHA1 Message Date
Chris Lloyd
a17040212c Add daily sweep to enforce issue lifecycle label timeouts
Introduce a simple, mechanical daily sweep that closes issues with
lifecycle labels past their timeout:

- needs-repro: 7 days
- needs-info: 7 days
- needs-votes: 30 days
- stale: 30 days

The sweep checks when the label was last applied via the events API,
and closes the issue if the timeout has elapsed. No AI, no comment
checking — if the label is still there past its timeout, close it.
Removing a label (by a triager, slash command, or future AI retriage)
is what prevents closure.

Each close message directs the reporter to open a new issue rather
than engaging with the closed one.

The script supports --dry-run for local testing:
  GITHUB_TOKEN=$(gh auth token) \
  GITHUB_REPOSITORY_OWNER=anthropics \
  GITHUB_REPOSITORY_NAME=claude-code \
  bun run scripts/sweep.ts --dry-run

## Test plan

Ran --dry-run against anthropics/claude-code. Correctly identified 3
issues past their timeouts (1 needs-repro at 12d, 2 needs-info at
14d and 26d). No false positives.
2026-02-11 22:34:23 -08:00
GitHub Actions
0a0135f687 chore: Update CHANGELOG.md 2026-02-11 16:20:54 +00:00
GitHub Actions
e74abe58ab chore: Update CHANGELOG.md 2026-02-11 16:07:18 +00:00
GitHub Actions
7a7bed74e3 chore: Update CHANGELOG.md 2026-02-11 15:54:36 +00:00
GitHub Actions
9b64827a25 chore: Update CHANGELOG.md 2026-02-11 09:49:08 +00:00
GitHub Actions
54f0b535b3 chore: Update CHANGELOG.md 2026-02-11 09:47:22 +00:00
GitHub Actions
675baffdb3 chore: Update CHANGELOG.md 2026-02-11 08:54:27 +00:00
GitHub Actions
bae169824d chore: Update CHANGELOG.md 2026-02-11 08:39:40 +00:00
GitHub Actions
0b641a77ce chore: Update CHANGELOG.md 2026-02-11 08:21:20 +00:00
3 changed files with 145 additions and 0 deletions

31
.github/workflows/sweep.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: "Daily Issue Sweep"
on:
schedule:
- cron: "0 10 * * *" # 2am Pacific
workflow_dispatch:
permissions:
issues: write
concurrency:
group: daily-issue-sweep
jobs:
sweep:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Enforce lifecycle timeouts
run: bun run scripts/sweep.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }}

View File

@@ -2,6 +2,14 @@
## 2.1.39
- Added guard against launching Claude Code inside another Claude Code session
- Fixed Agent Teams using wrong model identifier for Bedrock, Vertex, and Foundry customers
- Fixed a crash when MCP tools return image content during streaming
- Fixed /resume session previews showing raw XML tags instead of readable command names
- Improved model error messages for Bedrock/Vertex/Foundry users with fallback suggestions
- Fixed plugin browse showing misleading "Space to Toggle" hint for already-installed plugins
- Fixed hook blocking errors (exit code 2) not showing stderr to the user
- Added `speed` attribute to OTel events and trace spans for fast mode visibility
- Improved terminal rendering performance
- Fixed fatal errors being swallowed instead of displayed
- Fixed process hanging after session close

106
scripts/sweep.ts Normal file
View File

@@ -0,0 +1,106 @@
#!/usr/bin/env bun
// --
const NEW_ISSUE = "https://github.com/anthropics/claude-code/issues/new/choose";
const DRY_RUN = process.argv.includes("--dry-run");
const lifecycle = [
{ label: "needs-repro", days: 7 },
{ label: "needs-info", days: 7 },
{ label: "needs-votes", days: 30 },
{ label: "stale", days: 30 },
];
const closeMessages: Record<string, string> = {
"needs-repro": `Closing — we weren't able to get the reproduction steps needed to investigate.\n\nIf this is still a problem, please [open a new issue](${NEW_ISSUE}) with steps to reproduce.`,
"needs-info": `Closing — we didn't receive the information needed to move forward.\n\nIf this is still a problem, please [open a new issue](${NEW_ISSUE}) with the requested details.`,
"needs-votes": `Closing this feature request — it didn't get enough community support to prioritize.\n\nIf you'd still like to see this, please [open a new feature request](${NEW_ISSUE}) with more context about the use case.`,
stale: `Closing due to inactivity.\n\nIf this is still a problem, please [open a new issue](${NEW_ISSUE}) with up-to-date information.`,
};
// --
async function githubRequest<T>(
endpoint: string,
method = "GET",
body?: unknown
): Promise<T> {
const token = process.env.GITHUB_TOKEN;
if (!token) throw new Error("GITHUB_TOKEN required");
const response = await fetch(`https://api.github.com${endpoint}`, {
method,
headers: {
Authorization: `Bearer ${token}`,
Accept: "application/vnd.github.v3+json",
"User-Agent": "sweep",
...(body && { "Content-Type": "application/json" }),
},
...(body && { body: JSON.stringify(body) }),
});
if (!response.ok) {
if (response.status === 404) return {} as T;
const text = await response.text();
throw new Error(`GitHub API ${response.status}: ${text}`);
}
return response.json();
}
// --
async function main() {
const owner = process.env.GITHUB_REPOSITORY_OWNER;
const repo = process.env.GITHUB_REPOSITORY_NAME;
if (!owner || !repo)
throw new Error("GITHUB_REPOSITORY_OWNER and GITHUB_REPOSITORY_NAME required");
if (DRY_RUN) console.log("DRY RUN — no issues will be closed\n");
let closed = 0;
for (const { label, days } of lifecycle) {
const cutoff = new Date();
cutoff.setDate(cutoff.getDate() - days);
console.log(`\n=== ${label} (${days}d timeout) ===`);
for (let page = 1; page <= 10; page++) {
const issues = await githubRequest<any[]>(
`/repos/${owner}/${repo}/issues?state=open&labels=${label}&sort=updated&direction=asc&per_page=100&page=${page}`
);
if (issues.length === 0) break;
for (const issue of issues) {
if (issue.pull_request) continue;
const base = `/repos/${owner}/${repo}/issues/${issue.number}`;
const events = await githubRequest<any[]>(`${base}/events?per_page=100`);
const labeledAt = events
.filter((e) => e.event === "labeled" && e.label?.name === label)
.map((e) => new Date(e.created_at))
.pop();
if (!labeledAt || labeledAt > cutoff) 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}`);
} else {
await githubRequest(`${base}/comments`, "POST", { body: closeMessages[label] });
await githubRequest(base, "PATCH", { state: "closed", state_reason: "not_planned" });
console.log(`#${issue.number}: closed (${label})`);
}
closed++;
}
}
}
console.log(`\nDone: ${closed} ${DRY_RUN ? "would be closed" : "closed"}`);
}
main().catch(console.error);
export {};