Repository navigation
feat(aggregator): Needs-Drew label census on the attention view (#1226) - #3970
Conversation
Labels as a read-only source: buildNeedsDrewCensus paginates the GitHub search API for open issues and PRs carrying user/review or user/escalated across the four repos, dedupes items carrying both labels, defensively drops closed items, extracts an explicit reason when the body states one (else null, rendered as an honest fallback), and reports per-source failures/truncation and freshness instead of rendering them as an empty queue. Wired as an optional Source facet (needsDrew?) so fixtures and test doubles keep working; the live source caches the sweep for 5 minutes and uses PM_AGG_GITHUB_TOKEN/GITHUB_TOKEN when present. Rendered as a section on /attention and served at /api/needs-drew.json (503 when the source cannot census). Verified: new test/needs-drew.test.ts 10/10 (both labels, overlap dedupe, closed exclusion, pagination, source failure, reason fallback, render states); full aggregator suite 1307 pass with only the pre-existing boot.test.ts full-suite flakiness (11/11 standalone in this worktree and on clean main); tsc error count unchanged vs main (12, all pre-existing). Live spot-check: census counts reconcile exactly with gh for all 8 repo/label sources (105 items; code user/review 26, user/escalated 37).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 20 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c8e58a2cd4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…s, fetch census only where rendered (#3970) Three unresolved Codex P2 findings on PR #3970: - live.ts: concurrent attention fragments each started their own census on a cold cache (24 GitHub search calls instead of 8). The sweep is now a single-flight, TTL-cached sweeper (createNeedsDrewSweeper) and only a resolved sweep is cached. - needs-drew.ts: GitHub's HTTP 200 + incomplete_results:true signal was dropped, so a search timeout could present an authoritative empty queue. The flag now marks the source and census incomplete, and the banner names it distinctly from a page-cap truncation. - server.ts: attentionContext awaited the eight-query census for every caller, so the overview, Today, /api/attention.json and /api/coverage.json could wait ~64s on an unreachable GitHub API for a result they discard. The census is now opt-in (shouldFetchNeedsDrewCensus) and only the attention page render opts in. Tests: single-flight sharing, TTL reuse, honest failure caching, the incomplete_results flag end to end with its banner, and the opt-in gate.
…95-3970-needs-drew-census
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
What
Implements task 4936 for #1226: the GitHub
user/review+user/escalatedlabels become a read-only source for the aggregator's attention view — one reconciled Needs-Drew census across all four repos.src/needs-drew.ts—buildNeedsDrewCensus: paginated GitHub search per repo × label (open only), dedupes items carrying both labels, defensively drops closed items from payloads, kind issue/PR, explicit reason extracted when the body states one (otherwisenull— renderers show an honest fallback), per-source status with failures/truncation andfetchedAtfreshness;completeis true only when every source answered fully.src/source.ts— optionalSource.needsDrew?()facet (same pattern ascoverageCensus?), so fixtures/test doubles keep working.src/sources/live.ts— live implementation with a 5-minute cache; usesPM_AGG_GITHUB_TOKEN/GITHUB_TOKENwhen present, works unauthenticated.src/render.ts— "Needs Drew — GitHub label census" section on/attention: unavailable renders as unavailable (never a confident zero), source failures render a banner naming repo + label.src/server.ts— census ridesattentionContext; new machine form/api/needs-drew.json(503 when the source cannot census)./api/attention.jsonshape unchanged.Reconciliation direction, as specified in the packet: labels are the input to the page; the aggregator never writes labels back.
Acceptance discrepancy (preserved, not claimed)
The original #1226 acceptance says "#1007 appears in the queue". Issue #1007 is closed, and this census is open-only by design, so a closed item cannot appear. Literal acceptance is not claimed; #1226 stays open for Drew's reconciliation ruling.
Verification
test/needs-drew.test.ts: 10/10 pass — both labels, overlap dedupe, closed exclusion, pagination, source failure naming, reason extraction/fallback, render states (undefined omits, null renders unavailable, failures banner).test/boot.test.tsunder full-suite load, andboot.test.tspasses 11/11 standalone in this worktree and on clean main.tsc --noEmit: 12 errors, identical count to clean main — all pre-existing, none in touched files.gh): counts reconcile exactly for all 8 repo/label sources — 105 open items total (codeuser/review26,user/escalated37; opencode 13/3; openchamber 9/5; nix 8/4), and individual items (code Nix Playwright E2E suite fails after vendoring dependencies #176user/review, code Root flake check fails on nixosConfigurations due to missing clan-core.clanModules #159 and code Phase 2: keep_prior revives earlier grants for a re-added member #169user/escalated) verified open with the labels the census reports.Queue: task 4936 (repo-health-code-pilot), lane D.