Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
66d17bb
🐛 review: split the grounding budget across fan-out sub-agents
odttlnt Oct 29, 2026
7629a36
Merge branch 'v5' into fix/fanout-grounding-budget-15435
hivecommons-hive[bot] Oct 30, 2026
ba20c78
Merge branch 'v5' into fix/fanout-grounding-budget-15435
hivecommons-hive[bot] Oct 30, 2026
78b29de
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
cc2a30b
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
1341964
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
e93003c
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
cbaa1d0
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
214d130
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
1b91e98
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
4f628a3
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
df0c35c
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
a78503a
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
9c9a4c3
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
b40ae5b
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
7eaa333
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
745c630
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
a7da5d0
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
118641c
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
5d44917
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
87124cd
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
62a3434
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
e580164
Merge branch 'v5' into hive/adopt-15564
hivecommons-hive[bot] Oct 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-15435-fanout-grounding-budget.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- A combined review head's fan-out now splits the shared grounding tool-call budget across its per-perspective sub-agents instead of leaving each to read the whole-review cap as its own.
11 changes: 11 additions & 0 deletions src/pkg/review/prompts.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package review

import (
Expand Down Expand Up @@ -760,12 +760,23 @@
fmt.Fprintf(&b, "1. Fetch the PR metadata, the full diff of %s#%d and any linked issue or contract ONCE, yourself, as the read instructions above describe.\n", pr.Repo, pr.Number)
fmt.Fprintf(&b, "2. Start one sub-agent per perspective, all %d at once, IN PARALLEL, not one after another (Claude Code: the Task tool; Codex and other backends: their sub-agent facility). Give each sub-agent the diff, the PR metadata, the linked issue or contract text, the shared instructions above (scope contract, grounding, finding schema) and ONLY its own section from PERSPECTIVE SECTIONS below. Each sub-agent returns exactly one verdict object for its perspective.\n", len(perspectives))
writeFanOutModelPin(&b, backend, model)
fmt.Fprintf(&b, " Grounding budget: the shared %d tool calls cover this whole review, not each sub-agent. Tell each sub-agent it may make at most %d investigation tool calls for its own perspective, so the total across all %d stays within the cap.\n", combinedGroundingBudget(len(perspectives)), fanOutSubAgentBudget(len(perspectives)), len(perspectives))
b.WriteString("3. Sub-agents must NOT post anything on the PR, must NOT call hive-review, must NOT read other hive reviews of this head SHA, and must NOT fetch the PR or its diff again: they work from what you passed them. They may read the surrounding code in the checkout to ground a finding.\n")
b.WriteString("4. Collect every result, check each object names its own perspective and carries this PR's repo, number, head_sha and body_digest, write them as ONE JSON array to the verdict file, and record it ONCE with the --record-verdict command above. Only you call hive-review.\n")
b.WriteString("If sub-agents are unavailable, or one fails or returns no usable verdict, review those perspectives yourself one by one in this session. The array contract is unchanged either way.\n")
return b.String()
}

// fanOutSubAgentBudget splits the combined grounding budget evenly across the
// per-perspective sub-agents of a fan-out (hivecommons/hive#15435), so the
// shared "whole review" cap is not read as each sub-agent's own.
func fanOutSubAgentBudget(n int) int {
if n < 1 {
n = 1
}
return max(1, combinedGroundingBudget(n)/n)
}

// writeFanOutModelPin keeps the head's model guarantee across the fan-out.
// A head IS its model (review_heads: each head's report is stamped with the
// model that head ran), and its kick already carries the independent-review
Expand Down
1 change: 1 addition & 0 deletions src/pkg/review/review_heads_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ func TestCombinedHeadPromptFansOutPerPerspective(t *testing.T) {
"must NOT fetch the PR or its diff again",
"record it ONCE with the --record-verdict command above. Only you call hive-review.",
"If sub-agents are unavailable",
"cover this whole review, not each sub-agent",
}
for _, tc := range []struct {
name string
Expand Down
Loading