Skip to content

Commit f9a96da

Browse files
committed
docs(daemon): name the lock premise the ownership re-read rests on
1 parent 5ac0baf commit f9a96da

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎src/daemon/server/server-lifecycle.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ export type InfoRemoval =
8181
* Every refusal is fail-closed, including `unproven` for a record that agrees on pid but on no start
8282
* time. Keeping such a record leaves a client to find a dead pid, which its own liveness check
8383
* already recovers from; removing one that belongs to a successor is the unrecoverable direction.
84+
*
85+
* The read and the unlink are not one atomic step, and there is no check-and-delete primitive to make
86+
* them one. What closes the gap is the daemon lock the caller still holds: a successor can only reach
87+
* `writeInfo` after {@link acquireDaemonLock} steals it, and stealing it requires
88+
* `isAgentDeviceDaemonProcess` to prove the holder dead — which this process running this line is not.
89+
* The premise is therefore that nothing removed the lock out from under us, and #3105 records the one
90+
* path that currently breaks it by clearing the lock without proving ownership.
8491
*/
8592
export function removeInfoOwnedBy(infoPath: string, owner: OwnerIdentity): InfoRemoval {
8693
const ownership = readRegisteredDaemonOwnership(infoPath, owner);

0 commit comments

Comments
 (0)