Skip to content

Android leases that name no image tag get the worker's android.defaultImageTag where it fits #1595

Closed

Description

@V3RON

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]
Loading

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.get shape change bumps the protocol by one in this PR; min stays (an absent field is the compatibility path).
  • documentation rule 9: configuration.mdx, choosing-a-device.mdx and the MCP lease tool 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; class phone → 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 untagged RUNTIME_MISSING); --os 38 --allow-download (no install for the tagged attempt, the untagged one installs); a foreign-CPU-only tagged image; UNKNOWN_MODEL from 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 resolve of a tagless Pixel 9 target → 36 tagged; a Pixel 6 target → untagged; unset → untagged.
  • B5: android.defaultImageTag: a valid tag loads and config.get carries it; absent loads; "", "play store", 65 characters, a number → I1's message; deviceModeWiring passes the loaded tag to leasing, and nothing when unset (model: src/daemon/driver-discovery.test.ts:614).
  • B10: Catalog.resolveSpec with defaultTag: host-CPU image of the tag; only a foreign-CPU one (AndroidImageTagMissingError, downloadable: false); both CPUs (host one); without defaultTag and only a foreign-CPU one → that image, as today.

Done when

  • pnpm test:changed passes, 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.mjs passes.
  • PROTOCOL_VERSION_RANGE.max is one above main's, and min is unchanged.
  • configuration.mdx lists android.defaultImageTag. choosing-a-device.mdx says what a tagless Android lease gets with and without it: the host-CPU rule, that Play Store images refuse adb root, and --image-tag google_apis for a lease that needs it. The MCP lease tool's description says the worker's default applies when imageTag is omitted.

Out of scope

Depends on

Written by an agent.

Activity

  1. added
    task:draft
    platform:android
    on Nov 16, 2026
  2. added
    task:ready
    and removed
    task:draft
    on Nov 16, 2026
  3. self-assigned this
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

platform:androidtask:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions