Repository navigation
Closed
Labels
task:readySpec checked. An agent may implement it once its Depends on allow.
Description
Part of #172.
Scope
After this PR a lease request chooses its device mode. simlock lease --mode slim|full, and mode on MCP, HTTP, and the client, replace --full and full: true. ios.defaultMode sets what a request with no mode gets and replaces ios.slim.enabled. Every worker honours both modes. A slim request on a runtime that cannot be slimmed is granted a full device. A gateway passes the mode through unchanged.
{
"ios": {
"defaultMode": "full", // default; "slim" or "full"
"slim": {
"categories": ["..."], // unchanged
"bootTimeoutMs": 600000 // unchanged
}
}
}Technical spec
File and line references are to main at the time of writing.
Modules touched
src/contract/operations.ts(leaseRequestInputSchema, :116-143):mode(slimorfull, optional) replacesfull. Rewrite the comment at :108-114, which saysmodeis rejected.src/contract/schemas.ts:deviceSpecSchemadropsfulland does not expose the spec's mode. The config schema gainsios.defaultModeand losesios.slim.enabled.src/contract/protocol.ts: raise the range by one again.src/core/config.ts:ios.defaultModewith defaultfull; a value outside the enum is rejected naming the key.ios.slim.enabledleaves the type, the defaults, and the validators, so it falls to the existing unknown-key warning with no extra code.src/core/driver.ts:DeviceRequest.mode?replacesfull.Driver.reducesFeaturesis deleted.resolveSpecreceives the resolved mode.makeReadyreceives the device's spec mode in its options.src/core/domain.ts:DeviceSpec.mode?: "slim"replacesfull?: true; absent means full.sameSpeccompares it.src/core/lease-acquisition-coordinator.ts(:240-255): the one place a missing mode gets the platform default, from a map built at the composition root. It accepts a slim spec from the driver only when the resolved mode is slim; otherwise it plans on the full spec.src/core/managed-device-lifecycle.ts,src/core/warm-pool-coordinator.ts: passrecord.spec.modeto everymakeReadycall.src/core/registry.ts:registerDevicerecords the planned mode. On load,spec.fullis ignored and not written back, and aspec.modethat is notslimfails the load. No migration (ADR 0007 §11).src/drivers/ios/index.ts:resolveSpecreturns a slim spec only for a slim request on a runtime that passes the existing 18.5 gate. The resolution cache key ignores the mode today (specKey), so the mode is applied outside the cache.planSlimBootreads the mode from themakeReadyoption. ThedriverData.fullstamp at provision and its parser are removed.- The boot estimate uses the slim budget only for a slim spec.
advisories()reportsslim-runtime-unsupportedonly when the composition root told the driver the default mode is slim.
src/daemon/main.ts: build the default-mode map and the advisory boolean from config; stop threadingslim.enabled. Fix the comment at :758-760.src/daemon/dispatcher.ts,src/gateway/dispatcher.ts,src/gateway/fleet-coordinator.ts: carrymodewhere they carriedfull. The gateway adds no default.src/cli/index.ts:--mode <slim|full>replaces--full. The CLI does not validate the value; the contract answersBAD_REQUEST.src/http/app.ts,src/http/tracker.ts:modereplacesfull, and the lease request body schema becomes strict.src/mcp/contracts.ts: rewrite the comment at :20-27.src/core/fake-driver.ts,e2e/fake-driver/: a script key for which OS versions can be slimmed.e2e/slow-ios-slim.test.ts: rewritten for--modeandios.defaultMode.- Docs:
docs/CLI.md,docs/HTTP-API.md,docs/CONFIGURATION.md,docs/CLIENT.md, bothEVENTS.mdfiles.docs/CONFIGURATION.mdcarries the upgrade note: empty a worker that ran with slim on (simlock nuke --delete-devices) before upgrading.docs/internal/KNOWN-PITFALLS.md: rewrite the iOS slim section, add the upgrade pitfall, and add the entry that a budget sized for slim overcommits on full devices, naming Capacity counts slim and full devices separately #174.
Contract and event changes
lease.requestinput:fullremoved,modeadded.config.getshape changes. Protocol version raised by one.lease.requestedandlease.rejectedcarry the request, sorequestSpec.fullbecomesrequestSpec.mode.device.provisionedcarries the spec, sospec.fullbecomesspec.mode. Update their rows indocs/EVENTS.mdanddocs/internal/EVENTS.md, and extend the exception note at the top ofdocs/internal/EVENTS.mdto name ADR 0007.device.slimmedis unchanged. The prose about a slim pass skipped on an older runtime changes: that case is now decided when the spec is resolved.
Rules in play
- ADR 0007, all of it.
architecture.mdrules 1 to 3 (the core learns no platform fact; drivers hold no default), rule 10 (one place resolves the default, one place enforces the full guarantee), rule 13.safety.mdrule 2 (a recovery boot applies no slim pass) and rule 10.events.mdrules 6 and 8.testing.mdrules 1 to 4.documentation.mdrules 2 to 4.
Tests
- A request with no mode resolves to the worker's default for its platform; a request with a mode ignores the default.
- A
fullrequest is never planned onto a slim spec, even when the driver'sresolveSpecreturns one. - A
fullrequest does not reuse an idle slim device of the same model and runtime; aslimrequest does not reuse an idle full one. - A
slimrequest on a runtime the driver cannot slim resolves to the full spec, reuses an idle full device, and is granted withmode: "full". - A
slimrequest against a driver that knows nothing of modes is granted a full device. makeReadyreceives the device's spec mode on prepare boots, and a recovery boot applies no slim pass.- iOS: with either default, a slim-spec device on 18.5 or newer gets the disable pass and the second boot; a full-spec device gets one boot and the normal deadline.
- iOS:
resolveSpecreturns a full spec for a slim request on a runtime below 18.5, and two requests with different modes for one model and runtime get different specs. - iOS: the boot estimate is the slim budget only for a slim spec.
- iOS:
advisories()reportsslim-runtime-unsupportedonly when told the default mode is slim. - A slim-spec device whose slim pass fails is granted with
mode: "full"and stays in the slim pool. - A stored
spec.fullis ignored on load and not written back. lease.requestcarryingfull, or a mode other thanslimorfull, isBAD_REQUEST. This replaces the "rejects mode" tests insrc/contract/operations.test.tsandsrc/mcp/contracts.test.ts.POST /v1/lease-requestswithfullin the body is400 BAD_REQUEST.simlock lease --fullfails as an unknown option.- A config with
ios.slim.enabledloads with the unknown-key warning andios.defaultMode: "full"; anios.defaultModeoutside the enum is rejected naming the key. simlock configrendersios.defaultMode(e2e, fast lane).- A gateway forwards a request's mode unchanged and forwards none when the request named none.
- E2E, gateway with one worker of each default: a request with a mode gets that mode on either worker, and a request with none gets the default of the worker it landed on.
- Slow lane, real iOS: on a default-full worker
--mode slimgrantsmode: "slim"; on a default-slim worker--mode fullgrantsmode: "full"while a slim device sits idle.
Done when
- Every test above passes and
pnpm checkis green. grep -rn "reducesFeatures\|slim\.enabled\|--full" src e2e docsfinds nothing outsidedocs/internal/adr/.- The slow lane passes on a Mac with an iOS 18.5 or newer runtime.
- The PR body walks the Completion conditions of Lease requests choose slim or full; config sets the default #172.
Out of scope
android.defaultModeand Android slim: Boot Android emulators slim: guest RAM, low-RAM mode, and the feature profile #163.- Counting capacity by mode: Capacity counts slim and full devices separately #174.
- Picking a worker by mode: Gateway routing: staged ranking, mode-aware picks, fast failure #173.
- Deriving the mode of devices recorded before the upgrade.
Depends on
Approval
- Approved for delivery
Written by an agent.
Metadata
Metadata
Assignees
Labels
task:readySpec checked. An agent may implement it once its Depends on allow.
Activity
docs(adr): 0007 — a lease request chooses the device mode (#182)
github-actions commentedon Oct 1, 2026
Now
task:ready: approved, technical spec present, #177 closed.