Repository navigation
Description
Part of #1590.
Scope
An operator sets android.defaultImageTag on a worker. From then on, an Android lease on that worker that names no image tag (from the CLI, MCP, the HTTP API or agent-device) gets an image with that tag, built for the machine's own CPU, wherever one fits. It lands at the newest level that has one; otherwise it gets what it gets today. The warm pool's targets follow the same rule. The docs and the MCP lease tool say so.
If this goes wrong, a user would notice tagless Android leases failing, or getting a different level or image than the Examples in #1590 say, on a worker with the setting, or on any worker if the setting leaked.
Technical spec
Commit 5e639b4.
Rows
- Behaviours: B1, B2, B3, B4, B5, B10
- Stored state: S1
- Interfaces: I1, I2, I3, I7
- Existing code: X1, X2, X3, X4, X5, X6, X7, X8, X9, X16, X17, X18, X22
Facts
| # | Fact | Source |
|---|---|---|
| F1 | A worker default reaches leasing through deviceModeWiring, which today fills only defaultModes |
src/daemon/worker-composition.ts:764-770 |
| F2 | DeviceRequest is Omit<ExactDeviceRequest, "model">, so a field added to ExactDeviceRequest reaches every request unless it is omitted too |
src/core/driver.ts:26-41 |
| F3 | The lease.request input schema is strict, so no unknown field such as defaultTag passes from the wire |
src/contract/operations-lease-request.ts:76 |
| F4 | A config value error reads Invalid config value for "<path>": expected <what> |
src/core/validation.ts:17-19 |
| F5 | The protocol range is { min: 89, max: 89 }; this task moves max only |
src/contract/protocol.ts:13 |
Modules touched
Searches: rg -n "defaultModes|ExactDeviceRequest|checkedSpec|#taggedApiLevel|#matchingImage|defaultModels" src -g '!*.test.ts'.
flowchart LR
config[core config] --> daemon[daemon worker-composition]
daemon --> leasing[leasing spec resolver]
leasing --> core[core driver types]
leasing --> android[Android driver catalog and images]
contract[contract config schema and protocol] --> daemon
docs[website docs and MCP text]
Rules in play
- ADR 0078 §1, §2: the setting, the tagged attempt with downloads off and host-CPU images only, the fallback on a missing runtime alone.
- ADR 0007 §2: the resolver stays the one place a request gets a worker default.
- ADR 0015 §5, §7: the tagged attempt follows the tagged-request rules; the grant names the device's tag.
- ADR 0025 §4: the fallback returns to its order unchanged.
- src/contract/AGENTS.md: the
config.getshape change bumps the protocol by one in this PR;minstays (an absent field is the compatibility path). - documentation rule 9: configuration.mdx, choosing-a-device.mdx and the MCP
leasetool text change with the surface.
Tests
Seam: createLeasing with the fake driver (model on src/leasing/lease-acquisition-coordinator-device-mode.test.ts for a worker default and src/leasing/lease-acquisition-resolution.test.ts for tagged requests); Catalog over the memory SDK for B10 (model on src/drivers/android/catalog-library-and-resolve.test.ts); loadConfig for B5 (model on src/core/config-platform-and-driver-settings.test.ts).
- B1: a tagless Android lease on a worker with the default: exact model, no OS → 36 tagged;
--os 36→ 36 tagged; range>=35→ 36 tagged; classphone→ first phone model, 36 tagged; an idle ready tagged device is granted before a new one. - B2: the tagged attempt refused as a missing runtime falls back:
--os 37; range>=37; a misfit model; no image fits (the untaggedRUNTIME_MISSING);--os 38 --allow-download(no install for the tagged attempt, the untagged one installs); a foreign-CPU-only tagged image;UNKNOWN_MODELfrom the tagged attempt reaches the caller with no second attempt. - B3: unchanged for
imageTag: google_apis, a baseline, physical, iOS, and with the setting unset. - B4: the warm pool's
resolveof a tagless Pixel 9 target → 36 tagged; a Pixel 6 target → untagged; unset → untagged. - B5:
android.defaultImageTag: a valid tag loads andconfig.getcarries it; absent loads;"","play store", 65 characters, a number → I1's message;deviceModeWiringpasses the loaded tag to leasing, and nothing when unset (model:src/daemon/driver-discovery.test.ts:614). - B10:
Catalog.resolveSpecwithdefaultTag: host-CPU image of the tag; only a foreign-CPU one (AndroidImageTagMissingError,downloadable: false); both CPUs (host one); withoutdefaultTagand only a foreign-CPU one → that image, as today.
Done when
pnpm test:changedpasses, with the B1–B5 and B10 tests among the tests it runs.pnpm --dir website install && pnpm --dir website build && node website/scripts/check-openapi.mjspasses.PROTOCOL_VERSION_RANGE.maxis one abovemain's, andminis unchanged.configuration.mdxlistsandroid.defaultImageTag.choosing-a-device.mdxsays what a tagless Android lease gets with and without it: the host-CPU rule, that Play Store images refuseadb root, and--image-tag google_apisfor a lease that needs it. The MCPleasetool's description says the worker's default applies whenimageTagis omitted.
Out of scope
- The catalog field, gateway ranking and
simlock catalogline (the T2 task of Android leases that name no image tag can get a Play Store emulator #1590). - The
doctoradvisory (the T3 task of Android leases that name no image tag can get a Play Store emulator #1590).
Depends on
Written by an agent.
Activity
test: a tagless Android lease on a worker with a default image tag ge…
test: the tagged attempt refused as a missing runtime falls back to t…
feat(core): the fake driver refuses a tagged resolve for named models (…
test: a request the default image tag does not apply to is unchanged (#…
test: the warm pool resolves a tagless target to the spec a tagless l…
test: the Android driver takes only a host-CPU image for the worker's…
fix(android): the catalog's system-images port names builtForHost (#1595
test: android.defaultImageTag loads, is validated, and reaches leasing (
feat(daemon): android.defaultImageTag loads, reaches leasing and conf…
refactor(android): the tagged image pick uses builtForHost (#1595)
test: pin the unset default tag with a strict equal and the host-CPU …
test: previous-protocol fixtures sit below the widened range, the def…
feat(leasing): an Android worker tries its default image tag first (#…
feat(catalog): a worker's catalog names its default image tag and a g…
feat(leasing): a worker serves only enrolled devices on a platform wh…