Files
archie/internal
sam 8ae21f25db fix(nell): honour the transition guard on the backend that ships
cmd/archied opens nell.OpenStore, not internal/store. Adapter.Transition
and Adapter.Requeue accepted a from status and never read it: they loaded
the document, overwrote the status and put. ErrStaleTransition could not
occur, so every compare-and-swap the callers depend on was absent in
production while passing in tests, which use the SQLite store.

Measured on the adapter: eight concurrent dashboard retries requeued one
task four times; twenty concurrent IncrementRetryCount calls landed a
count of one, so the retry cap added in 170fe02 could be evaded
indefinitely by holding Retry down. The same gap made approve and reject
read-then-write races -- a waiting_human task the daemon had since
claimed could be yanked back to queued and executed twice.

All three now take the adapter's existing mutex and check the guard. A
document store has no conditional update, so read-then-write has to be
serialised; the daemon is a single process, which is where the
concurrency is. No internal caller holds the lock when calling these, so
there is no self-deadlock.

Found by the adversarial review. It is the clearest argument yet for the
conformance-suite pattern: the guarantee was tested only on the backend
nobody runs.
2026-08-05 05:51:58 +10:00
..