Repository navigation
Description
Request: #1407
Problem
A coordinator, such as a CI job or an agent orchestrator, often leases a device for an agent it does not fully trust. That might be an agent working on a contributor's branch, or a job on someone else's machine. Today it can only give that agent its own token, or ask an operator for a token per job. An agent token is one identity: every agent that holds it can exec on, stream, upload to, renew and release every lease of that token, and exec is a shell on the worker. Tokens never expire, so a forgotten one keeps its rights until someone runs token revoke.
In the reporter's words: "To hand a device to a short-lived job safely we'd have to mint and revoke a token per job ourselves, and even then the token reaches more than that one lease."
Who it is for
- A coordinator that holds an agent token (or an operator token) and hands a device to an agent for one job.
- An operator who gives a person or a pipeline a token for a fixed time.
Outcome
- The owner of a lease can make a handover credential for that lease and give it to an agent. With it the agent can use that one device through agent-device, the screen, input, files and tunnels, renew the lease and end it. It cannot run commands on the worker (exec), lease anything else, or see the owner's other leases. The credential stops working the moment the lease ends, whoever ends it, and when the owner's token is revoked or expires.
- An operator can make an agent or operator token that stops working at a set time.
How it works for the user
sequenceDiagram
participant C as Coordinator (owner)
participant D as Worker or gateway
participant A as Agent
C->>D: simlock lease --platform ios (lease L1)
C->>D: simlock lease handover L1
D-->>C: slk_… (shown once)
C->>A: slk_…
A->>D: agent-device connect proxy … --daemon-auth-token slk_…, then open
D-->>A: opened on L1's device (no new lease)
A->>D: snapshot, screen, files …
A->>D: exec, another lease, a new lease
D-->>A: 403 FORBIDDEN
alt the agent ends it
A->>D: agent-device close
else the owner ends it
C->>D: simlock release L1
end
A->>D: any call with slk_…
D-->>A: 401 UNAUTHENTICATED
Before:
coordinator$ simlock token create --role agent --label job-42 # operator only
{"secret":"slk_9f…","token":{"id":"tok_ab12","role":"agent",…}}
agent$ SIMLOCK_TOKEN=slk_9f… simlock --url https://farm exec L7 -- uname -a # another job's lease
Darwin worker-3 …
After:
coordinator$ simlock --url https://farm lease handover lse_4b2e
{"secret":"slk_c3…","handover":{"id":"hov_77","leaseId":"lse_4b2e","createdAt":…}}
agent$ agent-device connect proxy --daemon-base-url https://farm/v1/agent-device --daemon-auth-token slk_c3… --session s1
agent$ agent-device open --platform ios --session s1 # opens on lse_4b2e's device
agent$ curl -X POST -H 'Authorization: Bearer slk_c3…' https://farm/v1/leases/lse_4b2e/exec …
{"error":{"code":"FORBIDDEN","message":"A handover credential cannot call device.exec"}}
agent$ curl -H 'Authorization: Bearer slk_c3…' https://farm/v1/leases/lse_9d01
{"error":{"code":"FORBIDDEN","message":"A handover credential reaches only lease lse_4b2e"}}
coordinator$ simlock --url https://farm release lse_4b2e
agent$ curl -H 'Authorization: Bearer slk_c3…' https://farm/v1/leases/lse_4b2e
{"error":{"code":"UNAUTHENTICATED","message":"Unknown bearer token"}}
operator$ simlock token create --role agent --label contractor --expires-in 7d
{"secret":"slk_…","token":{"id":"tok_cd34","role":"agent","label":"contractor","createdAt":…,"expiresAt":…}}
# eight days later
{"error":{"code":"UNAUTHENTICATED","message":"Token tok_cd34 expired at 2026-12-04T09:00:00.000Z"}}
Examples
What a handover credential for lease L1 may reach (B5, B6):
| Call | Owner's agent token today | Handover credential for L1 |
|---|---|---|
GET /v1/leases/L1, /events, /renew, DELETE /v1/leases/L1 |
allowed | allowed |
/v1/leases/L1/stream, /input, /tunnel, /files*, /rotate |
allowed | allowed |
POST /v1/leases/L1/exec |
allowed | 403 "cannot call device.exec" |
POST /v1/leases/L1/handovers |
allowed | 403 "cannot call lease.handover" |
| any route of lease L2 the owner holds | allowed | 403 "reaches only lease L1" |
GET /v1/leases |
the owner's leases | L1 only |
/v1/lease-requests*, /v1/status, /v1/devices*, /v1/catalog, /v1/stats, /v1/events*, /v1/inbox, /v1/tokens, /v1/stream/workers/*, every admin route |
per role | 403 "reaches only lease L1" |
GET /v1/identity, GET /v1/healthz |
allowed | allowed (via: "handover") |
GET /v1/session (remote CLI, MCP) |
allowed | allowed; each call held as above. The MCP tools act only on a lease their own session was granted, so not on L1 |
agent-device open |
leases a new device | opens on L1's device |
agent-device open a second time while the first is open |
a second lease | refused: L1 is already open |
agent-device open with --device, --os, --image-tag, --device-mode, --device-baseline, --physical, or another platform, --udid or --serial |
a new device of that kind | refused: the handed-over lease's device is already chosen |
agent-device disconnect |
ends the lease | ends L1 when a session is open, as close does; with none, L1 stays |
agent-device connect --force |
ends the previous lease | ends agent-device's lease, L1 stays |
agent-device devices, session list |
the token's | L1's only |
--expires-in on token create (B1):
| Input | Today | After |
|---|---|---|
| none | never expires | never expires |
7d, 12h, 90m |
flag unknown | expires that long after create |
30s, 0, 59999 (ms) |
flag unknown | refused by the daemon: under one minute |
90000 (a bare number is ms: 90 s) |
flag unknown | expires 90 s after create |
3651d |
flag unknown | refused by the daemon: over 3650 days |
-1h, 7days, 1.5h |
flag unknown | usage error: not a duration |
--role worker --expires-in 1d |
flag unknown | refused: a join token cannot expire |
What could go wrong
- An agent with a handover credential finds a route or front path that still reads only the owner's identity and reaches the owner's other leases. The two allowlists keep a new route refused until someone adds it; the Examples table is the test.
- For about a minute after a gateway restart, a handover credential for a lease whose worker has not reported yet is refused. Its row is kept, so the agent's retry works once the worker reports.
- A worker that stays offline for more than a minute across a gateway restart has its leases read as ended, and their handovers are deleted. The owner makes a new one once the worker is back.
- An operator sets
--expires-intoo short and a pipeline stops mid-run with "expired". The message names the token and the time.
Words used
- handover credential: an
slk_secret made for one lease by its owner, e.g.simlock lease handover lse_4b2e. It acts as the owner on that lease only. - owner: the identity a lease belongs to. Over HTTP it is the token that requested the lease, e.g.
tok_ab12. - principal: the identity a call is made as. For a token it is the token's id; for a handover credential it is the lease owner's.
- scope: the one lease a handover identity is held to.
- live lease: a lease that has not ended or expired on the daemon that made the credential.
- agent-device lease id: the id agent-device makes up at
open, 32 hex characters, e.g.669b4a9e18d9144c093269b9b94a0bb9. Today the front uses it as the simlock lease id too. For a handed-over lease simlock replaces it with its own, and the agent's CLI goes on with that one.
Non-goals
- Exec,
simctloradbpassthrough with a handover credential, in any form or behind any flag. - A handover credential that outlives its lease or its owner's token, moves to another lease, or makes another handover.
- Listing or revoking handover credentials one by one. Ending the lease ends them all;
token revokeof the owner ends that owner's. - An MCP tool or a console page for handovers.
- A default lifetime for tokens, an expiry on worker join tokens, or changing a token's expiry after it is made.
- Isolating agents that share one token from each other: one token per agent stays the advice.
- Any change to agent-device.
Completion conditions
- On a worker and through a gateway, an owner makes a handover credential for a lease made with
simlock lease(through a gateway with--requires agent-device); with it an agent runsagent-device open, takes a screenshot, uploads a file and opens the screen stream on that lease's device, and is refused exec, any other lease and a new lease. - After the agent's
agent-device close, and after the owner'srelease, the credential is refused at once on every route. - A token made with
--expires-in 2mworks, then is refused with "expired" after two minutes, and a remote session or screen stream opened with it ends at that time; a handover made by that token is refused from the same moment. token createwithout--expires-inbehaves as today.
Open questions
none
Decisions
- ADR 0098 — A lease owner hands one lease to an agent with a credential that dies with it: the handover call, the scope and its two gates, no exec, death with the lease and the owner's token, agent-device attaching with two ids, the gateway's own.
- ADR 0093 — An agent or operator token may carry an expiry:
--expires-in, refusal,expiresAton the identity. - Maintainer, in the session: exec is banned for handover credentials; agent-device is in the first version; token expiry is in this feature;
agent-device closeon a handed-over lease ends the simlock lease, so either side may end it; a handover dies when its owner's token expires; the front maps agent-device's lease id onto the handed-over lease, with no agent-device change. - Decided in the session: the handover is its own call after the grant, not a flag on
lease.request, because a grant is re-read and replayed and a secret in it would be shown more than once. - Decided in the session: a handover identity carries the lease owner's principal plus its scope, because every ownership check then works unchanged For an operator's handover the principal is still the lease's owner, never the operator's.
- Decided in the session: the scope is enforced by two allowlists, the dispatcher (every operation, every transport) and the HTTP path gate (every route), and by the agent-device front, because a new route or operation is then refused until someone adds it.
- Decided in the session: a handover binds to the lease id and the lease's
grantedAt, because a requester-chosen id can be granted again afterlease.endedIdRetentionMs. - Decided in the session: liveness is read at every verify and every scoped call; a row is deleted only when its lease is known ended, never while the daemon cannot yet tell, because a gateway's lease index is empty until its workers report.
- Decided in the session: handover verification is its own auth strategy,
handover, asked first, because a strategy'sviamust equal its name and an unknownslk_token is refused by the token strategy. - Decided in the session: tunnels are allowed, because a tunnel reaches only the lease's own device ports (an iOS simulator's listener is checked by its
SIMULATOR_UDID). - Decided in the session: the agent needs no lease id: agent-device 0.21.41 through the proxy ignores
--lease-idand makes up its own (run against a stub on 2026-11-27:connect proxy --lease-id lse_abc123, thenopen, sentleaseId: "669b4a9e18d9144c093269b9b94a0bb9"), and the credential already names the lease. - Decided in the session: one agent-device lease at a time per handed-over lease, because a lease holds one device and agent-device holds one device per session.
- Maintainer, 2026-11-30: redesign the attach, after a review found seven overlaps the first build did not handle.
- Decided in the session: one object per attach, on the worker, owns an open from before it is sent until it is released (S4), because tables joined by agent-device's id left a gap at each overlap of an open, a close and the lease's end.
- Maintainer, 2026-11-30: redesign the attach again after a spike on real agent-device: simlock chooses agent-device's lease id and a random tenant per grant, removes folders by that tenant, and holds the fake to the real program. The first redesign let the wire's id and session names decide what a lease's end removes, and each fix of that opened another hole.
- Maintainer, 2026-11-30: a release the CLI sends by itself (an open it rolls back,
connect --force) ends only agent-device's lease;agent-device close,agent-device disconnectwith a session open (the same close on the wire) andsimlock releaseend the handed-over lease. - Maintainer, 2026-11-30: an open that asks for a device (another platform or address,
--device,--os,--image-tag,--device-mode,--device-baseline,--physical) is refused before anything opens, because the handed-over lease's device is already chosen. - Decided in the session: the front marks its re-allocate, because after a worker restart the worker cannot tell it from an open and would answer with an id the agent never learns.
- Decided in the session: a new agent-device id for each open, because agent-device never issues an id twice (X31).
- Decided in the session: the tenant is random and the worker's, because a name made from ids can collide or be chosen, and a worker's own tenant needs no gateway change. The owner and the agent so share no agent-device session, upload or artifact.
- Decided in the session: S4 takes the id from the reply, because agent-device may answer with an earlier lease of the same client.
- Decided in the session: the folders are found by reading
sessionsfor the tenant's prefix, because only the tenant says whose a folder is. - Decided in the session: the fake and real agent-device run one table of lease calls (I10), because the fake had
releasedin another place than the real reply and a wrong fix passed. - Decided in the session: the owner's own calls keep today's ids, tenants and folders; their shared session folder is Agent-device lease calls write to an untenanted session folder that no lease end removes #2003.
- Decided in the session: where no call through the front can show a case, the test drives the attach, the S3 map or the link directly, because a guard nothing proves would go unnoticed when removed.
- Decided in the session: an attach is keyed by the lease's id and its grant time, because the owner may choose an id again.
- Decided in the session: a first open that did not succeed is settled by sending the same allocate again, because a lost reply and a refusal look alike, the device key a release needs is only in the reply, and agent-device answers a repeated allocate with the same lease.
- Decided in the session: S4's settle, release and re-allocate around an open have 10 s, the bound a re-allocate has today; L1's end waits as an owner's lease's end does, because agent-device's release waits for a running command.
- Decided in the session:
devicesis answered with no open, becauseopenitself may need it. - Maintainer, 2026-11-30: after a restart a call without an open gets agent-device's own LEASE_NOT_FOUND, so the CLI opens again by itself; a failed re-allocate keeps the open and tries again; an unsettled open has its own "try again" message.
- Decided in the session:
--expires-intakes 1 minute to 3650 days through the one duration parser, and the operation takesexpiresInMsso the daemon's clock sets the time. - Decided in the session: an expired token stays in
token listuntil revoked, and is refused with its own message, so an operator sees what ran out.
Behaviours
| Id | Behaviour (invoker, action, what it sees) | Seam | Cases | Task |
|---|---|---|---|---|
| B1 | An operator runs token create with --expires-in; the answer and token list carry expiresAt |
simlock token create (CLI) and token.create (worker and gateway dispatchers) |
through a gateway → the same as a worker; none → no expiresAt; 7d → now + 7 d; 30s, 0, 3651d → I1 range refusal; -1h, 7days → I2 usage error; --role worker --expires-in 1d → I1 worker refusal |
#1904 |
| B2 | A caller with an expired token is refused everywhere a token is checked | authenticateRequest and resolveHelloRole (src/auth) |
HTTP before expiry → identified with expiresAt; HTTP at or after → 401 I3; socket hello with an expired operator token → AdminAuthenticationFailedError; a token with no expiry → as today |
#1904 |
| B3 | A remote session, a screen stream and an event stream opened with an expiring token end at its expiry | /v1/session upgrade, /v1/leases/{id}/stream, /v1/events/stream (HTTP app) |
session closes at expiresAt; stream ends at expiresAt; an expiry further off than one timer holds (2^31-1 ms, 24.8 days) → neither ends early; token with no expiry → unbounded, as today |
#1904 |
| B4 | A lease's owner makes a handover credential; the secret is shown once | lease.handover (dispatcher), POST /v1/leases/{id}/handovers, simlock lease handover |
owner → 201 with I4's answer, S2 owner_id = the lease's owner; simlock lease handover over the local socket and with --url (/v1/session) → the same answer; operator on another's lease → 201, owner_id = the lease's owner; another agent → 403; unknown lease → 404 UNKNOWN_LEASE; a handover identity → 403 I6; two handovers of one lease → two working secrets; through a gateway → stored on the gateway |
#1905 |
| B5 | A handover identity calls an operation; only the allowlist on its own lease runs, on every transport | runDispatch (src/daemon/dispatch.ts) on a worker and a gateway, over HTTP and over /v1/session |
lease.get, lease.renew, lease.release, device.rotate on L1 → run; the same on L2 → 403 I6; device.exec, lease.request, lease.cancel, lease.handover, an admin operation → 403 I6; lease.list on a worker and on a gateway → L1 only; identity.get → via: "handover"; over /v1/session the same answers as over HTTP |
#1905 |
| B6 | A handover identity calls an HTTP route; the path gate passes only its own lease's paths and the shared ones | requireAuth's scope gate (src/http) |
GET /v1/leases, /v1/leases/L1 and every path under it → passed on (then B5 for operations); any path of L2 → 403 I6; /v1/identity, /v1/healthz, /v1/session → passed on; /v1/agent-device/* → 403 I6 until #1906 opens it with the front's checks (B10, B11); every other path → 403 I6 |
#1905 |
| B7 | A handover credential stops working the moment its lease ends | the handover strategy with I7, on a worker and a gateway |
lease live → identified; released by the owner → 401 "Unknown bearer token"; released by the agent → same; expired by TTL → same; a lease granted later under the same chosen id → same (grantedAt differs); a remote session opened before the end → its next call is refused 401's words and the session closes 4003 |
#1905 |
| B8 | A handover dies with its owner's token | the handover strategy |
owner token live → identified, expiresAt = the owner token's; owner token expired → 401 "Unknown bearer token"; owner token revoked → same, and the revoke deleted the owner's S2 rows and closed their sessions 4003; owner not a token (local socket, proxy person) → no owner check |
#1905 |
| B9 | Handover rows are removed only once their lease is known ended | S2 deletes | worker start: rows whose lease the loaded registry lacks → deleted; worker verify of an ended lease → deleted; gateway verify inside its start window with the lease unknown → refused, row kept; gateway verify after it with the lease unknown → deleted; live lease → kept | #1905 |
| B10 | An agent with a handover credential runs agent-device open; the path gate now passes /v1/agent-device/*, and the front opens agent-device on L1's device and leases nothing |
agent-device front (src/agent-device/front), worker link and gateway relay link, S4 |
open → forwarded on L1's device, its platform and backend set from the device, with a lease id S4 makes up in place of the one the CLI sent, no lease.request, S3 set with the reply's lease id and deviceKey, and the CLI's later calls name that id (X37) and the call's retainOnClose; an open naming another platform or backend than L1's device's, or --device, --os, --image-tag, --device-mode, --device-baseline or --physical, or a udid or serial that is not L1's address → refused I8 before anything is sent, one case per flag, and the next open works; its own platform, or none, or L1's own address as udid or serial (what the CLI sends after it listed devices, X34) → opens; --target → not read, as the device decides it; L1 on a worker where agent-device is off → the front's existing not-available reply; L1's worker not connected or not yet read → the front's existing "try again" reply; a second open while S3 is open, or while the first open is still waiting → refused I8; L1 made by the owner's own agent-device call and still open there → refused I8; an open naming the id of another lease, the owner's or another token's → agent-device never sees that id, and the open works as any other; any other reply but success, a hang-up, a timeout or a dropped uplink → S4 settles what that open may have made, and the next open works, from the same CLI or another; settling it failing → the next open answers I8's "could not end an earlier open" until it works; agent-device restarted and the front's re-allocate failing or over 10 s → nothing released, S3 and S4 kept, the existing "being restored" reply, and the next heartbeat tries again |
#1906 |
| B11 | Every front call with a handover credential is held to L1 | agent-device front, worker and gateway | a call naming the attached agent-device lease → forwarded with S4's tenant; naming another lease, the owner's L2 included → 403 I8; naming none (session list, devices, close) → handled as a call naming the attached lease, sent with S4's tenant instead of the principal's; while S3 is not open: devices → L1's device only, read from the link's facts of L1 and forwarded to its daemon under S4's tenant, since open without --platform, or with --udid or --serial, lists before it allocates (X34); every other call but an allocate and /health → I8's LEASE_NOT_FOUND, forwarding nothing; L1 on a phone → every call, naming a lease or none, worker or gateway, goes to the phone daemon; heartbeat → renews L1 as today; an allocate, heartbeat or release names the session <S4's tenant>:lease, whatever session the CLI sent; a command keeps the CLI's session; a non-RPC call (upload, artifact, diagnostics of a session of S4's tenant) → forwarded with S4's tenant; the owner's other map entries are never read or marked ended by a scoped call |
#1906 |
| B12 | agent-device close by the agent ends L1, and L1's end releases the agent-device lease |
front close and release paths, S4, the host's lease end | close, naming the lease or none, before or after agent-device forgot the lease and the front allocated it again → agent-device lease released, then lease.release of L1; then the credential → 401 (B7); disconnect with a session open sends the same close, and ends L1 as close does; an agent_device.lease.release from the CLI (connect --force, an open it rolls back, disconnect with no session open) → agent-device's lease is released and S3 dropped, L1 and the credential stay, and the next open works; S3 is dropped on exactly the replies that end a release for S4: success with released true, success with released false (agent-device restarted or let its lease lapse), a LEASE_GONE code; any other reply or none → S3 stays; close after an open with retainOnClose → both leases stay, as for a lease the front made (ADR 0070 §2); the owner's release → the host releases the attached agent-device lease by the id agent-device's reply named and removes every entry of the daemon's sessions folder named <S4's tenant>_…, agent-device running or not, and no other; the agent's next call → 401 (B7); while L1 was open the agent's session was named as another lease's folder, or another lease has a session of the same name → that lease's folders stay; the owner's release while a command runs → the end waits for agent-device's release under leasing's signal, past 10 s, and removes the folders after it; a sessions folder that is missing → the end succeeds; another token's allocate naming the attached lease's agent-device id, refused by agent-device, and the end of the simlock lease made for it → the attached lease and its folders stay; L1 ends while an open is waiting → that open is cut, its agent-device lease is released by the id agent-device's reply to the settle named; an open that arrives after L1 ended → the existing "ended by simlock" reply, nothing recorded; L1's id granted again → the new grant's opens and end never touch the first's, nor the first's the new one's; S3 and the phone role of L1 are gone once L1 ended, with no open needed to clear them |
#1906 |
| B13 | After a restart, nothing of the owner's is adopted under a handover identity, and the agent opens again | front adoption, S4 | a scoped identity's first call after a worker or gateway restart → no lease adopted; the CLI's heartbeat of its old lease id, and every call but an allocate and devices → I8's LEASE_NOT_FOUND, so the CLI's next open allocates with a new id by itself → B10 on L1 while L1 lives; a worker restarted behind a gateway that was not → the heartbeat's re-allocate finds no such open on the worker (I9), S3 is dropped, the heartbeat is answered I8's LEASE_NOT_FOUND, and the next open works, from that CLI or another; after a gateway restart the worker's S4 may still be open: the new open releases it first, and a release that fails answers "try again" and keeps it for L1's end |
#1906 |
Stored state
| Id | What and where | Created, changed, deleted by | Listed or swept by | A restart mid-step leaves | Schema step | Task | Used by |
|---|---|---|---|---|---|---|---|
| S1 | tokens.expires_at INTEGER (nullable, epoch ms), in the daemon's state.db, owner tokens |
written by token.create when expiresInMs is given, in the same insert; never changed; deleted with the row by token.revoke |
token.list shows it as expiresAt; read by every token verify and by B8 |
nothing: one insert | tokens +1 |
#1904 | #1905 |
| S2 | lease_handovers table (id TEXT PK, hash TEXT UNIQUE, lease_id TEXT, lease_granted_at INTEGER, owner_id TEXT, created_at INTEGER), in state.db of both roles (stateOwners), its own schema owner in src/auth |
inserted by lease.handover, owner_id = the lease's owner; deleted per B9, and by token.revoke of owner_id |
B9's worker start sweep, run after the registry loads; no list operation | an insert either landed or not; rows whose lease ended meanwhile go by B9 | lease_handovers +1 |
#1905 | #1906 |
| S3 | Front entry for an attached lease (memory), in its own map in src/agent-device/front, keyed by L1's simlock lease id and grantedAt, apart from the owner's FrontMap: state (opening, open), the agent-device lease id of the open's reply, which the CLI uses from then on (X37), the handover identity, and the fields an owner's entry has that a call reads (address, platform, model, physical, target, bootTarget, ttlMs, deadline, deviceKey, name, retainOnClose, restored, releasing) |
set to opening before the open is forwarded and open on its success; deleted on any other outcome of a first open, on a close that ends L1 (a close after retainOnClose keeps it), on a release whose reply ends it for S4 (B12), when a re-allocate is answered that the worker has no such open (I9), and when the link says L1 ended (worker: the participant's forget; gateway: onLeaseRemoved); a scoped lease.list or lease.renew answered UNAUTHENTICATED or UNKNOWN_LEASE also deletes it; a failed re-allocate keeps it |
— | lost at a restart; B13 | none | #1906 | — |
| S4 | One attach per handed-over lease on the worker (memory), src/agent-device/host/attached-lease.ts: the one owner of agent-device's lease on L1, keyed by L1's worker lease id and grantedAt (the registry's), one for each of the two daemons. It holds its tenant (32 random lower-case hex characters, made with it, never sent by a caller and never changed), the id of its agent-device lease (32 random lower-case hex characters, new for each open), and that lease's release scope |
Made by the first scoped call on a live L1; the registry check, the read of its grantedAt and the making of it are one synchronous step, and an open does the registry check again when its turn comes. A scoped call with no S4 and an ended L1 is answered "ended by simlock" and forwarded nowhere, /health excepted. Each attach runs its opens, settles, releases and end one at a time. An open makes a new id, puts it in the call in place of the CLI's, sets the call's session (B11), and records the id, the params and the tenant before it is sent. Success is a reply naming a lease id and a release scope (readReleaseScope) whose caller has not hung up: S4 keeps both, always the reply's id and never the one sent (X31), and is open. Any other outcome of a first open is settled: the host sends the same allocate, with the same id, straight to agent-device; every call S4 sends itself carries S4's tenant as tenantId in its params, replacing the CLI's, because agent-device reads the tenant of an RPC only there (X40); success → released by the id and scope that reply names; an error reply → nothing of ours is there; no reply in 10 s → kept unsettled, settled again at the next open or at the end. The front's re-allocate (I9) is forwarded only when the attach is open under the id it names, with that id, 10 s at most, and never settled: success refreshes the scope, anything else changes nothing; otherwise it is answered I8's LEASE_NOT_FOUND and nothing is sent. Any other allocate releases or settles what is recorded first. A settle or release before an open has 10 s; a success, data.released true or false, or a LEASE_GONE code ends it, anything else keeps it. The end marks the attach ended, cuts whatever S4 call is running, settles or releases under leasing's signal alone, with no bound of its own, then removes the folders B12 names by reading the sessions folder, and drops it; a missing sessions folder is nothing to remove, and any other failure to read or remove fails as a folder removal does today. A release or close S4 passed on needs no record: releasing again is answered released: false. No generation, confirmation, session name or wire id decides what is removed. A scoped call never writes the owner's records in ReleaseScopeRecord, and reads them only to see whether the owner has a lease open or waiting under L1's own id |
L1's end; a call on an ended L1 makes none, so none outlives it. Folders a late write makes after the end: the daemon start, which empties sessions as today |
lost at a restart, as today | none | #1906 | — |
Interfaces
| Id | What | Shape and bounds | Errors and limits | Where | Task | Used by |
|---|---|---|---|---|---|---|
| I1 | token.create input and tokenRecordSchema |
input gains expiresInMs?: integer, 60 000 to 315 360 000 000; record gains expiresAt?: number; bumps the protocol by one |
BAD_REQUEST "expiresInMs must be between 1 minute and 3650 days"; BAD_REQUEST "A worker join token cannot expire" |
src/contract/operations-admin.ts, config-schemas.ts |
#1904 | #1905 |
| I2 | simlock token create --expires-in <duration>, SimlockAdminClient.createToken({expiresInMs}) |
duration through parseDurationMs (a bare number is milliseconds); output JSON as today, with expiresAt |
usage error "--expires-in takes a duration such as 30m, 12h or 7d" for text the parser refuses; I1's refusals as the daemon sends them | src/cli/commands/token.ts, src/simlock-client |
#1904 | — |
| I3 | Token verify with an expiry | an unexpired token's identity gains expiresAt = S1 |
HTTP 401 UNAUTHENTICATED "Token expired at "; hello → AdminAuthenticationFailedError as for an unknown credential |
src/auth/strategies/token, src/auth/index.ts, src/auth/token-store.ts |
#1904 | #1905 |
| I4 | lease.handover operation, POST /v1/leases/{id}/handovers, simlock lease handover <lease-id>, SimlockClient.handoverLease(leaseId) |
input { leaseId: string }; output { secret: string, handover: { id: string, leaseId: string, createdAt: number } }; role agent, authorize = ownsLease; HTTP 201; secret slk_ + the token secret generator; id hov_<id>; bumps the protocol by one |
FORBIDDEN "Not authorized for lease.handover"; UNKNOWN_LEASE; a handover identity → I6 |
src/contract/operations-leases.ts, both dispatchers, src/http/lease-declarations.ts, src/cli/tree.ts:68, src/simlock-client |
#1905 | #1906 |
| I5 | Handover identity and session | Identity, DispatchSession and the session connection's identity gain scope?: { leaseId: string; handoverId: string; grantedAt: number }, each scoped call comparing grantedAt; principal = S2 owner_id; via: "handover" (added to identity.get's via enum and to SessionIdentity.via, same bump as I4); role: "agent"; expiresAt = the owner token's, when it has one |
— | src/auth/identity.ts, src/auth/strategies/handover/ (new, first in strategies/index.ts), src/daemon/dispatch.ts, src/http/dispatcher-session.ts, src/daemon/server.ts, server-connection.ts, server-requests.ts, src/contract/operations-fleet.ts:324 |
#1905 | #1906 |
| I6 | Scope refusal | — | 403 FORBIDDEN "A handover credential cannot call " (an operation off the allowlist on its own lease); "A handover credential reaches only lease " (another lease id, or a path off the gate) |
checkAccess (src/daemon/dispatch.ts); the HTTP path gate |
#1905 | #1906 |
| I7 | LiveLeases port, bound into auth after the mode branch |
liveLease(leaseId): { state: "live"; ownerId: string; grantedAt: number } | { state: "ended" } | { state: "unknown" }; a worker answers from its registry once loaded (unknown before); a gateway from its lease index (unknown for a missing id inside REBUILD_WINDOW_MS after its start, ended after); until bound, unknown; also given to runDispatch's lookups for B5 and B7 |
live with another grantedAt, ended, unknown → refused as I3's unknown token; ended (and another grantedAt) → row deleted |
src/auth/index.ts, src/daemon/main.ts:302, src/daemon/worker-composition.ts, gateway composition in src/daemon/main.ts, src/daemon/dispatch.ts |
#1905 | — |
| I8 | Front refusals for a handover identity | agent-device replies as refusal(), notAvailable() and leaseEndedByHost() build today |
"refused: lease is already open in agent-device; close it first" (second open, or the owner's open); 403 "refused: lease is not one of yours" (as today, for any lease but the attached one); notAvailable("could not end an earlier open on this lease; try again"), so COMMAND_FAILED, SIMLOCK_UNAVAILABLE, retriable, HTTP 503 (an unsettled earlier open); "refused: the handed-over lease's device is already chosen; drop " (B10's: --device, --os, --image-tag, --device-mode, --device-baseline, --physical, --platform for a platform or backend, --udid, --serial; INVALID_ARGS as refusal()); UNAUTHORIZED with details.reason LEASE_NOT_FOUND, HTTP 200, not retriable, "agent-device is not open on the handed-over lease; run open" (S3 not open) |
src/agent-device/front, src/agent-device/shared/replies.ts |
#1906 | — |
| I9 | Front link to the host for an attached lease | the front's link sets header x-simlock-lease-id: <L1's worker lease id> on every scoped call, naming a lease or none (on a gateway the relay carries it to the worker); the front marks its re-allocate with header x-simlock-restore: 1 beside it, so S4 can tell it from an open; both links drop any copy of either header the client sent; the worker's link finds L1 in its registry, picks the daemon from L1's device, and hands the host the header's lease id, its grantedAt and a check that reads the registry again, and no tenant: S4's replaces the worker's and the gateway's (workerTenant, relayTenant go unchanged for every other call); the host routes the call to that lease's S4 and never by the agent-device id it names; an open is sent to agent-device with S4's own abort signal, not the client's, whose hang-up only decides what S4 does with the reply; the bundled proxy forwards only its own header list, so it never reaches agent-device. FleetPort's PlacedLease and onLeaseRemoved gain grantedAt and workerLeaseId, and the worker link's forget takes grantedAt |
an L1 the worker's registry no longer holds → the front's existing "ended by simlock" reply; an L1 with an owner's live or waiting agent-device lease → I8's "already open" | src/agent-device/front/host-link.ts, relay-host-link.ts, src/agent-device/host/host.ts, attached-lease.ts, src/agent-device/worker.ts, gateway.ts |
#1906 | — |
| I10 | Lease-call cases run on the fake and on real agent-device | one table, src/agent-device/lease-cases.ts: each case is the lease calls sent and, per reply, the fields simlock reads (data.lease, data.reused, data.released, the error's code and details.reason). Cases: a first allocate; the same id and scope again; a new id with the same scope; a used id after a release; another client on the same device; a release with the full scope, without the device key, and of an unknown id; a heartbeat of an unknown id; a repeated allocate whose params name another tenant than the first, with the first's in the x-agent-device-tenant header, and one the other way round; a release with no tenant and run, and one of another tenant (both decided in delivery, pending the maintainer). Each allocate names a device key, so agent-device looks up no device |
a reply that differs fails the case that names it | the unit suite runs it on the fake in src/agent-device/testing.ts; e2e/slow-agent-device.test.ts runs it on the agent-device daemon of its worker, called with that daemon's own token |
#1906 | — |
Existing code
Commit 4b39322.
Searches: tokenRecordSchema (8 hits), closeSessionsForToken (11), expiresAt in src outside proxy-jwt (20), ownsLease|authorizeOneLeaseCall (9), findOwnedLease (5), requireOwnRequest (4), runDispatch( (2), principal in src/agent-device/front (14), path: "/v1 (52), leaseEndParticipants (3), acceptSession (4), stateOwners (2), createAuth( (1), adoptable (6), ReleaseScopeRecord (5); agent-device 0.21.41 open run against a stub (Decisions).
| Id | Code (path:line) | Today | With this feature | Handled by |
|---|---|---|---|---|
| X1 | src/auth/token-store.ts:11-31 |
tokens schema v2, no expiry |
v3 adds S1 | #1904, S1 |
| X2 | src/auth/token-store.ts:93-98 verify |
looks up by hash, no time check | refuses past expires_at |
#1904 B2 |
| X3 | src/auth/strategies/token/index.ts:21-40, src/auth/strategies/index.ts |
identity: principal = token id, no expiresAt; strategies token, proxy |
adds expiresAt (#1904); a handover strategy goes first: a hash in S2 is its credential, any other secret not-mine (#1905) |
#1904, #1905 |
| X4 | src/auth/index.ts:103-108 resolveHelloRole |
operator token or admin secret → admin | an expired operator token falls through to AdminAuthenticationFailedError; a handover secret is never admin |
#1904 B2, #1905 |
| X5 | src/ports/upgrade-router.ts:203-212, src/http/app.ts:143 |
a session with expiresAt closes at it |
fires for an expiring token and for a handover of one, with no change | #1904 B3, #1905 B8 |
| X6 | src/stream/service.ts:117, src/http/app.ts:384, src/http/app-lease-request-routes.ts:103 |
streams end at the identity's expiresAt |
same | #1904 B3 |
| X7 | src/daemon/main.ts:300-313 |
createAuth is built once, before the mode branch |
auth takes I7 by a bind call made after the registry loads (worker) or the index exists (gateway) | #1905 I7 |
| X8 | src/daemon/main.ts:195-210 stateOwners |
tokensOwner in both roles |
S2's owner in both roles | #1905 S2 |
| X9 | src/daemon/dispatch.ts:356-382 checkAccess, authorizeContext |
role check, then authorize; lookups ownerId, leaseRequesterId, pendingRequestOwner |
when session.scope is set: I7 liveness, then the operation allowlist and the lease id, before the role check |
#1905 B5, B7 |
| X10 | src/gateway/dispatcher.ts:321-327, src/daemon/dispatcher.ts:135 |
both call runDispatch |
both pass I7 in the lookups | #1905 B5 |
| X11 | src/daemon/dispatcher-leases.ts:142-154, src/daemon/dispatcher-device-views.ts:12-16 |
worker lease.get/lease.list filter by principal |
a scoped session's list holds its lease only | #1905 B5 |
| X12 | src/gateway/dispatcher.ts:576-579 #leaseList |
#ownedFleetLeases(session.principal) |
cut to the scope's lease | #1905 B5 |
| X13 | src/http/dispatcher-session.ts:71-76 buildHttpSession |
copies principal, role, via | copies scope |
#1905 I5 |
| X14 | src/daemon/server.ts:487-497 acceptSession, src/daemon/server-connection.ts:10-15, src/daemon/server-requests.ts:217-235 #session |
the session keeps name, via (token or proxy) and signOutUrl; each call's session is rebuilt from the connection |
the connection keeps scope and via: "handover", and #session hands them to each call; a call refused by B7's liveness closes the connection 4003 after its answer |
#1905 B5, B7 |
| X15 | src/http/app.ts:380-430 file routes, module lease routes, mounts; src/http/app-helpers.ts:59-62 requireOwnRequest |
resolve the lease through lease.get; stored requests by owner |
the path gate in requireAuth runs first; /v1/lease-requests* never reaches requireOwnRequest for a scoped identity |
#1905 B6 |
| X16 | src/daemon/server.ts:503-508, src/daemon/dispatcher-admin.ts:71, src/gateway/dispatcher.ts:442 |
revoke closes via: token sessions whose principal is the token |
also closes via: handover sessions of that principal and deletes S2 rows with that owner_id |
#1905 B8 |
| X17 | src/gateway/lease-index.ts:6-13,118-129; src/gateway/fleet-forwarding.ts:40-41 REBUILD_WINDOW_MS |
index in memory only, rebuilt from worker reports; an unknown id is unreachable for a minute after start | backs I7's three states on a gateway | #1905 B9 |
| X18 | src/agent-device/front/allocate.ts:103-104,200-256,349,385-396, src/agent-device/shared/rpc.ts:4 |
allocate needs a 32-hex lease id, sends lease.request with requester = lease id, reads the device from the link, writes the map entry |
a scoped identity's allocate still needs the CLI's 32-hex id and leaves its replacement to S4, sends no lease.request, reads L1's device facts from the link (as adoptable does: lease.get carries no address), and writes S3 |
#1906 B10 |
| X19 | src/agent-device/front/front.ts:325-350 readLeaseHeader, refuseForeignLease; src/agent-device/shared/tenant.ts:21-32 |
a foreign lease is refused on a worker only by the map's principal; tenant from principal and the header's lease id | a scoped identity passes only for the attached entry; the tenant is S4's, and shared/tenant.ts stays as task/1905 has it |
#1906 B11 |
| X20 | src/agent-device/front/relay-host-link.ts:114-136 status, forward |
checks placed.ownerId === identity.principal |
a scoped identity is also held to L1's worker lease | #1906 B11 |
| X21 | src/agent-device/front/token-devices.ts:18-29, devices-filter.ts:33-38 |
devices cut to the principal's live entries, and an entry missing from lease.list is marked ended |
for a scoped identity only the attached entry is read and marked | #1906 B11 |
| X22 | src/agent-device/front/front.ts:401-418 adoptLeases, host-link.ts:99-115, relay-host-link.ts:142-160 adoptable |
adopts every front-made lease of the principal | adopts nothing for a scoped identity | #1906 B13 |
| X23 | src/agent-device/front/renewals.ts:22-33, heartbeat.ts:179-210,319 |
renewals and re-allocate read the owner's map entry and use its lease id with simlock | for a scoped identity they read S3 and use L1's id with simlock; a re-allocate that does not succeed leaves S3 as it was | #1906 B11 |
| X24 | src/agent-device/front/ended.ts:66-99 releaseEndedLeases, closedLease; src/agent-device/front/release.ts:11-33 |
a close ends the simlock lease through the reply's endedLeases; a release ends it after agent-device |
for a scoped identity a release ends no simlock lease (X41), and the one a close ends is L1, when the reply names S3's agent-device id, or when S3 is restored without retainOnClose and the close named a session |
#1906 B12 |
| X25 | src/agent-device/host/lease-end.ts:29-68,136-177,208-232 ReleaseScopeRecord, recordingFetch, nameCall, leaseEnded |
the scope is keyed by the lease id each RPC names, which is agent-device's and simlock's alike | unchanged for the owner's calls; a call with I9's header goes to S4 instead, and leaseEnded ends L1's S4 as well as the owner's record |
#1906 B12 |
| X28 | src/agent-device/front/front-map.ts:178-182 refresh, heartbeat.ts:162-175 stillHeld, boot.ts:20-28, context.ts:166-174 heldForAnother |
compare simlock's lease ids with the map key | unchanged for the owner's map, which never holds an attached lease; for a scoped identity stillHeld and boot read S3 and L1's id, and refresh does not cover S3, which a lease's end deletes |
#1906 B11 |
| X29 | src/daemon/server-requests.ts:24,207-214 PASSTHROUGH_OPERATIONS |
the socket and /v1/session hand only listed operations on; any other is UNKNOWN_REQUEST |
lease.handover is listed |
#1905 B4 |
| X30 | src/daemon/dispatcher-admin.ts:60-62, src/gateway/dispatcher.ts:432-435 token.create handlers |
pass role and label to the store | also pass expiresInMs |
#1904 B1 |
| X31 | agent-device v0.21.41:packages/daemon/src/resources/lease-registry.ts:84-104,145-170 allocateLease, issuedLeaseIds, refreshRequestedLease; v0.21.41:packages/daemon/src/resources/lease-registry-scope.ts:310-331 assertLeaseOwnerScope, hasAllocatedScope |
an id it ever issued is never issued again (LEASE_ID_IN_USE); an allocate repeated with the same id and scope answers the lease the first one made; a proxy lease is released only with its full scope, the device key included, else UNAUTHORIZED |
why S4 makes a new id for each open, settles a lost open by repeating it, and releases only by the id and scope a reply named. An allocate with a new id and the scope of a live lease is answered with that lease under its own id (refreshExistingRunBinding), and a retry by another client with DEVICE_IN_USE, both run on 2026-11-30; a release of an unknown id is {ok: true, data: {released: false}} |
#1906 B10 |
| X32 | src/agent-device/worker.ts:176, src/agent-device/front/relay-host-link.ts onLeaseRemoved, src/leasing/lease-ports.ts:41-49 EndedLease |
the worker tells its link of a lease's end with leaseId and grantedAt, the gateway's link hears of one its index dropped |
both also delete S3 | #1906 B12 |
| X33 | src/agent-device/front/host-link.ts #roles, #roleOf, forget |
which daemon a lease uses is remembered by the lease id a call names | a scoped or relayed call with I9's header reads the device of L1 from the registry, and remembers nothing | #1906 B11 |
| X34 | agent-device v0.21.41:src/cli/commands/proxy-lease-device.ts:68-92 |
a first open without --platform, or with --udid or --serial, lists devices before it allocates |
why devices is answered with no open |
#1906 B11 |
| X35 | src/agent-device/front/request-rules.ts:212-238,363-374, orientation.ts:61-81 |
a command's device selectors and an orientation call are read against the owner's map entry of the lease it names |
for a scoped identity they read S3, and an allocate's udid and serial are read against L1's address from the link (today ruleAddresses refuses any on an allocate, and it runs before the attach), the device flags and --device against B10, and device.rotate names L1 |
#1906 B11 |
| X36 | agent-device v0.21.41:packages/host-kit/src/session-paths.ts:3-5 safeSessionName, v0.21.41:packages/daemon-contracts/src/session-artifact-paths.ts:66 resolveSessionDir, v0.21.41:packages/daemon/src/core/session-tenant-scope.ts:43 tenantScopedSessionName |
a command's folder is <tenant>:<session> with every character outside [A-Za-z0-9._-] written _ |
a tenant of 32 random hex characters makes every folder of the lease start with <tenant>_ and no other lease's; run on 2026-11-30 with two leases, one session name, and a session named as the other lease's folder |
#1906 B12 |
| X37 | agent-device v0.21.41:src/cli/commands/connection-lease-transaction.ts:246,279,385 (the same in v0.21.40, the oldest simlock serves) |
the CLI sends a new random lease id on every allocate, and then uses the id the reply names on every command, heartbeat, upload and artifact call | why S4 may choose the id; run on 2026-11-30 against real agent-device and @agent-device/proxy 0.21.41: open, install with upload, snapshot, screenshot, recording, close, a lost reply, and a daemon restart |
#1906 B10 |
| X38 | agent-device v0.21.41:packages/daemon/src/server/http/http-rpc-methods.ts:156-160 toLeaseDaemonRequest |
a lease call runs in the session the caller named, default without one, with no tenant, so its events go to sessions/<session> |
S4 sets the session of its lease calls to <tenant>:lease, so they go to sessions/<tenant>_lease; the owner's calls are #2003 |
#1906 B11 |
| X39 | task/1906 at 56e72a6: src/agent-device/host/attached-lease.ts #ids, #sessions, confirm, pass, #generation; src/agent-device/shared/tenant.ts leasePart; src/agent-device/testing.ts:707,734 |
the parked build guesses folder names and reads result.released |
the first two go; the fake answers as X31 says and is held to I10 | #1906 S4 |
| X40 | agent-device v0.21.41:packages/daemon/src/server/http/http-server.ts:577, v0.21.41:packages/proxy/src/daemon-proxy.ts:731; task/1906 sendRpc in src/agent-device/host/lease-end.ts, the fake's tenant in src/agent-device/testing.ts |
/rpc takes the tenant from params.tenantId, which the proxy stamps; the tenant header alone changes nothing, and sendRpc sets only the header (run on 2026-11-30: the same allocate with the CLI's tenant in its params is LEASE_ID_IN_USE). The fake takes the header first |
S4 writes the tenant into the params; the fake reads it from the params as /rpc does |
#1906 S4, I10 |
| X41 | agent-device v0.21.41:src/cli/commands/connection-lease-transaction.ts:157-176,396-401, v0.21.41:src/cli/commands/proxy-lease-device.ts:128-139,171,207, v0.21.41:src/cli/commands/connection.ts:361; task/1906 src/agent-device/front/release.ts |
the CLI releases the lease by itself when it rejects the device it got, and on connect --force; disconnect sends a close first when the connection has a lease (v0.21.41:src/cli/commands/connection.ts:347-350), then the release; the front's release then ends the simlock lease |
under a scoped identity it releases only agent-device's lease, and an open that asks for a device is refused first | #1906 B10, B12 |
| X26 | src/drivers/ios/device-tcp.ts:58,151-167 |
a tunnel connect reaches only listeners whose process names the lease's SIMULATOR_UDID |
why tunnels stay allowed | #1905 B6 |
| X27 | website/src/content/docs/docs/using-devices/http-api.mdx:27, agent-device.mdx:64,94, ci.mdx:24-32, concepts/tokens-and-roles |
an agent token reaches the whole worker; one token per agent; connect proxy |
each task's docs describe its surface (documentation rule 9) | #1904, #1905, #1906 |
Tasks
flowchart LR
A["#1904 token expiry"] --> B["#1905 handover credential"] --> C["#1906 agent-device on a handed-over lease"]
- feat(auth): an agent or operator token may carry an expiry #1904 feat(auth): an agent or operator token may carry an expiry — an operator can make a token that stops working at a set time. Risk: a token refused early or working late.
- feat(auth): a lease owner hands one lease to an agent with a scoped credential #1905 feat(auth): a lease owner hands one lease to an agent with a scoped credential — an owner hands one lease to an agent over HTTP, the remote CLI and MCP. Risk: an agent reaching the owner's other leases, or a credential outliving its lease.
- feat(agent-device): agent-device opens on a handed-over lease #1906 feat(agent-device): agent-device opens on a handed-over lease — the agent drives the handed-over device through agent-device. Risk:
openleasing a new device, or sessions left behind.
Completion conditions:
- Handover on a worker and a gateway with agent-device, screenshot, file, stream, refusals: feat(auth): a lease owner hands one lease to an agent with a scoped credential #1905 (HTTP, stream, files, refusals), feat(agent-device): agent-device opens on a handed-over lease #1906 (agent-device, slow lane).
- Refused at once after the agent's close and the owner's release: feat(auth): a lease owner hands one lease to an agent with a scoped credential #1905 (release), feat(agent-device): agent-device opens on a handed-over lease #1906 (close).
--expires-in 2mworks then is refused, sessions and streams end, its handovers too: feat(auth): an agent or operator token may carry an expiry #1904, feat(auth): a lease owner hands one lease to an agent with a scoped credential #1905 (handovers).token createwithout--expires-inas today: feat(auth): an agent or operator token may carry an expiry #1904.
Open work in the same area: #1648 (iOS simulator jail, feature:spec) shares the goal of keeping a lease from the worker; no Depends on, since a handover already refuses exec. #1636 (upload once for many leases, feature:spec) touches the lease file routes the path gate passes; no Depends on, a new route under /v1/leases/{id} passes the gate as written. #2003 (bug, the owner's lease calls share a session folder) changes the owner's side of src/agent-device/host/lease-end.ts; no Depends on, the attach is a file of its own. #412 (feature:spec, gateway reconciliation) reviews the adoption rules #1906 narrows; no Depends on.
Written by an agent.
Activity
docs(adr): 0092 agent-device attaches by --lease-id (#1895)
V3RON commentedon Nov 27, 2026
Design posted: business sections, Decisions (ADRs 0092 and 0093, PR #1898), Behaviours B1-B13, Stored state S1-S2, Interfaces I1-I8, Existing code X1-X24.
Written by an agent.
docs(adr): 0092 close ends a handed-over lease (#1895)
docs(adr): 0092 two gates, owner token, two lease ids (#1895)
docs(adr): 0092 drop the shared-sessions claim (#1895)
docs(adr): accept 0092 and 0093, not yet implemented (#1895)
V3RON commentedon Nov 27, 2026
Spec updated: tasks #1904, #1905, #1906 written; Task cells and the Tasks section filled.
Written by an agent.
docs(adr): lease handover is 0098, 0092 is taken (#1895)
docs(adr): 0098 two ids, handover strategy, tenant and retainOnClose;…
4 remaining items
V3RON commentedon Nov 30, 2026
Delivery run
Merged: none; the stack #1974 stays open
Reviewed, in the stack: #1898 (ADRs 0098, 0093), #1972 (#1904), #1976 (#1905), synced with main, protocols 111 and 112
Parked: #1906 — review round 2 is incomplete and has seven open findings; PR #1988 stays in draft
Decided: #1905 — may an open session reach a later lease under the same id → no,
scopecarriesgrantedAt(pending the maintainer)Decided: #1905 — MCP tools on a handed-over lease → out of scope; the approved Scope named MCP (pending the maintainer)
Asleep: 24 min
Written by an agent.
V3RON commentedon Nov 30, 2026
Design posted: B10 to B13, S3, S4, I9, X25 changed and X31 to X33 added (the attach redesign, #1906 only).
Written by an agent.
V3RON commentedon Nov 30, 2026
Design posted: B10, B11, B13, S3, S4, I8, I9, X23, X24, X28, X31 changed after the check.
Written by an agent.
V3RON commentedon Nov 30, 2026
Design settled: the maintainer picked the redesign and answered its three questions; no ADR changed.
#1895 A credential scoped to one lease: the agent-device attach is redesigned.
Decided: one attach per handed-over lease on the worker owns agent-device's lease from before the open until its release; calls are routed by the lease the credential names.
Decided: a lost open is settled by sending the same allocate again.
Maintainer: LEASE_NOT_FOUND after a restart; a failed re-allocate keeps the open; an unsettled open has its own message.
Decided in the session, after the answers:
devicesis answered with no open, becauseopenmay need it.Check: ready, 0 open findings
Written by an agent.
V3RON commentedon Nov 30, 2026
Spec updated: B10 to B13, S3, S4, I8, I9, X23 to X25, X28 and X31 to X35; #1906 is task:ready again.
Written by an agent.
V3RON commentedon Nov 30, 2026
Delivery run
Merged: none; the stack #1974 stays open
Reviewed, in the stack: #1898 (ADRs 0098, 0093), #1972 (#1904), #1976 (#1905)
Parked: #1906 — three findings open after the last check (R23, R25, R26); PR #1988, rebuilt to the redesign, stays in draft
Decided: #1906 — where cases no call through the front can show are tested → on the attach, the S3 map and the link (pending the maintainer)
Decided: #1895 —
devicesworks with no open → yes (decided in the session, after the maintainer's answers)Asleep: 24 min
Written by an agent.
docs(adr): 0098 the host chooses agent-device's lease id and tenant f…
V3RON commentedon Nov 30, 2026
Design posted: B10 to B12, S3, S4, I9, X18, X19, X31 and the Decisions changed; I10 and X36 to X39 added; ADR 0098 §2 and §4 changed (the attach redesign after the spike, #1906 only).
Written by an agent.
docs(adr): 0098 a release by the agent-device CLI keeps the handed-ov…
docs(adr): 0098 disconnect ends the handed-over lease as close does (#…
V3RON commentedon Nov 30, 2026
#1895 A credential scoped to one lease, the agent-device attach (#1906): #1895
ADR 0098 (PR #1898): §2 and §4 changed. The worker's host chooses agent-device's lease id and a random tenant per grant; a release by the CLI keeps the handed-over lease; an open that asks for a device is refused.
Decided in the session:
--targetis not read.devicesworks beforeopen. Cases no front call shows are tested on the attach, the S3 map or the link.Check: ready | 0 open findings
Written by an agent.
V3RON commentedon Nov 30, 2026
Spec updated: approved by the maintainer on 2026-11-30; #1906 is rewritten from the new rows.
Written by an agent.
V3RON commentedon Nov 30, 2026
Tasks checked:
Verdict: ready, 0 blocking; #1906 istask:ready.Before the build:
.agents/scripts/stack-sync.sh 1988, so the stack holds ADR 0098 as changed (1216674). PR #1988'sState:line is of the earlier build; the rebuild starts with the build stage and review round 1.No decision was taken after the approval.
Written by an agent.
V3RON commentedon Nov 30, 2026
Delivery run
Merged: none
Parked: #1906 — review round 1 is incomplete, 20 findings open on PR #1988
Decided: #1906 — how to prove the routed link's owner check → a direct test; two releases the I10 table lacked → added
PR #1976 (#1905) got one fix for a CodeRabbit comment, and its check passed.
Written by an agent.
chore(agents): deliveries stop for a person only when a person is nee…