Skip to content

A review job lease lasts as long as the review reservation #43

Backlog

Description

@edkog

A review reservation is written for reviewLease (30 minutes by default), but its job lease is taken for 2 minutes. The next reserve by any reviewer clears it once those 2 minutes pass without a fresh heartbeat. Reviewers waiting on a long check lose their item and another reviewer starts over.

rows:
  - C7
  - V15
env: "Node 26, Ubuntu 26.04 VM, one board with about 20 seats; reviewers wait on E2E runs of 20 minutes or more"
version: "0.9.5"
ran: "pullboard next --verify by one reviewer while another reviewer holds a reservation and waits on a long check"
cause: "reserveWithin() in packages/store/src/io/board/reserve/review.js sets item_review_until to now + leaseMs (reviewLease), then holdReviewLease() in packages/store/src/io/board/review/lease.js calls reserveReview() and renewReview() without leaseMs, so the job lease uses LEASE_MS (120000) from packages/jobs/src/logic/rules.js. sweepLapsedReviews() runs on every reserve and clears any reservation whose job lease lapsed while item_review_until is still in the future, unless the reviewer heartbeat is newer than 2 minutes."
blocks: "review of any item that needs a long check; on one board 18 of 53 releases in 4 hours were REVIEW_LEASE_LAPSED, some after 12 seconds past the job lease, and the same four items were re-reviewed by new sessions about 90 times in 8 hours"
compat:
  - A reservation whose reviewer is really gone still frees itself.
  - next without --verify still lapses an unstarted review in 5 minutes.
bar:
  - 1: a reservation made with reviewLease 30m is not cleared by another reviewer's reserve 3 minutes later when its reviewer sent no heartbeat [test]
  - 2: a reservation is cleared once reviewLease passes with no heartbeat or renewal [test, kept]
check:
  - 1: packages/store/tests/io/board/review/lease.test.js > job lease follows the reservation lease
  - 2: packages/store/tests/io/board/review/lease.test.js > silent reviewer loses the reservation after reviewLease
error: |
  {"review":true,"reason":"Review silent for 0 minutes; its reservation lease lapsed.","reasonCode":"REVIEW_LEASE_LAPSED","lapsed":{"reviewer":"review-47","lapsedMs":12511}}

Activity

  1. added
    See Research
    on Nov 24, 2026
  2. edkog commented on Nov 24, 2026

    @edkog
    Author

    Workaround we run locally on 0.9.5, in case it helps the fix: holdReviewLease() in packages/store/src/io/board/review/lease.js passes a leaseMs to renewReview() and reserveReview(). That leaseMs is the time left until the item's item_review_until, so the job lease lasts as long as the reservation, never less than the 2-minute LEASE_MS. A reviewer that really goes away still loses the item when item_review_until passes.

    const until = Date.parse(board.db.prepare('SELECT item_review_until FROM item WHERE item_id=?').get(id)?.item_review_until ?? '');
    const leaseMs = Math.max(120_000, Number.isFinite(until) ? until - now : 0);
    if (leases.renewReview(board.db, id, agentId, { now, leaseMs })) return;
    if (leases.reserveReview(board.db, id, agentId, { now, leaseMs }).reserved) return;
    leases.releaseReview(board.db, id, { now });
    leases.reserveReview(board.db, id, agentId, { now, leaseMs });

    More data from the same board on 2026-11-24: about 45% of all releases were REVIEW_LEASE_LAPSED (40 of 79 in one 6 h window, about 26 of 57 in the next).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    See Research

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions