Skip to content

add multi-provider model diversity to adversarial pr review (closes #2)#3

Merged
Esity merged 8 commits into
mainfrom
feature/multi-provider-review
Mar 30, 2026
Merged

add multi-provider model diversity to adversarial pr review (closes #2)#3
Esity merged 8 commits into
mainfrom
feature/multi-provider-review

Conversation

@Esity

@Esity Esity commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds review_models: kwarg to run_lifecycle for per-review provider/model cycling
  • PullRequestReviewer now accepts model: and provider: kwargs, forwarded to Legion::LLM.chat
  • Unavailable providers skipped with log warning, remaining K slots backfilled via cyclic assignment
  • LifecycleSubscriber forwards review_models: from AMQP payload
  • Settings fallback: codegen.self_generate.github.review_models
  • Closes add multi-provider model diversity to adversarial k-factor pr review #2

Test plan

  • review_models forwarded to adversarial review
  • PullRequestReviewer accepts and forwards model/provider kwargs
  • Unavailable providers skipped
  • Empty review_models uses default for all K
  • All existing specs still pass

@Esity Esity requested a review from a team as a code owner March 29, 2026 23:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds support for running adversarial PR review passes across multiple LLM providers/models, enabling per-pass model diversity via a new review_models: configuration and AMQP passthrough.

Changes:

  • Extend lifecycle runner to accept review_models: and build per-pass model/provider assignments, skipping unavailable providers.
  • Update PullRequestReviewer to accept model:/provider: kwargs and forward them to Legion::LLM.chat.
  • Forward review_models through LifecycleSubscriber, update specs, bump version, and document the release.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/legion/extensions/swarm_github/runners/extension_lifecycle.rb Adds settings fallback for review models and per-pass assignment logic for adversarial reviews.
lib/legion/extensions/swarm_github/runners/pull_request_reviewer.rb Accepts model:/provider: and conditionally forwards them to Legion::LLM.chat.
lib/legion/extensions/swarm_github/actors/lifecycle_subscriber.rb Forwards review_models from the lifecycle payload into run_lifecycle.
spec/legion/extensions/swarm_github/runners/extension_lifecycle_spec.rb Adds coverage for forwarding and assignment helper behavior.
spec/legion/extensions/swarm_github/runners/pull_request_reviewer_spec.rb Adds coverage asserting model/provider forwarding/omission.
spec/legion/extensions/swarm_github/actors/lifecycle_subscriber_spec.rb Adds coverage for review_models passthrough.
lib/legion/extensions/swarm_github/version.rb Bumps gem version to 0.3.2.
CHANGELOG.md Documents the new multi-provider review behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/legion/extensions/swarm_github/actors/lifecycle_subscriber.rb Outdated
Comment thread lib/legion/extensions/swarm_github/runners/extension_lifecycle.rb Outdated
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/legion/extensions/swarm_github/runners/extension_lifecycle.rb Outdated
Comment thread lib/legion/extensions/swarm_github/runners/extension_lifecycle.rb
change build_model_assignments to use each available spec at most once
then backfill remaining slots with nil (default provider), instead of
cycling; update spec to match new use-once-then-nil semantics

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/legion/extensions/swarm_github/runners/extension_lifecycle.rb
Comment thread lib/legion/extensions/swarm_github/runners/extension_lifecycle.rb

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/legion/extensions/swarm_github/runners/extension_lifecycle.rb
- add Array type guard in build_model_assignments with log.warn for non-Array input
- add extend self to PullRequestReviewer so module-level call in run_adversarial_review works
- stub pr_reviewer_available? in integration contexts that don't exercise adversarial review path
- add spec coverage for non-Array models guard

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/legion/extensions/swarm_github/runners/extension_lifecycle.rb Outdated
move is_a?(Array) guard before models.empty? to avoid NoMethodError on
non-Array types; add spec coverage for Hash and Integer inputs (#3)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/legion/extensions/swarm_github/runners/extension_lifecycle.rb Outdated
guard non-symbolizable provider values in build_model_assignments (#3)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +157 to +159
assignments = available.first(count)
assignments + Array.new([count - assignments.length, 0].max) { nil }
end

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

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

The PR description/test plan mentions remaining K slots being backfilled via cyclic assignment, but build_model_assignments uses each available spec at most once and then backfills with nil (default provider). Please align the PR description (or adjust the implementation) so they match.

Copilot uses AI. Check for mistakes.
@Esity Esity merged commit 20d441d into main Mar 30, 2026
19 checks passed
@Esity Esity deleted the feature/multi-provider-review branch March 30, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add multi-provider model diversity to adversarial k-factor pr review

2 participants