This PR addresses critical issues in CI configuration and repository lifecycle management that were identified during recent monitoring and failed automation attempts.
### CI Optimization & Fixes (BT-40)
- **Syntax Fix**: Corrected the `matrix.node-version` definition in `.github/workflows/ci.yml` using `fromJSON()`. The previous literal string caused `setup-node` to fail as it couldn't parse the version list as an array.
- **Cost Reduction**: Implemented Node version sharding. PRs now only run on Node 20.x, while `main` and `release/**` pushes maintain full coverage across Node 20, 22, and 24.
- **Efficiency**: Reordered `npm ci` and `npm run build` steps in Linux and Mac test jobs. Dependencies are now installed BEFORE building, preventing potential build failures due to missing local tools.
### Lifecycle Manager Scale & Grace (BT-39)
- **Scale-Safe Search**: Refactored `.github/scripts/gemini-lifecycle-manager.cjs` to use `github.paginate`. This removes the 100-item bottleneck that was preventing the bot from processing the full issue backlog.
- **Optimized Triage**: Added `comments:>1` to the `status/need-information` removal search. This reduces N+1 API calls by skipping issues where no response has been received yet.
- **Robust Contribution Policy**: Hardened the PR nudge/closure logic:
- **Grace Period**: PRs are now only closed if they have the `status/pr-nudge-sent` label AND have not been updated for 7 days AFTER the nudge. This guarantees a fair window for contributors to respond, regardless of the PR's absolute age.
- **Reliable Nudge**: Removed the narrow creation window for nudges, ensuring no PR slips through the policy without a warning.
### Impact
- **CI Stability**: Unblocks all repository CI runs.
- **Backlog Management**: Enables the bot to finally address the >2000 issue backlog effectively.
- **Contributor Experience**: Ensures a consistent and fair grace period for community pull requests.
Fixes the throughput metrics script and introduces new visibility into backlog bottlenecks and priority distribution.
### Changes
- **Throughput Fixes**: Resolved a `ReferenceError` where `isMaintainer` was not correctly scoped, fixed a malformed license header, and added a new metric for `issue_arrival_rate_per_day` to enable growth-vs-closure analysis.
- **Backlog Bottlenecks**: Introduced `bottlenecks.ts` to identify "Zombie" issues (no activity > 30 days) and "Hot" issues (high activity).
- **Priority Distribution**: Introduced `priority_distribution.ts` to track the count of open issues by priority level (P0-P3).
### Impact
These metrics will provide the necessary data to confirm if the repository is experiencing systemic backlog growth (Arrival Rate > Throughput) and help identify which segments of the backlog require urgent triage.