Commit Graph

3 Commits

Author SHA1 Message Date
LZH-YS1998 3a053e3af8 fix(company): drain review backlogs in arrival order instead of newest-first
Review tasks and review work items were prepended (appendleft) to the
role dispatch queue, so whenever a reviewer had more than one review
waiting, the newest submission was always claimed first. Under a
sustained flow of submissions the oldest review could be postponed
indefinitely because every new arrival jumped ahead of it. Observed on a
real run: with two reviews waiting on the same manager seat, the one
created 30 seconds later was reviewed first while the earlier one waited
another seven minutes.

The prepend was redundant for its stated purpose: review-before-regular-
work priority is already enforced at pop time, where
_pop_next_queue_entry pulls the first review entry found anywhere in the
queue. Its only net effect was inverting the order among reviews.

The role serial queue (FIFO, on by default) could not compensate:
its enqueue hook only fires on phase transitions, and review work items
are inserted directly in READY, so they never enter the serial queue.

Fix: append review entries like everything else. Reviews now drain in
arrival order among themselves while still preempting regular work,
including on the blocked-manager soft-wake path.

Tests: three regressions (pop drains a review backlog oldest-first;
enqueue_runnable_work_items preserves arrival order across batches —
the observed inversion scenario; same contract for the review-Task
path). The pre-existing queue-layout assertion that encoded the old
prepend behavior now asserts the pop-time preemption contract instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-31 19:10:32 +08:00
LZH-YS1998 5e02364eb4 fix(company): make delegation review lifecycle durable 2026-07-14 10:52:22 +08:00
LZH-YS1998 d78931979d Initial commit 2026-07-01 17:56:31 +08:00