## Description

This PR addresses systemic visibility gaps and backlog growth by uncapping metric reporting and accelerating the issue lifecycle.

### Key Changes

1.  **Metric Uncapping**: Refactored `bottlenecks.ts` and `priority_distribution.ts` to use GraphQL Search `totalCount`. This bypasses the previous 1000-issue cap, providing accurate visibility into the true scale of the 2062-issue backlog and 540+ zombie issues.
2.  **Lifecycle Acceleration**: Lowered `STALE_DAYS` to 30 and `CLOSE_DAYS`/`NO_RESPONSE_DAYS` to 7 in `gemini-lifecycle-manager.cjs`. This move is necessary to clear the aging backlog and address the spike in zombie issues (issues inactive for >30d).
3.  **CI Cost Optimization**: Restricted the Mac CI matrix to Node 20.x for all events. Since Linux runners already provide coverage for Node 22.x and 24.x, this change significantly reduces spend on expensive Mac runners without compromising quality.

### Impact

- **Accuracy**: Metrics now reflect the full repository state rather than a 1000-item sample.
- **Productivity**: Faster issue rotation will help maintainers focus on active community needs.
- **Efficiency**: Estimated ~30% reduction in Actions spend by optimizing the Mac test matrix.
This commit is contained in:
gemini-cli[bot]
2026-05-06 21:37:44 +00:00
parent 7191d71711
commit 4dde5ac077
4 changed files with 68 additions and 148 deletions
@@ -7,92 +7,48 @@
import { GITHUB_OWNER, GITHUB_REPO } from '../types.js';
import { execSync } from 'node:child_process';
interface IssueNode {
labels: {
nodes: Array<{ name: string }>;
};
}
/**
* Calculates the distribution of open issues across priority labels.
*/
function run() {
try {
const issues: IssueNode[] = [];
let hasPreviousPage = true;
let startCursor: string | null = null;
const MAX_ISSUES = 1000;
// Fetch up to 1000 open issues and their labels using pagination.
// Using 'last' to get more recent context.
while (hasPreviousPage && issues.length < MAX_ISSUES) {
const query = `
query($owner: String!, $repo: String!, $before: String) {
repository(owner: $owner, name: $repo) {
issues(last: 100, states: OPEN, before: $before) {
nodes {
labels(first: 20) {
nodes {
name
}
}
}
pageInfo {
hasPreviousPage
startCursor
}
}
}
}
`;
const variables = startCursor ? `-F before=${startCursor}` : '';
const output = execSync(
`gh api graphql -F owner=${GITHUB_OWNER} -F repo=${GITHUB_REPO} ${variables} -f query='${query}'`,
{ encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] },
).trim();
const data = JSON.parse(output).data.repository.issues;
issues.push(...data.nodes);
hasPreviousPage = data.pageInfo.hasPreviousPage;
startCursor = data.pageInfo.startCursor;
const repo = `${GITHUB_OWNER}/${GITHUB_REPO}`;
const query = `
query($p0: String!, $p1: String!, $p2: String!, $p3: String!, $all: String!) {
p0: search(query: $p0, type: ISSUE, first: 0) { issueCount }
p1: search(query: $p1, type: ISSUE, first: 0) { issueCount }
p2: search(query: $p2, type: ISSUE, first: 0) { issueCount }
p3: search(query: $p3, type: ISSUE, first: 0) { issueCount }
all: search(query: $all, type: ISSUE, first: 0) { issueCount }
}
`;
const distribution: Record<string, number> = {
p0: 0,
p1: 0,
p2: 0,
p3: 0,
other: 0,
const variables = {
p0: `is:issue is:open repo:${repo} label:p0`,
p1: `is:issue is:open repo:${repo} label:p1`,
p2: `is:issue is:open repo:${repo} label:p2`,
p3: `is:issue is:open repo:${repo} label:p3`,
all: `is:issue is:open repo:${repo}`,
};
issues.forEach((issue) => {
let found = false;
issue.labels.nodes.forEach((label) => {
const name = label.name.toLowerCase();
if (name.includes('p0')) {
distribution.p0++;
found = true;
} else if (name.includes('p1')) {
distribution.p1++;
found = true;
} else if (name.includes('p2')) {
distribution.p2++;
found = true;
} else if (name.includes('p3')) {
distribution.p3++;
found = true;
}
});
if (!found) {
distribution.other++;
}
});
const output = execSync(
`gh api graphql -F p0='${variables.p0}' -F p1='${variables.p1}' -F p2='${variables.p2}' -F p3='${variables.p3}' -F all='${variables.all}' -f query='${query}'`,
{ encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] },
).trim();
process.stdout.write(`priority_p0_count,${distribution.p0}\n`);
process.stdout.write(`priority_p1_count,${distribution.p1}\n`);
process.stdout.write(`priority_p2_count,${distribution.p2}\n`);
process.stdout.write(`priority_p3_count,${distribution.p3}\n`);
process.stdout.write(`priority_none_count,${distribution.other}\n`);
const data = JSON.parse(output).data;
const p0Count = data.p0.issueCount;
const p1Count = data.p1.issueCount;
const p2Count = data.p2.issueCount;
const p3Count = data.p3.issueCount;
const totalOpen = data.all.issueCount;
const noneCount = totalOpen - (p0Count + p1Count + p2Count + p3Count);
process.stdout.write(`priority_p0_count,${p0Count}\n`);
process.stdout.write(`priority_p1_count,${p1Count}\n`);
process.stdout.write(`priority_p2_count,${p2Count}\n`);
process.stdout.write(`priority_p3_count,${p3Count}\n`);
process.stdout.write(`priority_none_count,${noneCount}\n`);
} catch (error) {
process.stderr.write(
error instanceof Error ? error.message : String(error),