team mode: multi-agent adversarial PR review#6
Merged
Conversation
added 8 commits
June 3, 2026 16:04
Add Agent, Lens, SynthFinding, SynthReport, LensVerdict, FindingVerdict and Verdict types for the multi-agent team review mode. Responses from language models are parsed with tolerant serde (default collections, loose boolean coercion) to survive minor formatting drift.
Add DiffContext (full diff plus per-file patch map) and fetch_diff_context; fetch_diff now delegates to it for zero behavioural change. patch_for selects the per-file patch for a finding, falling back to a UTF-8-safe truncation of the full diff for file-level or cross-file findings.
Add call_agent (specialist fan-out), call_synthesis (deduplicating merge of the agent reports into a SynthReport) and call_lens (adversarial per-finding verification). Introduce the synthesis and three lens system prompts plus the team model constants.
Strengthen the synthesis prompt: drop noise already enforced by Clippy or the compiler, require each message to name the concrete code element, and surface agent disagreement instead of silently resolving it. Add a Category enum (bug/security/design/performance/test-gap, with a tolerant Other fallback) carried on every SynthFinding.
Add the team module: run_team runs the four specialist agents concurrently (graceful degradation), synthesises and caps findings, then verifies each with a concurrency-bounded 3-lens adversarial vote, computes the verdict deterministically, renders the comment and posts confirmed criticals inline. Add render_team_comment and TeamCommentView. The pure aggregate_lens_votes and compute_verdict helpers are unit-tested.
Wire Mode::Team (env "team", comment marker, label) and dispatch run_team from main. Surface the lens name in verification warnings, and drop the temporary dead_code allowances now that every team-mode item is reachable.
List the seven review modes and their models, and show how a caller workflow invokes the reusable workflow, including the on-demand team mode gated by the ai:team label.
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.
@
Summary
Adds a seventh
ai-reviewmode,team, that orchestrates several Mistral agents to produce a higher-confidence review than any single pass:mistral-largestep merges and deduplicates their findings, attributes each to itssources, drops noise already enforced by Clippy or the compiler, anchors each message to a concrete code element, tags a category, and surfaces agent disagreement.Design notes
Arc<Semaphore>+JoinSet,acquire_ownedpermits) and capped at the top 15 findings by severity, with the cap reported.mode, soteamneeds no workflow change here. Trigger it from a caller workflow with theai:teamlabel (documented in the README). Rolling the trigger out to the consuming repos is a follow-up.Verification
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace --all-features(19 tests, including pure unit tests for the vote aggregation, the deterministic verdict, comment rendering, and tolerant deserialization)cargo build --release@