Skip to main content

Module wan_lease

Module wan_lease 

Source
Expand description

One live instance per agent across the WAN — the client side (docs/specs/SPEC_AGENT_SINGLE_LIVE_INSTANCE_2026_09_24.md Phase 5, §4.5).

The muxbus relay holds one lease per agent. This instance claims it for every agent it polls jekts for, renews it while the agent stays registered, and releases it when the agent goes away. While another instance holds it, the relay answers this instance’s pending pulls with 409 — so it cannot consume the other instance’s jekts — and this module reports the agent as held elsewhere, which fences the local holder (the newcomer yields, D1).

Fails open everywhere (D2): a relay without the lease routes (404), an unreachable relay or a transient error never stops delivery or spawning.

Structs§

HeldBy
What the relay says about another install holding an agent’s lease.

Enums§

Holder
The relay’s answer to “which install holds agent’s lease?” — GET /agents/lease/:agent_id (docs/plans/PLAN_JEKT_LOCAL_FIRST_ROUTING_2026_10_02.md §7.1). Asked by a sender about a message’s target, so it never touches this instance’s own lease state ([record], admission): a read only.
Outcome

Functions§

forget_elsewhere
Drop a cached “held elsewhere” answer for agent — after a Take over freed it, so the retried turn isn’t refused from the cache for up to [HELD_ELSEWHERE_FRESH] (Codex P1 on #3899).
held_elsewhere
Some(where) when a recent answer said another instance holds agent. The early admission check refuses on it without a network round trip.
held_on_another_computer
Where the holder is when a recent relay answer put agent on another computer (a [describe_holder] description), else None.
held_on_this_computer_by
The channel of another instance on this computer that, per a recent relay answer, holds agent — what Take over needs to find it.
holder
Ask the relay who holds agent’s lease, as caller (the message’s sender, whose credential token is). Cached for [HOLDER_FRESH]; “unreachable” is never cached.
holder_on_this_computer
Is a [describe_holder] description about this computer (another AgentMux instance on the same host, e.g. a second channel)?
instance_id
This AgentMux instance’s id at the relay: host + channel. Stable across restarts of the same install, distinct between two installs on one host.