Opus finding
Onboarder summary may double-fire across retries (no idempotency guard)
mediumbugmedium
- apps/web/lib/review-worker.ts:245-264
- apps/web/lib/review-worker.ts:240-245
The comment says runFirstReviewSummary self-gates on first-review-only. If a review attempt fails AFTER runFirstReviewSummary succeeds (e.g. postPRComment throws on a 503), the row goes to pending_retry. On the next retry the entire processClaimedRow runs again — including runFirstReviewSummary. Whether this double-fires depends entirely on the onboarder's internal idempotency. The PR slice does not expose that code so the guarantee is unverifiable here, but the worker should defensively skip the onboarder call (and/or check a flag) when processingAttempts > 1. As written this is a foot-gun for partner-visible duplicate onboarding messages.
Recommendation
Either (a) move the onboarder call to AFTER successful comment posting + lifecycle persist so it runs at most once per successful review, or (b) document the idempotency contract that runFirstReviewSummary must satisfy and add a unit test pinning it.