Skip to content

✨ review: route bot-authored PR reviews to a cheaper model - #14626

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
feat/review-bot-author-model
Oct 27, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
feat/review-bot-author-model

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #14625

What

A review kick for a PR whose author matches review.bot_authors is routed to review.bot_author_model through the planner's existing per-kick model choice (chooseReviewModel → ReviewModelChoice → the kick's independent-review instruction), so the reviewer runs the review in a sub-agent on the cheaper model. Not downgraded when: the route is off (default), the author is the hive's own App (project.ai_author / App [bot] login), the PR touches review.bot_author_full_review_paths, or its changed files could not be listed. Pool skip / requires-human decisions are kept.

Config (docs/review-swarm.md)

  • review.bot_author_model: model or backend/model, default empty = off. Documented recommendations from pkg/tokens/pricing.go: gemini-flash-3-5, gpt-6-luna; the reviewer engine must support it.
  • review.bot_authors: default dependabot[bot], renovate[bot], github-actions[bot], *[bot] (leading * = suffix match; hive's own App excluded).
  • review.bot_author_full_review_paths: default .github/workflows/**, Dockerfile*, **/Dockerfile* (** spans directories). Lockfiles deliberately not excepted.

Evidence

~/hive-work/reviewer-spend/summary.md, Oct 13-27: other-bot PRs cost $38.61/day across three hives, $30.60/day on Bluefin, all on claude-fable-5.1 ($10/$50).

Changes

  • pkg/review/bot_route.go (new): IsBotAuthor, PathMatchesAny (glob with **), applyBotAuthorRoute; DispatchOptions.BotAuthorRoute, DispatchKick.BotAuthorRouted, PullRequest.ChangedFiles/ChangedFilesKnown
  • pkg/review/dispatch.go: route applied after the pool choice at both the combined and per-perspective kick sites
  • pkg/github/review_bot_route.go (new): ReviewPRChangedFiles
  • cmd/hive/main.go: planReviewDispatchWith lists files only for a listed bot's PR with no verdict and no pending review; logs routed kicks
  • pkg/config: keys, defaults, BotAuthorModelRef
  • Tests: author matching incl. own app excluded, path exceptions, model selection (pool override, backend/model, combined mode, skip kept), wiring

Not covered

The cadence (queue-mode) kick's review_with= annotation still comes from the agent's review_models pool; review-heads kicks keep their configured head models. Both noted in the docs.

PRs opened by Dependabot, Renovate, github-actions and other GitHub Apps
are reviewed with review.bot_author_model when set, through the same
per-kick model choice the review_models pool uses. The hive's own App
login never matches review.bot_authors; a PR touching
review.bot_author_full_review_paths (default CI workflows and
Dockerfiles) or whose changed files could not be listed keeps the
full-strength model.

Fixes #14625

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 27, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hanthor for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#14628 🐛 fix(review): require sign-off on review-fix follow-up commits same files src/pkg/review/dispatch.go
#14624 🐛 fix(review): expire stale pending fixes and route decision requests before conflicts same files src/pkg/review/dispatch.go
#14622 ✨ review: delta re-review mode for PRs already judged at an earlier head CONFLICT src/cmd/hive/main.go
src/docs/review-swarm.md
src/pkg/config/config.go
src/pkg/config/review_dispatch.go
src/pkg/config/review_dispatch_test.go
src/pkg/dashboard/settings_parity_allowlist.txt
src/pkg/review/dispatch.go
#14617 ✨ RFC lifecycle notices to Discord #architecture-rfcs: opened, closed, taken off hold same files src/pkg/config/config.go
#14524 ✨ feat(hub,agent): Hub-coordinated live CLI session pool for multi-tenant runner capacity same files src/cmd/hive/main.go

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 27, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson is auto-promoted for contributor-lane merging on this PR: the last 5 merged PRs by this author in this hive's repositories have no revert or sentinel-alert evidence. CI, reviewer verdict, diff fences, soak, holds and branch protection still apply.

…gs control exists

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@hivecommons-hive hivecommons-hive Bot added author/human A person pushed this PR themselves dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 27, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the planner, the wiring in cmd/hive/main.go, and the config helpers. The route's gates are right (unknown files → no downgrade; full-review paths; pool skip/hold preserved). One own-App exclusion gap is real and worth fixing before this lands.

Own-App exclusion only covers one of the two logins (medium). src/pkg/review/bot_route.go:35 excludes exactly one login, ownApp, by EqualFold. Both callers pass cfg.EffectiveAIAuthor() (src/cmd/hive/main.go:10588, and AIAuthor: at the DispatchOptions literal ~:10727). EffectiveAIAuthor() (src/pkg/config/config.go:3847-3855) returns project.ai_author when it is set and only falls back to GitHub.BotLogin() when it is empty. So on a hive that sets project.ai_author to a non-[bot] login while App-authored PRs are on (the default, config.go:3863-3867) — which is exactly what examples/kubestellar/hive-project.yaml:16 does (ai_author: "clubanderson") and what manual-provisioning.md:382 tells operators to do — the App's own <slug>[bot] PRs are not excluded, match the default *[bot] pattern (review_dispatch.go:103), and every hive-authored PR is reviewed on the cheap model. That is the opposite of the file-header rationale ("the hive's own PRs are not dependency bumps") and of review-swarm.md:413, which promises both project.ai_author or the App's [bot] login never match. The wiring test passes only because reviewSwarmConfig sets AIAuthor: "hive-bot" and the test author is also hive-bot. Fix: exclude both cfg.Project.AIAuthor and cfg.GitHub.BotLogin() (e.g. IsBotAuthor(login, patterns, ownApps ...string)), and add a case where ai_author is a person login and the PR author is <slug>[bot].

Verified correct. reviewBotRouteFilesFor (main.go:10586-10597) lists files only when the route is on, the author qualifies, the head is unjudged and nothing is pending, so it is one REST call per head, not per cycle. applyBotAuthorRoute (bot_route.go:141) keeps Skip/RequiresHuman from the independence pool, so the route cannot un-hold a PR. globRegexp handles **/ as optional so .github/workflows/** matches .github/workflows/ci.yml and Dockerfile* matches by basename via the no-slash rule. ReviewPRChangedFiles returns known=false on any error, which the planner reads as no downgrade.

go build not re-run for this head after reading; tests not runnable here (#9845).

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 7a985fa into v5 Oct 27, 2026
74 of 76 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the feat/review-bot-author-model branch October 27, 2026 18:01
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#14626c2d9ca9` sha256:d95693836df316b617b178df3ba5174c742782330fc66573ab994bdc3a1b791e — download from the dashboard or `hivectl review evidence #14626`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at c2d9ca9.

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/human A person pushed this PR themselves conflicts-with-open-pr Open PR has a merge conflict with another open PR dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reviewer cost: route bot-authored PR reviews to a cheaper model

1 participant