Conversation
📝 WalkthroughWalkthroughThis PR adds explicit id fields to two Inngest event sends in AI action handlers. The ids are constructed from repository.id and prNumber to uniquely identify pull request-specific events for both review and summary generation workflows. Changes
Estimated Code Review Effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly Related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
Summary by CodeReverb
Generated automatically by CodeReverb Try out CodeReverb |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/ai/actions/index.ts (1)
33-33: Fix typos in user-facing strings.Multiple typos found:
- Line 33: "databse" → "database"
- Line 106: "sucess" → "success"
- Line 174: "databse" → "database"
- Line 198: "sucess" → "success"
🔎 Proposed fixes
- `Repository ${owner}/${repo} not found in databse. Please reconnect the repository.` + `Repository ${owner}/${repo} not found in database. Please reconnect the repository.`- sucess: true, + success: true,- `Repository ${owner}/${repoName} not found in databse. Please reconnect the repository.` + `Repository ${owner}/${repoName} not found in database. Please reconnect the repository.`- sucess: true, + success: true,Also applies to: 106-106, 174-174, 198-198
|
|
||
| await inngest.send({ | ||
| name: "pr.review.requested", | ||
| id: `review-${repository.id}-${prNumber}`, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n lib/ai/actions/index.ts | head -220Repository: 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.
| const githubAccount = repository.owner.accounts[0]; | ||
| await inngest.send({ | ||
| name: "pr.summary.requested", | ||
| id: `review-${repository.id}-${prNumber}`, |
There was a problem hiding this comment.
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.
| 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.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.