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
2 changes: 2 additions & 0 deletions lib/ai/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export async function reviewPullRequest(

await inngest.send({
name: "pr.review.requested",
id: `review-${repository.id}-${prNumber}`,
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

🧩 Analysis chain

🏁 Script executed:

cat -n lib/ai/actions/index.ts | head -220

Repository: afuhflynn/code-reverb

Length of output: 6326


🌐 Web query:

Inngest event ID idempotency deduplication behavior

💡 Result:

Summary of Inngest event idempotency / deduplication behavior

  • Event-level idempotency: if you include an event.payload.id when sending, Inngest treats that id as an idempotency key and ignores any later events with the same id for 24 hours (the later event is stored but will not trigger functions). The id is global across event types, so make it unique per event type. [1][2]

  • Function-level idempotency: you can set a function's idempotency to a CEL expression (e.g., event.data.cartId). Inngest evaluates that expression per incoming event and will only run the function once per unique expression value per 24-hour window. Useful for fan-out scenarios where some functions should run once and others every time. [2]

  • Notes / exceptions:

    • Event idempotency is ignored by debouncing, event batching, and while a function is paused (replays after unpausing may skip idempotency). [2]
    • Events that fan-out still trigger each function; use function-level idempotency to control per-function dedupe. [2]
    • The event payload format includes optional id and ts fields; ts defaults to receive time if omitted. [3]

Sources

  • Inngest docs — Sending events / Deduplication. [1]
  • Inngest docs — Handling idempotency (event-level and function-level, CEL examples, exceptions). [2]
  • Inngest docs — Event payload format (id, ts). [3]

Change the event ID prefix at line 180 to avoid deduplication conflicts.

Inngest treats event IDs as global idempotency keys across all event types. Using the same ID (review-${repository.id}-${prNumber}) for both "pr.review.requested" (line 95) and "pr.summary.requested" (line 180) will cause the second event to be silently deduplicated within 24 hours, preventing the summary generation from triggering. Change line 180 to use a distinct prefix, such as summary-${repository.id}-${prNumber}.

Also fix typos: "databse" → "database" (lines 33, 174) and "sucess" → "success" (lines 106, 198).

🤖 Prompt for AI Agents
In lib/ai/actions/index.ts (referenced lines: 33, 95, 106, 174, 180, 198),
change the duplicated event id prefix used at line 180 from
`review-${repository.id}-${prNumber}` to a distinct prefix like
`summary-${repository.id}-${prNumber}` to avoid Inngest global
idempotency/deduplication conflicts; additionally correct the typos "databse" →
"database" on lines 33 and 174 and "sucess" → "success" on lines 106 and 198.

data: {
owner,
repo,
Expand Down Expand Up @@ -176,6 +177,7 @@ export async function generatePullRequestSummary(
const githubAccount = repository.owner.accounts[0];
await inngest.send({
name: "pr.summary.requested",
id: `review-${repository.id}-${prNumber}`,
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 | 🟠 Major

Fix inconsistent event ID prefix—potential collision with review events.

The event ID uses the prefix review- for a pr.summary.requested event, which is semantically inconsistent and could cause ID collisions if both review and summary events are sent for the same PR. If Inngest uses event IDs for idempotency or deduplication, this could result in one event being dropped or overwritten.

🔎 Proposed fix
-      id: `review-${repository.id}-${prNumber}`,
+      id: `summary-${repository.id}-${prNumber}`,
📝 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
id: `review-${repository.id}-${prNumber}`,
id: `summary-${repository.id}-${prNumber}`,
🤖 Prompt for AI Agents
In lib/ai/actions/index.ts around line 180, the event id is built with the
prefix "review-" for a pr.summary.requested event which is semantically wrong
and risks id collisions; change the prefix to something unique to summary events
(for example "pr-summary-" or "pr-summary-requested-") so the id becomes e.g.
`pr-summary-${repository.id}-${prNumber}` (or include the event name
dynamically) to ensure distinct, idempotent event ids.

data: {
owner,
repo: repoName,
Expand Down