fix(agent-device): an allocate's device mode reaches the lease request (#1223)

Merged
VI
1d ago
+90-6

Closes #1223.

The agent-device front now reads an allocate's deviceMode (slim | full) into the lease request's mode, as ADR 0007 §2 asks of every transport. Why: Apple Pay / PassKit (Wallet) flows need a full iOS simulator on a farm whose ios.defaultMode is slim, and through agent-device every lease got the default.

  • leaseCallFields reads deviceMode; planOf puts it in the plan as mode, so lease.request and lease.requested carry it as asked.
  • A bad deviceMode reaches lease.request, whose schema is the one check, and answers refused by simlock: mode: Invalid option: expected one of "slim"|"full". deviceMode: null is absent, like osVersion, physical and ttlMs.
  • The allocate forwarded to the agent-device daemon drops deviceMode, and ruleLeaseKeys removes it from commands and batch steps, as for deviceBaseline.
  • The test is in its own device-mode.test.ts, because edge.test.ts may only shrink (ADR 0063).
  • Website page and module manual updated.

Client side: callstack/agent-device#4183 is merged and unreleased, so the docs say --device-mode needs the release that adds it.

Status

  • Allocate with deviceMode full or slim makes a lease request whose mode is that value and grants a device of that mode — device-mode.test.ts; removing the read turns it red
  • Invalid deviceMode refused with simlock's message, and no lease is made; null gets the default — same test
  • The forwarded allocate and every command or batch step carry no deviceMode — device-mode.test.ts; removing either strip turns a test red
  • pnpm exec vitest run --project unit src/agent-device/ src/source-hygiene.test.ts — 518 passed, 1 skipped, at dd3237b; typecheck and oxlint clean
  • Real gateway + worker (0.5.0 with this patch, before the refusal moved to lease.request), raw /v1/agent-device/rpc: deviceMode: "full" → lease mode: full, 0 disabled launchd labels; no deviceMode → mode: slim, 170 disabled (incl. com.apple.passd). Not repeated on this head

Assumptions

  • Assumption: new ADR? — no; ADR 0007 §2 already decides it, this closes a gap against it
  • Assumption: field name — deviceMode, because agent-device's mode is taken by other commands

Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 0 blocking, 2 fixed, 0 notes. Claims review: 0 blocking, 1 fixed, 0 notes.
Assessment: complete
Rounds: 2. Tokens: 0.45M.
External contribution: the spec, code and claims briefs ran as separate agents from a fork clone, not through the reviewer agent, so the ledger's metrics are unknown. The round 2 code lens had no dependencies and marked itself incomplete, so its coordinator then ran the tests and three mutation probes above. Spec ran in round 1 only.

Written by an agent.