Skip to content
Merged
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
63 changes: 30 additions & 33 deletions lib/ai/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,41 +88,38 @@ export async function reviewPullRequest(
},
});

try {
await inngest.send({
name: "pr.summary.requested",
id: `summary-${repository.id}-${prNumber}`,
data: {
owner,
repo,
prNumber,
title: title ?? "",
description: description ?? "",
accountId: githubAccount.accountId,
installationId: installationId ?? null,
baseSha,
headSha,
changedFiles: changed_files ?? 0,
additions: additions ?? 0,
deletions: deletions ?? 0,
},
});
} catch (e) {
console.error("Summary enqueue failed", e);
}
await inngest.send({
name: "pr.summary.requested",
id: `summary-${repository.id}-${prNumber}`,
data: {
owner,
repo,
prNumber,
title: title ?? "",
description: description ?? "",
accountId: githubAccount.accountId,
installationId: installationId ?? null,
baseSha,
headSha,
changedFiles: changed_files ?? 0,
additions: additions ?? 0,
deletions: deletions ?? 0,
},
});

await inngest.send({
name: "pr.review.requested",
id: `review-${repository.id}-${prNumber}`,
data: {
owner,
repo,
prNumber,
userId: repository.ownerId,
runId: run.id,
},
});

try {
await inngest.send({
name: "pr.review.requested",
id: `review-${repository.id}-${prNumber}`,
data: {
owner,
repo,
prNumber,
userId: repository.ownerId,
runId: run.id,
},
});
} catch (e) {
console.error("Review enqueue failed", e);
}
Comment on lines 122 to 125
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Remove dead code.

The try block is empty, making this entire try-catch construct useless. The catch block will never execute since there's no code in the try block that could throw an error.

🔎 Proposed fix
-    try {
-    } catch (e) {
-      console.error("Review enqueue failed", e);
-    }
-
     return {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
try {
await inngest.send({
name: "pr.review.requested",
id: `review-${repository.id}-${prNumber}`,
data: {
owner,
repo,
prNumber,
userId: repository.ownerId,
runId: run.id,
},
});
} catch (e) {
console.error("Review enqueue failed", e);
}
🤖 Prompt for AI Agents
In lib/ai/actions/index.ts around lines 122 to 125, there is an empty try block
with only a catch that logs errors; remove this dead try-catch. Either delete
the try-catch entirely if no error-prone work is needed here, or move the actual
logic that can throw into the try block so the catch can meaningfully handle
errors; ensure any removed logging is preserved where appropriate.

Expand Down