Repository navigation
Closed
Description
Purpose
Make a lease mean the same thing on every transport. Today a held lease is defined by a unix-socket connection the daemon owns (daemon-initiated heartbeat, release on close), and a detached lease is a TTL the client renews. HTTP can only offer the second, and a gateway (#see ADR 0005) would have to emulate the first. ADR 0004 (docs/adr/0004-ttl-first-leases-on-every-transport.md) collapses the two into one model.
Decision being implemented
- One kind of lease:
ttlMs+expiresAt, kept alive only by client-initiatedlease.renew. - "Held" is a client policy: the CLI's default
simlock leaseand the MCP session renew every third of the TTL and release on exit.--detachmeans "do not stay alive"; same lease. - Connection close means nothing to a lease. No per-connection lease state in the daemon; no release on disconnect on any transport.
lease.heartbeat, theheartbeathello capability,lease.heldTtlBackstopMs,lease.heartbeatIntervalMs, andmodeonlease.requestare removed.lease.detachedTtlMsbecomeslease.defaultTtlMs(15 min); newlease.maxTtlMs(4 h) caps a request or renew.StartupConverger's orphaned-held-lease sweep goes away; startup restores every lease's TTL timer.
Required work
- Contract: drop
lease.heartbeatandmode; acceptttlMson everylease.request;BAD_REQUESTabovelease.maxTtlMs. - Daemon: delete the heartbeat push, the held set, and release-on-close; one expiry path.
- Config: rename/remove the three keys, warn on the old names in
simlock config. - CLI: held mode renews on a timer and releases on exit, parent death, or a catchable signal;
--detachskips the timer. - MCP: same policy for the session's lease.
- HTTP: drop the "detached-only" wording; nothing else changes.
- Docs:
CLI.md,CLIENT.md,HTTP-API.md,CONFIGURATION.md,ARCHITECTURE.md("Leases"), changelog (breaking, 0.x).
Completion conditions
- A lease granted over the socket, over HTTP, and via MCP expires at
expiresAtunless renewed, with no other mechanism. - A CLI holder that exits normally releases at once; one killed with
SIGKILLfrees its device atexpiresAt. - No daemon code path references a lease mode or a held set.
Related
- ADR 0005 / gateway mode depends on this landing first.
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix(lease-policy,cli,mcp): treat UNKNOWN_LEASE on renew as the end of…
fix(mcp): close a session without leaking a renew timer or losing the…
fix(mcp,lease-policy): renew every lease a session holds, apply answe…
fix(mcp,lease-policy): one shutdown budget, and tell the holder when …
feat(cli,mcp): clients renew their own leases (ADR 0004, PR A)
fix(lease-policy,cli,mcp): make client renewal survive a bad answer
fix(lease-policy,cli,mcp): close the second review round's gaps
fix(lease-policy,cli,mcp): treat UNKNOWN_LEASE on renew as the end of…
fix(mcp): close a session without leaking a renew timer or losing the…
fix(mcp,lease-policy): renew every lease a session holds, apply answe…
fix(mcp,lease-policy): one shutdown budget, and tell the holder when …
feat(cli,mcp): clients renew their own leases (ADR 0004, PR A)
fix(lease-policy,cli,mcp): make client renewal survive a bad answer
fix(lease-policy,cli,mcp): close the second review round's gaps
fix(lease-policy,cli,mcp): treat UNKNOWN_LEASE on renew as the end of…
fix(mcp): close a session without leaking a renew timer or losing the…
fix(mcp,lease-policy): renew every lease a session holds, apply answe…
fix(mcp,lease-policy): one shutdown budget, and tell the holder when …
docs(adr): 0004 TTL-first leases, 0005 gateway and worker modes (#121)
docs: describe TTL-first leases end state, accept ADR 0004 (PR C) (#122)
feat(cli,mcp)!: clients renew their own leases (ADR 0004, PR A) (#124)
feat!(daemon,contract): one TTL-first lease on every transport (ADR 0…
V3RON commentedon Sep 9, 2026
Implemented per ADR 0004: TTL-first leases are live on every transport —
lease.heartbeatand the held-set/heartbeat config have been removed, andlease.defaultTtlMs/maxTtlMsare in the contract and tested. Closing as done.