Skip to content

spec(queen): review_lanes.t27 - a review with no lane free waits for one in a bounded queue #8579

Closed

Description

@gHashTag

Problem

Part of gHashTag/trios#1712 (night loop ledger gHashTag/trios#1729, item 4).

On the reviewer benchmark (gHashTag/trios tests/api/queen-actors-bench.test.ts, second table, one seeded input), the adaptive reviewer pool from specs/queen/reviewer_sizing.t27 (#8275, gHashTag/trios#1716) loses to the fixed 4 when lanes are scarce. With 3 free lanes it reviewed 360 of 660 rows against 429 (overload 120/h), and 352 of 365 against 365 (burst of 120).

The cause: a review holds its model lane only during its model call. It asks for the lane 30% of the way in. With no lane free, it answers wait. So a pool capped at the lane count leaves the lanes idle during the first 30% of every review. The fixed 4 overlaps that phase, and pays with 427 lane-less wait visits. Each of those visits throws away a witness and a criteria measurement, and due_again pushes the row back.

Spec

specs/queen/review_lanes.t27 imports REVIEW_ROW_SECONDS and REVIEWER_CEILING from reviewer.t27 and pool_target from reviewer_sizing.t27; it does not restate them. It says:

  • a review that reaches its model call with no lane free waits in a queue owned by one actor, and does not answer wait;
  • the queue bound: one waiter for each review in a model call (queue_admits); past the bound the review answers wait at once, the way Discord's semaphore fails fast;
  • fairness: oldest first (grant_before, by ticket = review start); the head retries on a release and at the heartbeat (head_tries);
  • the longest wait: until the model call would no longer fit the row (wait_left_seconds, with MODEL_CALL_SECONDS = 120);
  • what counts: a row given back is a wait for due_again and never a reviewer miss; a stopped turn leaves the queue (lane_answer, gives_row_back);
  • pool and queue together: the pool may exceed the lanes by the measured lane-less share (hold_percent, samples_halve, queue_lanes, pool_target_queued). Until that share is measured the pool is the reviewer_sizing pool.

Acceptance criteria

  1. t27c test-report specs/queen/review_lanes.t27 shows 0 FAIL and 0 vacuous tests.
  2. Each new rule, broken once, makes test-report FAIL or blocks compilation.
  3. The seal is saved.
  4. The runtime lands in gHashTag/trios on actors-next-2 behind TRIOS_QUEEN_REVIEW_LANES=semaphore, with the benchmark posted on Queen moves to the actor model: the rule in every AGENTS.md, an MVP, a benchmark, then the swap #7851.

User Scenarios

  • Given a review reaches its model call and no lane is free, When the review enters the queue, Then it waits in the queue owned by one actor and does not answer wait.
  • Given the queue has reached its bound of one waiter per review in a model call, When a new review arrives, Then it answers wait at once (fail-fast).
  • Given multiple reviews are waiting in the queue, When a lane is released, Then the oldest review (by ticket = review start) is granted the lane first.

Requirements

  • FR-001: A review that reaches its model call with no lane free MUST wait in a queue owned by one actor and MUST NOT answer wait.
  • FR-002: The queue bound MUST be one waiter for each review in a model call (queue_admits); past the bound the review MUST answer wait at once.
  • FR-003: Fairness MUST be oldest first (grant_before, by ticket = review start); the head MUST retry on a release and at the heartbeat (head_tries).
  • FR-004: The longest wait MUST be until the model call would no longer fit the row (wait_left_seconds, with MODEL_CALL_SECONDS = 120).
  • FR-005: A row given back MUST count as a wait for due_again and MUST never be a reviewer miss; a stopped turn MUST leave the queue (lane_answer, gives_row_back).
  • FR-006: The pool and queue together MUST allow the pool to exceed the lanes by the measured lane-less share (hold_percent, samples_halve, queue_lanes, pool_target_queued); until that share is measured the pool MUST be the reviewer_sizing pool.

Boundary

  • specs/queen/review_lanes.t27
  • specs/queen/reviewer_sizing.t27
  • specs/queen/reviewer.t27
  • specs/queen/waits.t27
  • specs/tri/collections/queue.t27
  • specs/docs/chapters/queen.t27
  • docs/system/queen.md
  • compiler/cli/spec.t27

Activity

  1. added a commit that references this issue on Oct 10, 2026
    3c0ae4d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions