Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions apps/pr-reviewer/fixtures/demo-pr/cart-total.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function cartTotal(items: { price: number; qty: number }[]): number {
let total = 0;
for (let i = 0; i <= items.length; i++) {
total += items[i].price * items[i].qty;
}
return total;
}
3 changes: 3 additions & 0 deletions apps/pr-reviewer/fixtures/demo-pr/discount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function applyDiscount(total: number, percent: number): number {
return total - total * percent;
}
3 changes: 3 additions & 0 deletions apps/pr-reviewer/fixtures/demo-pr/email.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function isEmail(value: string): boolean {
return value.includes("@");
}
3 changes: 3 additions & 0 deletions apps/pr-reviewer/fixtures/demo-pr/loyalty.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function pointsFor(totalCents: number): number {
return Math.round(totalCents / 100) * 1.5;
}
3 changes: 3 additions & 0 deletions apps/pr-reviewer/fixtures/demo-pr/order-id.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function nextOrderId(last: string): string {
return String(parseInt(last) + 1);
}
4 changes: 4 additions & 0 deletions apps/pr-reviewer/fixtures/demo-pr/refund-window.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export function canRefund(deliveredAt: Date, now = new Date()): boolean {
const days = (now.getTime() - deliveredAt.getTime()) / 86400;
return days <= 30;
}
4 changes: 4 additions & 0 deletions apps/pr-reviewer/fixtures/demo-pr/shipping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export function shippingCost(weightKg: number, express = false): number {
const base = weightKg > 5 ? 12 : 6;
return express ? base * 2 : base;
}
9 changes: 5 additions & 4 deletions apps/pr-reviewer/src/agents/review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function ReviewLead() {

useSubagent({
name: 'correctness-reviewer',
description: 'Reviews a unified diff for logic errors, edge cases, and behavioral regressions.',
description: 'Reviews a unified diff for logic errors, edge cases, and behavioral regressions. Reviews a single file in the context of the whole diff.',
agent: CorrectnessReviewer,
model: 'openrouter/anthropic/claude-sonnet-5',
});
Expand Down Expand Up @@ -96,9 +96,10 @@ export function ReviewLead() {
return `You are the lead reviewer of a pull request. Work through these steps in order:

1. Load the diff with the read_diff tool, using the file path given in the user message.
2. Delegate two review passes: one task to correctness-reviewer, one task to style-reviewer.
Issue both tasks in a single batch so they run in parallel, and include the complete diff
text in each task message — subagents cannot see this conversation.
2. Count the "diff --git" headers in the diff. Issue exactly that many correctness-reviewer
tasks, one per changed file, naming the file, plus one style-reviewer task, all in one batch
so they run in parallel. Paste the complete, untruncated diff text into every task message —
subagents cannot see this conversation. Never group files into one task.
3. Synthesize everything into one review: a one-line verdict, then findings ordered by
severity (correctness before style).
4. Publish the review with the post_review tool, exactly once.
Expand Down
Loading