Skip to content

The agent-device front maps deviceExcept to the lease's except #1332

Closed

Description

@V3RON

Part of #1326.

Scope

An agent-device client allocates with deviceExcept: ["store", "other"] and gets the same simlock lease as simlock lease --mode slim --except store,other: the front sends it as except on lease.request, drops it from what it forwards to agent-device, and a value simlock refuses is answered refused by simlock: <message>. On a worker and through a gateway.

In short

The front maps one more allocate key, as it maps deviceMode to mode (#1225). agent-device's CLI sends the key once callstack/agent-device adds --device-except; until then a raw allocate can carry it.

flowchart LR
  A["allocate deviceMode, deviceExcept"] --> B["front: leaseCallFields, planOf *changed*"] --> C["lease.request mode, except"]
  B --> D["forwarded allocate, no deviceExcept *changed*"]
Loading
Allocate params Today After
deviceMode: "slim", deviceExcept: ["store"] deviceExcept forwarded to agent-device; lease plain slim lease.request mode: slim, except: [store]; not forwarded
deviceExcept: ["Store"] forwarded refused by simlock: <schema message>
deviceExcept: "store" (not a list) forwarded refused by simlock: <schema message>
deviceExcept: null forwarded as absent
no deviceExcept as today as today

If this goes wrong, the key is dropped again and the client gets a plain slim device, as deviceMode was in #1223.

Technical spec

Facts

Commit cc39ec8.

# Fact Source
F1 leaseCallFields reads deviceMode from the allocate params src/agent-device/shared/rpc.ts:102, :110
F2 stringFields casts deviceMode without validating; the contract refuses a bad value src/agent-device/front/allocate.ts:120-126
F3 leaseInput spreads the plan into lease.request, so a plan field reaches the wire src/agent-device/front/allocate.ts:188-198
F4 A non-timeout lease.request error becomes refused by simlock: <message> src/agent-device/front/allocate.ts:260-262
F5 forwardedBody drops deviceMode from the forwarded params src/agent-device/front/allocate.ts:272-297 (:282)
F6 ruleLeaseKeys strips lease keys, deviceMode among them, from batch steps src/agent-device/front/request-rules.ts:136-146
F7 The deviceMode test: describe("the agent-device front's deviceMode"), invalid values answer refused by simlock: and are never forwarded src/agent-device/device-mode.test.ts:30-55
F8 The front manual documents the mapping and the strip list src/agent-device/AGENTS.md (allocate flow, steps 3-4)
F9 The pinned @agent-device/proxy 0.21.35 has no deviceExcept (nor deviceMode) in dist package.json:76; grep -r deviceExcept node_modules/@agent-device/proxy/dist → no match
F10 Through a gateway, the gateway front runs the same rules and allocate code agent-device manual, "Flow: through a gateway" step 1

Modules touched

Searches: deviceMode in src/agent-device/ (rpc.ts, allocate.ts, request-rules.ts, tests, AGENTS.md) and website/.../using-devices/agent-device.mdx.

  • src/agent-device/shared/rpc.ts, front/allocate.ts, front/request-rules.ts, AGENTS.md
  • website/src/content/docs/docs/using-devices/agent-device.mdx

Contract and event changes

None: except on lease.request is T3's. deviceExcept is read from agent-device's allocate params (any JSON); null is absent; anything else goes to lease.request as is, and the contract refuses a bad value.

Other code on the same state

Searched forwardedBody, ruleLeaseKeys, planOf callers: the worker front and the gateway front share them (F10). Open PR #1254 (no issue) edits allocate.ts (the reply's granted mode): whichever merges second keeps both changes. The reply's data.lease.device could carry except once #1254 lands; that is not in this task.

Failure modes

Call Outcome What happens Limit, counted from
lease.request with except BAD_REQUEST refused by simlock: <message>, allocate not forwarded none
lease.request with except granted allocate forwarded without deviceExcept allocate queue wait 330 s, as today

Rules in play

  • ADR 0066 §1, "the agent-device front maps its deviceExcept to it, as it maps deviceMode to mode".
  • ADR 0023: the simlock lease is the only clock; unchanged.
  • documentation rule 9: agent-device.mdx names deviceExcept.

Tests

Seam: the agent-device front's allocate on the test rig, modelled on src/agent-device/device-mode.test.ts (30-55).

  • An agent-device allocate with deviceExcept leases with except: cases a valid list (the lease request carries mode and except; the forwarded allocate and batch steps carry no deviceExcept); an invalid name and a non-list ("store") (each refused by simlock:, nothing forwarded, no lease); null (as absent).

Done when

  • pnpm exec vitest run --project unit src/agent-device/ passes.
  • agent-device.mdx and the agent-device manual name deviceExcept → except.

Out of scope

  • agent-device's --device-except flag (callstack/agent-device).
  • Reporting except in the allocate reply.

Depends on

Written by an agent.

Activity

  1. added
    task:draftScope written; technical spec or its spec check missing.
    on Nov 5, 2026
  2. added
    task:readySpec checked. An agent may implement it once its Depends on allow.
    and removed
    task:draftScope written; technical spec or its spec check missing.
    on Nov 5, 2026
  3. self-assigned this
    on Nov 6, 2026
  4. added a commit that references this issue on Nov 6, 2026
    ba6582d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

task:readySpec checked. An agent may implement it once its Depends on allow.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions