fix(daemon): start a lease's TTL when its allocation completes

Merged
AM
2mo ago
+156-10

Summary

Split out of #3118. This change affects every provider.

leases.allocate used to start the lease TTL when allocation began. A hosted provider can spend 30โ€“80 s creating its session, so a 60 s lease could expire before the caller got it. The TTL now starts when allocation completes. Two cases are unchanged:

  • If the requester cancels, the lease is not renewed.
  • If allocation fails, the lease is released as before.

A lease allocated without a provider keeps the TTL it was created with. It no longer holds a work pass, which used to renew it on release.

ADR 0007 and remote-proxy.md are updated to match.

Validation

  • pnpm check:affected --run passes.
  • New tests cover:
    • an allocation that outlasts the TTL;
    • a lease without a provider keeping its original TTL;
    • artifacts after a slow allocation and after a cancelled one.

๐Ÿค– Generated with Claude Code