Skip to content

TTL-first leases on every transport (ADR 0004) #114

Closed

Description

@V3RON

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-initiated lease.renew.
  • "Held" is a client policy: the CLI's default simlock lease and the MCP session renew every third of the TTL and release on exit. --detach means "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, the heartbeat hello capability, lease.heldTtlBackstopMs, lease.heartbeatIntervalMs, and mode on lease.request are removed. lease.detachedTtlMs becomes lease.defaultTtlMs (15 min); new lease.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.heartbeat and mode; accept ttlMs on every lease.request; BAD_REQUEST above lease.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; --detach skips 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 expiresAt unless renewed, with no other mechanism.
  • A CLI holder that exits normally releases at once; one killed with SIGKILL frees its device at expiresAt.
  • No daemon code path references a lease mode or a held set.

Related

  • ADR 0005 / gateway mode depends on this landing first.

Activity

  1. added 20 commits that reference this issue on Sep 5, 2026
  2. V3RON commented on Sep 9, 2026

    @V3RON
    ContributorAuthor

    Implemented per ADR 0004: TTL-first leases are live on every transport — lease.heartbeat and the held-set/heartbeat config have been removed, and lease.defaultTtlMs/maxTtlMs are in the contract and tested. Closing as done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions