Repository navigation
Expand Aldo Review context and model diversity #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
ca76956
f69c449
c19711c
7454ef6
f48f9f5
5ee004a
f7cf37f
8d41cbf
17f1a7c
01496f6
82f4fd1
0be9935
85a824f
92b9704
8497fa4
ff4f1f0
178acee
1f0a4c8
b507a27
2bd5862
83f2b03
25f9e30
754a621
9bf9907
027ee5b
e9a112b
ba99790
9391ab5
72fae71
f346194
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,12 +11,27 @@ import * as Option from "effect/Option"; | |
|
|
||
| import * as ProviderInstanceRegistry from "../provider/Services/ProviderInstanceRegistry.ts"; | ||
| import * as ReviewService from "./ReviewService.ts"; | ||
| import { makeProviderCodeReview } from "./ProviderCodeReview.ts"; | ||
| import { makeProviderCodeReview, makeProviderReviewAgent } from "./ProviderCodeReview.ts"; | ||
|
|
||
| const GROK_DRIVER_KIND = "grok"; | ||
| const DEFAULT_GROK_REVIEW_MODEL = "grok-4.5"; | ||
| const OPENCODE_DRIVER_KIND = "opencode"; | ||
| const PREFERRED_OPEN_WEIGHT_REVIEW_MODELS = [ | ||
| "opencode/nemotron-3-ultra", | ||
| "opencode/nemotron-3-ultra-free", | ||
| ] as const; | ||
| const GROK_REVIEW_TIMEOUT_MS = 10 * 60 * 1_000; | ||
|
|
||
| export function selectOpenWeightReviewModel( | ||
| models: ReadonlyArray<{ readonly slug: string }>, | ||
| ): string | undefined { | ||
| return ( | ||
| PREFERRED_OPEN_WEIGHT_REVIEW_MODELS.find((slug) => | ||
| models.some((model) => model.slug === slug), | ||
| ) ?? models.find((model) => /^opencode\/nemotron-3-ultra(?:-|$)/.test(model.slug))?.slug | ||
| ); | ||
| } | ||
|
|
||
| export class GrokReviewService extends Context.Service< | ||
| GrokReviewService, | ||
| { | ||
|
|
@@ -53,11 +68,21 @@ export const make = Effect.gen(function* () { | |
| const requestedInstance = requestedInstanceId | ||
| ? yield* providerInstances.getInstance(requestedInstanceId) | ||
| : undefined; | ||
| const instances = requestedInstanceId | ||
| ? requestedInstance | ||
| ? [requestedInstance] | ||
| : [] | ||
| : (yield* providerInstances.listInstances).filter((candidate) => candidate.enabled); | ||
| const listedInstances = (yield* providerInstances.listInstances).filter( | ||
| (candidate) => candidate.enabled, | ||
| ); | ||
| const reviewInstances = requestedInstanceId | ||
| ? listedInstances.filter( | ||
| (candidate) => | ||
| candidate.instanceId === requestedInstanceId || | ||
| candidate.driverKind === OPENCODE_DRIVER_KIND, | ||
| ) | ||
| : listedInstances; | ||
|
Comment on lines
78
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When AGENTS.md reference: AGENTS.md:L5-L8 Useful? React with 👍 / 👎. |
||
| const instances = | ||
| requestedInstance && | ||
| !reviewInstances.some((candidate) => candidate.instanceId === requestedInstance.instanceId) | ||
| ? [requestedInstance, ...reviewInstances] | ||
| : reviewInstances; | ||
| const candidates = yield* Effect.forEach( | ||
| instances, | ||
| (candidate) => | ||
|
|
@@ -134,8 +159,40 @@ export const make = Effect.gen(function* () { | |
| driver: selected.instance.driverKind, | ||
| providerLabel: selected.snapshot.displayName ?? selected.instance.driverKind, | ||
| }); | ||
| const supplementalCandidate = candidates.find( | ||
| (candidate) => | ||
| candidate.instance.driverKind === OPENCODE_DRIVER_KIND && | ||
| readyCandidate(candidate) && | ||
| selectOpenWeightReviewModel(candidate.snapshot.models ?? []) !== undefined, | ||
| ); | ||
| const supplementalModel = supplementalCandidate | ||
| ? selectOpenWeightReviewModel(supplementalCandidate.snapshot.models ?? []) | ||
| : undefined; | ||
| const supplementalAgent = | ||
| supplementalCandidate && supplementalModel | ||
| ? makeProviderReviewAgent({ | ||
| textGeneration: supplementalCandidate.instance.textGeneration, | ||
| modelSelection: { | ||
| instanceId: supplementalCandidate.instance.instanceId, | ||
| model: supplementalModel, | ||
| }, | ||
| driver: supplementalCandidate.instance.driverKind, | ||
| providerLabel: | ||
| supplementalCandidate.snapshot.displayName ?? | ||
| supplementalCandidate.instance.driverKind, | ||
| }) | ||
| : undefined; | ||
| const result = yield* runner | ||
| .run({ request: { ...input, model: selectedModel }, source }) | ||
| .run({ | ||
| request: { ...input, model: selectedModel }, | ||
| source, | ||
| ...(supplementalAgent | ||
| ? { supplementalAgent } | ||
| : { | ||
| supplementalUnavailableReason: | ||
| "OpenCode Nemotron 3 Ultra supplemental reviewers were unavailable.", | ||
| }), | ||
| }) | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| .pipe(Effect.timeoutOption(GROK_REVIEW_TIMEOUT_MS)); | ||
| if (Option.isNone(result)) { | ||
| return yield* new GrokReviewError({ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.