I3098 — Waiting derives take the machine's derive lock in the order they arrived
Give lib/machine_lock.sh a queue: a waiting derive writes a ticket (arrival time, pid, branch) under <home>/.derive.queue, the lock goes to the oldest ticket whose pid is alive, a ticket whose pid is gone is reaped, and the priority marker still overrides the order; the waiting line names the position (\"2nd of 4, behind <branch>\") and the brief's derive row shows the queue.
OVĚŘIT vlna 0 · p1 · profil implementation · bezpečné souběžně
Součást development-runtime — The runtime has a development surface.
Implementace je hotová a požadované důkazy ne. Zůstává tady, dokud za každým tokenem níže nestojí příkaz: dokončení se řídí důkazy, ne tvrzením.
Cíl
Give lib/machine_lock.sh a queue: a waiting derive writes a ticket (arrival time, pid, branch) under <home>/.derive.queue, the lock goes to the oldest ticket whose pid is alive, a ticket whose pid is gone is reaped, and the priority marker still overrides the order; the waiting line names the position (\"2nd of 4, behind <branch>\") and the brief's derive row shows the queue.
Proč
On 2026-10-20 three derives of one session waited 40 to 150 minutes on the lock while derives that started later took it: the lock is a directory every waiter polls with mkdir every 15 s, so the next holder is whichever poll lands first after the holder leaves. Sessions asked the release seat to hand-edit .derive.priority to get a turn, which is the agreement the lock was written to replace.
Aktuální stav
machine_lock.sh takes <home>/.derive.lock by mkdir and polls every MAJORDOMUS_DERIVE_POLL seconds; there is no ticket, so arrival order is not kept, and the waiting line names only the holder.
Cílový stav
Waiters are served in arrival order unless the priority marker names a branch; each waiting line and `majordomus brief` say the position and who is ahead.
Rozsah
- lib/machine_lock.sh
- scripts/derive
- test/cases
- .ai/repo/project/issues/I3098.yaml
Mimo rozsah
- The offload queue on other machines (I2398)
Závislosti
Žádné. Tento úkol je kořenem grafu.
Kritéria přijetí
- Two waiters that arrive in order A then B take the lock A then B, whichever polls first
- A ticket whose pid has died is reaped and does not hold the queue
- The priority marker still serves its branch first
- The waiting line names the position and the branch ahead
Validace
- env -u MAJORDOMUS_SHARE bash test/run.sh 1018
Požadované důkazy
- arrival_order_is_kept
- dead_ticket_is_reaped
Důkazy
Nic nezaznamenáno. Za každým tokenem výše musí stát příkaz nebo artefakt, než lze tento úkol dokončit; vyprávění se odmítá.
Časová osa
- zahájeno
- 2026-10-21T00:49:21Z
- ověřeno
- 2026-10-21T00:50:10Z
- dokončeno
- —
Tato tři pole, důkazy výše a stav závislostí jsou vše, z čeho se stav skládá. Neexistuje žádné pole stavu, které by s nimi mohlo být v rozporu.
Canonical record: .ai/repo/project/issues/I3098.yaml. Read it back with majordomus plan show I3098.