Repository navigation
Conversation
Add review.reviewers.autoscale. The planner records the PR heads that found every plain reviewer busy (DispatchPlan.ReviewerStarved). A clock-injected ReviewerAutoscaler turns that backlog, plus how long the oldest head has waited, into an active replica count between min and max, with streaks for hysteresis and a cooldown between steps. It holds scale-up at max, while the provider budget latch is set, when cgroup headroom is short, and for one cooldown after a reviewer kick fails with "did not reach input prompt". Dynamic replicas come from ExpandAgentReplicas, which raises the scaled agent to max without rewriting its declared replicas. Replicas above the active count take no review-swarm kick (DispatchOptions.ReplicaLimits) and no cadence kick. A turn already in flight is never interrupted, so a scaled-in replica drains. Hive-Run: hivecommons#14685 Hive-Plan: review-reviewer-autoscale Hive-Spec: review-swarm#reviewer-autoscale Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HRH6kjsZcEuDdED3kSWiqU Signed-off-by: Karibhou <Karibhou@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch:
Conflicts are checked with every PR merged onto the current tip of
|
|
@Karibhou this PR is back in your court ( Failing checks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Your relay session received this as a |
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether #14702 or #14695 is the reviewer-autoscale implementation for #14685 — both add review.reviewers.autoscale to the same files with different mechanics and cannot both merge.
This PR conflicts with #14695 (same feature, same issue, same branch name feat/reviewer-autoscale). Both say Closes #14685, both add the review.reviewers.autoscale block to src/hive.yaml.example, src/pkg/config/config.go, src/pkg/config/validate.go, src/pkg/review/dispatch.go, src/cmd/hive/main.go and src/docs/review-swarm.md. I read both diffs in full; they are not duplicates — they implement the same spec two different ways in the same places, so whichever merges second will not apply:
| #14702 (this) | #14695 | |
|---|---|---|
| Demand signal | DispatchPlan.ReviewerStarved []string (src/pkg/review/dispatch.go, noteReviewerStarved) |
DispatchPlan.Waiting []ReviewWait with no-free-reviewer / no-parallel-slot reasons (recordWait) |
| Retiring a replica | DispatchOptions.ReplicaLimits + AgentCapability.ReplicaIndex, overReplicaLimit() |
AgentCapability.Draining, filtered in reviewCapableAgents |
| Controller | src/pkg/review/autoscale.go |
src/pkg/review/autoscale/{controller,cgroup}.go |
| Config knobs | has max_wait |
no max_wait; uses the stage/050-review-pending dwell instead |
| Dashboard | status_builder.go only |
also api_config_review.go, overview_status.go, static/index.html (Settings UI entries), deploy/entrypoint.sh |
Those are incompatible shapes for the same config key, so this is a pick-one, not a rebase-and-merge-both. #14685 is @clubanderson's issue and #14695 is their implementation of it, so the choice is theirs. I have not closed anything.
Independently of that, the red checks on this head are the diff's fault, not infra (run 40579967601):
TestAgentRuntimeConfigGolden—pkg/config/agent_runtime_golden_test.go:45:.review.reviewers: unexpected. The golden needs regenerating for the newreview.reviewerssubtree.TestSettingsDialogReferencesEveryHiveYAMLLeaf—pkg/dashboard/settings_parity_test.go:33lists all eleven new leaves (review.reviewers.autoscale.enabled,.agent,.min,.max,.max_wait,.target_backlog_per_reviewer,.scale_up_cycles,.scale_down_cycles,.cooldown,.cpu_per_reviewer,.mem_per_reviewer_mb) as neither referenced by the Settings UI nor allowlisted. This diff does not touchstatic/index.html; #14695 does (24autoscalereferences there), which is why it passes that gate.
If #14702 is the one that survives, those two are what need fixing; if #14695 is, this can be closed in its favour.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Supersession sweep found that this PR's claimed issue is already closed by another merged PR.
Decision needed (@hivecommons): #14695 already merged and closed the claimed issue, but this PR touches files the merged PR did not. Recommended: keep open until the extra changes are reviewed, or close as superseded if they are not wanted. Another option: merge anyway. Files the merged PR did not touch: This comment is edited in place by the supersession sweep; it is not duplicated. |
|
hive-base-moved: 🐝 Hive Agent: |
|
hive/check-report (head
🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
@Karibhou the hive has adopted this PR ( |
|
FYI: the reviewer autoscaler for #14685 landed on v5 via #14695, and the hive's adopted copy of this branch (#14728) was closed as superseded for the same reason. This fork branch now conflicts with that implementation; unless there is a delta #14695 missed, it can be closed. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
The hive adopted this PR ( Blocker: the hive tried to re-home this PR onto Moving to |
|
/hive decision reject Rationale: superseded by #14695 (merged 566fbaa into Delta #14702 has that #14695 lacks (after comparing both diffs in full): exactly one knob — Follow-up: file ONE issue — "review/autoscale: optional explicit — decision posted as owner (@clubanderson) |
|
|
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Closed as superseded by #14695 by @clubanderson from the Hive dashboard. Duplicate of the |
Summary
This adds
review.reviewers.autoscale. Each planner cycle it changes how many of the reviewer agent's replicas take review work, staying betweenminandmax.PlanDispatchnow records every PR head that needed a plain reviewer but found every active one busy (DispatchPlan.ReviewerStarved). The autoscaler remembers when it first saw each head waiting, so it knows how long the oldest PR has waited.pkg/review/autoscale.go, pure, takes an injected clock):target_backlog_per_reviewerper active reviewer, or the oldest PR has waited longer thanmax_wait, forscale_up_cyclescycles in a row (default 2).scale_down_cyclescycles in a row (default 5).max, while the provider budget latch is set, when cgroup CPU or memory headroom is below the per-reviewer estimate, and for one cooldown after a reviewer kick fails withdid not reach input prompt(saturation, not demand).ExpandAgentReplicascreates the scaled agent's replicas up tomax(reviewer-3…reviewer-N) without changing the declaredreplicas, so a config save never stores the autoscaler's max as a fixed count.DispatchOptions.ReplicaLimits) and no cadence kick. They show in the eval log underagents_skippedasautoscale-inactive.reviewer autoscale: 2→3 reason=backlog=7 oldest=41m0s, with agent, from/to, min and max.ReviewerAutoscaler.Status()exposes current, min, max and the last decision.src/docs/review-swarm.md), ahive.yaml.examplestub and a changelog fragment are included.Off by default: when
enabledis false,ReplicaLimitsis nil and replica expansion is unchanged.Tests
pkg/review/autoscale_test.go:pkg/config/review_autoscale_test.go: expansion up tomaxkeeps the declaredreplicas; disabling autoscale changes nothing; declared replicas are never shrunk; defaults; validation errors.cmd/hive/review_autoscale_test.go: replica limits, cadence-kick withholding (including repo-scoped cadence keys), backlog from the plan driving a step, and saturation counted only for the scaled agent's prompt-not-ready failures.Per AGENTS.md, I did not run the tests locally; CI is the verdict. I ran
gofmt -lon the changed files and it was clean.Refs #14685. Still to do: the dashboard part of the issue (the current/target/min/max and last-decision fields in the status payload, the "auto" marker on the reviewer count, and the knobs under Settings → Review → Reviewers).
ReviewerAutoscaler.Status()is the hook for that follow-up.🤖 Generated with Claude Code
https://claude.ai/code/session_01HRH6kjsZcEuDdED3kSWiqU
— hive: backend=claude model=claude-opus-5-5
Closes #14685
🐝 Hive Agent:
contributor| SHA:c01758e1d