You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9850f4c
Browse filesBrowse the repository at this point in the historyBrowse files
fix(daemon): recover provider leases a killed daemon left rented
The daemon kept live provider leases only in memory and persisted a lease
only once it had expired and its release failed. A daemon killed with
`kill -9` while it held a lease forgot the lease, so a rented cloud device
stayed billed until the provider's own idle timeout.
The lease registry now reports its provider leases whenever one is issued or
leaves, and the daemon journals those whose provider can recover an expired
lease in `live-provider-leases.json`. A daemon that starts and finds the
journal moves its leases into the expired-lease recovery, which runs at
startup and ends each rented device. The journal is dropped only after the
leases are in the expired record, so a crash between the two keeps them in
one file or the other.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copy file name to clipboardExpand all lines: docs/adr/0007-remote-device-leases.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,6 +85,12 @@ In-flight work and human-control holds still keep a lease from expiring.
85
85
After daemon shutdown begins, no new lease-end teardown starts.
86
86
Shutdown waits for any lease-end teardown that already started before it tears sessions down itself.
87
87
88
+
A provider lease that ends with its daemon still holds a rented device on the provider side, and that device stays billed.
89
+
Thus, the daemon journals the live leases of each provider that can recover an expired lease, in `live-provider-leases.json` in its state directory.
90
+
A daemon that starts and finds this journal hands each lease in it to the expired-lease recovery of its provider, which ends the rented device.
91
+
The lease itself is not restored, and its controller connects again.
92
+
Restoring the live lease was rejected: the sessions and device claims of the dead daemon are gone, so a restored lease would name a device that no session can reach.
93
+
88
94
When a request closes a session, the daemon ends the lease of that session, unless the lease was allocated with `retainOnClose`.
89
95
The reply to that request reports each lease that it ended once, at response level, as `endedLeases: [{ leaseId, outcome: 'released' }]`.
0 commit comments