Save sessions compare-and-set on their stream version
Two executors on one device database can no longer overwrite each other's session changes.
An old executor still in its shutdown grace could record a turn’s end from a stale read and quietly undo what the new executor had just saved. In the test, a rename to “Wrapped up” reverted to “Finish up”.
Session writes now check the stream version they read (UPDATE ... AND version = ?, inside BEGIN IMMEDIATE transactions). A mismatch fails as stale. Writers that record what the agent reports, plus rename and archive, re-read and retry up to three times. Other writers now fail as unavailable instead of overwriting, and the sender’s retry is answered through replay handling.
Evidence
No screenshot: Backend change; nothing to screenshot.