feat: surface reviewer load in assigned-prs and daily digest#189
Merged
Conversation
Add a single authority for a reviewer's review-load per repo and wire it
into the two reviewer-facing surfaces so reviewers can see how close they
are to capacity.
New service analyzer/services/reviewer_load.py:
- build_reviewer_loads / reviewer_load_for read the latest cached queue
snapshot (same resolution as pr_info) and reuse the assignment engine's
own collect_assignment_statistics + build_reviewer_catalog. current_load
is therefore the exact weighted figure that gates auto-assignment
(status-weighted, self-authored PRs excluded), not a raw PR count.
- Read-only: never builds a snapshot; returns {}/None when none exists.
- Case-insensitive login matching.
- format_load_line renders the shared one-liner.
User-visible effects:
- assigned-prs: per-repo `Load: 3 / 10 (7 free)` under Thresholds, plus a
top-of-report `At capacity in K of N repos.` only when at capacity.
- daily reviewer-attention digest: per-repo `Load: 9 / 10 (1 free) ·
9 assigned` under Settings.
Load is weighted and can be fractional, so the formatter shows one decimal
(integer when whole). at_capacity mirrors the engine's strict remaining>0
gate; free is derived from the shown used (so they sum to capacity) and a
used that rounds up to capacity while the reviewer still has real room is
clamped to capacity-0.1, so near-cap loads render as `9.9 / 10 (0.1 free)`
rather than a contradictory `10 / 10 (0 free)`.
Load reflects the latest cached snapshot, so it can lag the live queue by
one snapshot cycle (same freshness contract as pr-info).
Testing: uv run ruff check/format; analyzer + zulip_bot suites (724 tests)
green against dockerized Postgres.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bryangingechen
added a commit
that referenced
this pull request
Jul 13, 2026
Build on the reviewer_load service (PR #189) for the acceptance-gate console. Pending-proposal load (design doc 050): - build_reviewer_loads now folds a reviewer's active proposals into current_load (weight from ANALYZER_ASSIGNMENT_PROPOSAL_PENDING_LOAD_WEIGHT), exactly as the assignment engine / area stats already count them. assigned_open still excludes proposals (a proposal is load, not an assignee). Data-driven: no proposals => no change. Adds a public pending_proposal_load_for_repo() wrapper so reviewer_load does not import private helpers. - Consequence: the assigned-prs command and daily digest now count pending proposals in their load too, so the figure matches the engine on every surface. Reviewer console home is now a per-repo dashboard: - Load line is computed via the shared helper OUTSIDE the proposal loop, so it renders even with zero proposals. Removes the ad-hoc, case-sensitive assignees__contains count and the hand-rolled assigned+pending/capacity math. - Each active repo (has a proposal OR >=1 assigned open PR) shows: load line + assigned open PRs with status (from build_reviewer_attention_reports) + the proposals to accept/decline. New empty state covers "nothing here". Testing: uv run ruff check/format; analyzer + zulip_bot + console + core suites (922 tests) green against dockerized Postgres. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a single authority for a reviewer's review-load per repo and wire it into the two reviewer-facing surfaces so reviewers can see how close they are to capacity.
New service analyzer/services/reviewer_load.py:
User-visible effects:
Load: 3 / 10 (7 free)under Thresholds, plus a top-of-reportAt capacity in K of N repos.only when at capacity.Load: 9 / 10 (1 free) · 9 assignedunder Settings.Load is weighted and can be fractional, so the formatter shows one decimal (integer when whole). at_capacity mirrors the engine's strict remaining>0 gate; free is derived from the shown used (so they sum to capacity) and a used that rounds up to capacity while the reviewer still has real room is clamped to capacity-0.1, so near-cap loads render as
9.9 / 10 (0.1 free)rather than a contradictory10 / 10 (0 free).Load reflects the latest cached snapshot, so it can lag the live queue by one snapshot cycle (same freshness contract as pr-info).