Redroid devices as a second Android backend
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- android, docker, typescript
- 领域
- devtools, mobile-dev
调研方向
Start with ADR 0102 (PR #2042) and the platform driver and device routing code; the issue also points to src/core/domain.ts:544 for interrupted reclaim behavior. Map the existing Android emulator and phone flows before tracing Redroid configuration, Docker lifecycle, adb connection, lease recovery, and doctor checks. Done means the listed completion conditions pass on Colima and Linux, including fresh /data, stable serials across daemon restart, and existing emulator and phone leases.
由索引模型根据 Issue 内容生成。
描述
Request: none
Problem
The only virtual Android devices simlock can create are SDK emulators. They are heavy: several GB of RAM each, slow cold boots, and they need the full Android SDK on the worker. Redroid (https://github.com/remote-android/redroid-doc) runs Android in a container. It boots in seconds and uses under 1 GB, which is enough for most agent work: installing an app, driving the UI, reading logs. simlock cannot use it today, and a worker can make only one kind of virtual Android device.
Who it is for
Operators who want more Android devices per worker, or Android on Linux hosts without the SDK emulator. Agents whose tasks do not need Play services, sensors or emulator console features.
Outcome
- A worker can run Redroid devices next to emulators and USB or network phones.
- An agent leases one with
--requires redroid, or gets one with a plain lease when the operator lists Redroid first. - The operator points simlock at a Docker engine: Docker Engine on Linux, or Colima (a Docker context) on macOS.
- Each lease gets a fresh
/data, and a Redroid device keeps one adb serial for its whole life.
How it works for the user
flowchart TD
O[operator: android.virtualDevices = avd, redroid] --> D[daemon start: Android driver with its backends]
D -->|engine unreachable, not Linux, or no docker| R[redroid skipped, retried every 30 s; emulators and phones run]
A[agent: simlock lease --platform android --requires redroid --model Pixel 7 --os 34] --> M{redroid running here?}
M -->|no| C[CAPABILITY_MISSING]
M -->|yes| I{image for the API level present?}
I -->|no, downloads off| RM[RUNTIME_MISSING: component install android redroid-34]
I -->|no, downloads on, exact model| P[docker pull, progress shown]
I -->|no, class or range request| RC[RUNTIME_MISSING, never installs]
I -->|yes| B[docker create with a fixed loopback port, start, adb connect, wait for boot]
P --> B
B -->|boot fails or times out| F[container removed, lease answers the failure]
B --> G[grant: serial 127.0.0.1:5700]
G --> E[release: adb disconnect, docker stop, docker rm]
Today --requires redroid is CAPABILITY_MISSING. After, with "android": { "virtualDevices": ["avd", "redroid"] } and Colima running with binder loaded:
$ simlock lease --platform android --requires redroid --model "Pixel 7" --os 34
{"leaseId":"...","device":{"spec":{"platform":"android","backend":"redroid","model":"Pixel 7","osVersion":"34",...},"address":"127.0.0.1:5700",...}}
$ simlock exec <lease> -- adb shell getprop ro.build.version.release
14
$ simlock baseline save <redroid lease> my-app
error BAD_REQUEST: A redroid device cannot be saved as a baseline; lease an emulator (--requires avd) to save one
Doctor on a Mac whose Colima VM has no binder:
$ simlock doctor
redroid-binder-missing: the Docker engine's kernel has no binder, so no Redroid device can boot
fix: colima ssh -- sudo apt-get install -y linux-modules-extra-$(uname -r) && colima ssh -- sudo modprobe binder_linux devices=binder,hwbinder,vndbinder
Examples
android.virtualDevices as written in config:
| Value | Today | After |
|---|---|---|
| absent | emulators and phones | emulators and phones (same as ["avd"]) |
true |
emulators and phones | emulators and phones |
false |
phones only | phones only |
["avd"] |
refused: not a boolean | emulators and phones |
["avd", "redroid"] |
refused | emulators, Redroid and phones; a plain lease tries the emulator first |
["redroid", "avd"] |
refused | the same; a plain lease tries Redroid first |
["redroid"] |
refused | Redroid and phones; --requires avd → CAPABILITY_MISSING |
[] |
refused | refused: expected true, false, or a list of 1 to 4 backends |
["avd", "avd"] |
refused | refused: expected each backend once, "avd" is listed twice |
["docker"] |
refused | refused: expected a backend this worker knows (avd, redroid), not "docker" |
ios.virtualDevices: ["avd"] |
refused | refused: iOS stays a boolean (the loader's existing message) |
android.virtualTags: ["redroid"] |
accepted | accepted: it names the Redroid backend; doctor warns when Redroid is not run |
android.virtualTags: ["emulator"] |
accepted | accepted: an ordinary tag, as today |
["avd"] after ["avd", "redroid"], Redroid devices left |
— | Redroid drained (B35) |
A lease on a worker with ["avd", "redroid"], both with API 34 installed, the emulator also with 35 (API levels, as every Android --os is):
| Request | Today (emulator only) | After |
|---|---|---|
--platform android |
emulator | emulator (first in order) |
--requires redroid |
CAPABILITY_MISSING |
Redroid |
--requires avd |
CAPABILITY_MISSING |
emulator |
--requires redroid --os 35 (no model) |
CAPABILITY_MISSING |
RUNTIME_MISSING, downloadable: false: a class request never installs |
--requires redroid --model "Pixel 7" --os 35 |
CAPABILITY_MISSING |
RUNTIME_MISSING naming redroid-35 (downloads off) or a pull (downloads on) |
--os 35, order ["redroid", "avd"], no redroid-35 |
emulator | emulator: only it needs no download |
--os 36 (no model), order ["redroid", "avd"], neither has 36 |
RUNTIME_MISSING, downloadable: false |
the same: a class request never installs, on any backend |
--model "Pixel 7" --os 36, order ["redroid", "avd"], neither has 36 |
the emulator's 36 download or RUNTIME_MISSING |
the same: Redroid's table has no 36 |
--class tablet (no model) |
emulator | emulator; with order ["redroid", "avd"], Redroid's tablet profile |
--requires redroid,avd |
CAPABILITY_MISSING |
CAPABILITY_MISSING: No one android backend here carries redroid, avd |
--requires redroid --model "TV (1080p)" |
CAPABILITY_MISSING |
UNKNOWN_MODEL: Redroid serves phone and tablet profiles only |
--requires redroid --image-tag google_apis |
CAPABILITY_MISSING |
BAD_REQUEST: android lease requests do not take an image tag on redroid |
plain lease, android.defaultImageTag: google_apis, order ["redroid", "avd"] |
emulator with the tag | Redroid: the default tag is the emulator's only; --image-tag google_apis → emulator |
--requires redroid --baseline my-app (an emulator baseline) |
CAPABILITY_MISSING |
CAPABILITY_MISSING (I4) |
--requires redroid, Redroid's engine down |
CAPABILITY_MISSING |
CAPABILITY_MISSING (I4) |
--requires redroid after colima stop |
CAPABILITY_MISSING |
the same from the next 30 s check; held leases run to their TTL |
--physical |
phone | phone, whatever the list says |
What could go wrong
- A Colima VM restart drops binder until reloaded. Likely; doctor names it.
- A plain lease lands on Redroid (listed first) but needs Play services.
- Upstream Redroid is near dormant; a broken image has no upstream fix.
- On macOS another program takes a stopped Redroid device's port; its next boot fails. Rare.
Words used
- backend: one way to make a platform's virtual devices, e.g.
avdorredroid; iOS has none. - Android platform driver: the one Android driver core sees; it holds the adb server, phones and backends.
- Redroid: Android in a Linux container on the host kernel; needs binder.
- Docker engine: runs the containers, e.g. Docker Engine on Linux, Colima (context
colima). - binder: Android's IPC kernel feature; on Ubuntu
binder_linuxfromlinux-modules-extra. - image table: the Redroid images simlock knows, one per API level, e.g.
34→redroid/redroid:14.0.0_64only-240527. - Redroid component: one image of the table, named
redroid-<API level>, e.g.redroid-34. - unreadable backend: its devices could not be listed (engine down); not gone.
Non-goals
- Shipping or mirroring Redroid images, or kernel modules.
- Docker Desktop and OrbStack (kernels lack binder).
- Windows/WSL2 in v1.
- Play services, camera, emulator console and the
emulatorPorttunnel on Redroid. - Managing a VM or loading kernel modules.
- Baselines on Redroid in v1, and any Redroid-specific warm-pool work.
- Per-backend device limits.
- Podman's own CLI (only its Docker socket, via
host). - A disk check before a Redroid pull (the images live on the engine's disk).
Completion conditions
- On a Mac with Colima (binder loaded), after
simlock component install android redroid-34,simlock lease --platform android --requires redroidreturns a booted Redroid device, and adb, the console's screen stream and input work through simlock. - On a Linux worker the same lease returns a booted Redroid device. The maintainer checks this once by hand before #2041 closes.
- The same worker still leases emulators and USB phones while Redroid devices are leased.
- A second Redroid lease after the first ends gets a device with no data from the first.
- After a daemon restart, a leased Redroid device is still reachable at the serial it was granted; a labelled container with no record is removed only by
doctor --purge-orphans. - A daemon that starts before Colima starts Redroid within 30 s of the engine answering, with no restart.
- Doctor reports a missing
dockerCLI, a missing context, an unreachable or non-Linux engine, and a kernel without binder, each with a fix line.
Open questions
none
Decisions
- ADR 0102 (PR #2042): several Android device backends, Redroid one; licensing in §6.
- Decided by the maintainer: several backends per worker (#1497–#1500 closed); hosts Linux and macOS via Colima, operator sets up engine and binder;
android.virtualDevices: true | false | string[]in routing order (true=["avd"]); idavd(anemulatortag is ordinary); no Redroid baselines in v1;--modelfrom simlock's profiles; images pulled on demand asredroid-<API level>;--osis the API level everywhere; phones served whatever the list says; a fixed loopback port per device; a backend that cannot start or whose engine stops retries every 30 s, leases run to their TTL; an unlisted backend drains (B35); binder checked withalpine:3.20; Linux checked once by hand. - Decided in the session (reason after "because"):
- one driver per platform holds adb server, phones and backends, because 41 platform lookups stay right.
- a not-running backend's device keeps its state and slot until the backend starts (B38, B39), because that reuses the interrupted-reclaim path (
absentis physical-only,src/core/domain.ts:544). android.emulator.*keys stay, because existing configs must load.- a drained backend loads only while a record names it, because a config change must not orphan a container.
- the backend id is a tag, because
requiresalready routes (B37). --requires redroidwhile it is down:CAPABILITY_MISSING, as for a refused driver.- a class or ranged request never installs, because ADR 0015 §5 says so.
- seeds resolve on
avdonly; no warm-pool backend rule, because the pool is deprecated. - an image-tag request drops backends that take no tags (Redroid) before resolution (I4);
android.defaultImageTagisavd's only. - a plain lease with no running backend answers
NO_DRIVER, as a host with no Android driver does today. --privileged, documented as root-equivalent; adb on127.0.0.1ports 5700–5799 (I15), because an open adb port is a remote shell.- one shared adb server, kept at stop while a Redroid serial is connected, because agent-device takes one port.
- the
dockerCLI with an optional context or host, because one CLI keeps v1 small. - ownership is the label;
/datastays in the container. - settings under
android.redroid.*, RAMandroid.redroid.bytesPerDevice(1 GiB), because the loader takes that shape. - pinned dated tags, Android 16 out; all four booted on Colima (facts12.log).
docker stop -t 2, because Redroid ignores SIGTERM.- phone and tablet profiles; GPU
guest. - a boot that never completes fails with the boot timeout, pointing to
simlock doctor. backendinspeconly (I5).- adb at
<sdk root>/platform-tools, then onPATH, because a distroadbis the Linux host case. - backend start reaches core through a driver callback (B39), because drivers are built before core.
Behaviours
| Id | Behaviour (invoker, action, what it sees) | Seam | Cases | Task |
|---|---|---|---|---|
| B1 | A daemon starts on a state.db from before this feature: every Android virtual device row and Android baseline gets backend avd, and leases, devices and baselines go on as before. |
Registry.load over a migrated database, as in src/core/registry-state-db.test.ts |
android virtual row → avd; android physical row → none; ios rows → none; android baseline → avd; ios baseline → none; a database already at the new version is unchanged |
#2049 |
| B4 | Devices of two backends never share a pool: a ready device of one backend is never granted for a spec of another. | sameSpec in src/core/domain.test.ts; the planner in src/leasing/acquisition-planner.test.ts |
same model, OS and tag, different backend → not the same spec; same backend → same; both without backend (iOS) → same; Android baselineSpec, warm-pool newest version and learned kind → backend: "avd" (X57) |
#2049 |
| B9 | status, lease and list show a virtual device's backend in its spec (I5). |
buildDispatcher (src/daemon/test-dispatcher.ts:184) with a FakeDriver (src/core/fake-driver.ts:147) whose spec has a backend |
Android virtual device → spec.backend; iOS device → no field; phone → no field |
#2049 |
| B20 | A device of a backend with its own RAM figure counts that figure against the RAM budget; every other device counts its platform's (I11). | the resource strategy in src/core/capacity/strategies/resource/index.test.ts |
backend in the map → its figure; a backend skipped at start and started on a retry → its own figure (the map holds it from start); backend not in the map → platform figure; no backend → platform figure; slim iOS unchanged | #2049 |
| B24 | A backend the platform driver reports unreadable (I14) leaves its devices alone: startup ends none of their leases, resumes none of their reclaims, deletes none of them and re-arms none of their quarantines (B38), the health monitor skips them that tick, and doctor reports no drift for them. Devices of the other backends are judged as usual. | deviceOutcome (src/leasing/lease-reconciler.ts:58) over a StartupRead; the health monitor (src/leasing/lease-health-monitor.ts:187) and doctor (src/core/doctor.ts:77) with a FakeDriver whose reality names an unreadable backend |
device of the unreadable backend → wait / skipped / no finding; its reclaiming, spent shutdown or quarantined device at start → untouched, no driver call; device of another backend missing → missing as today; no backend unreadable → as today |
#2049 |
| B26 | A component's in-use count, its removal's block on new devices and the provision claim match devices by the backend and API level the component serves (I12), not by its version string. | ComponentInstaller tests (src/core/component-installer-remove.test.ts) with a FakeDriver listing components that serve a backend |
remove redroid-34 with a Redroid API-34 device → COMPONENT_IN_USE; the same with only an emulator API-34 device → removed; remove emulator 34 with only a Redroid API-34 device → removed; a Redroid provision during a redroid-34 removal → ComponentBeingRemovedError; an emulator provision during it → goes on; a component with no footprint → no disk reservation |
#2049 |
| B2 | The Android platform driver sends every virtual verb of a device to the backend its spec names, and every phone verb to its phone part; phones are served whatever the list holds. | AndroidDriver tests (src/drivers/android/index-lifecycle.test.ts) with a fake second backend |
provision, makeReady, shutdown, destroy, estimate, screen, input, device TCP and passthrough on an emulator device reach the avd backend only; the same on the fake backend; enrolment, presence, physical lease and inspect reach the phone part with ["redroid"], with false and with the avd backend skipped; a device of a backend not running → BackendNotRunningError (I17), never NoDriverError |
#2050 |
| B3 | The platform driver's listing and catalog survive one backend failing: listManaged lists the others and names the failed one unreadable (I14); the catalog leaves the failed backend out. |
AndroidDriver tests with a fake second backend that throws |
both list; one throws → its devices absent, backend in unreadableBackends; a backend not running (retrying, or its engine stopped) → unreadable; a drained backend whose engine is unreachable → unreadable; catalog with one throwing → the other's entry; all throw → the read throws as today |
#2050 |
| B5 | An operator sets android.virtualDevices (I3) or a tag list, and the config loads or is refused with the message in I3. |
the config loader, src/core/config-platform-and-driver-settings.test.ts, with a fake backend definition fake beside avd |
every row of the first Examples table with fake in place of redroid |
#2050 |
| B32 | With the real backend registry the config loader accepts ["avd", "redroid"], ["redroid", "avd"] and ["redroid"], and refuses an unknown id naming avd, redroid. |
the config loader over driverConfigEntries (src/driver-registry/index.ts:5) |
the Examples rows naming redroid; ["docker"] → expected a backend this worker knows (avd, redroid), not "docker" |
#2051 |
| B6 | The daemon starts the Android platform driver when adb is found, with each listed backend in list order; a listed backend that cannot start is skipped with driver.backend-rejected (I6) and the others and the phones run. |
discoverDrivers on a host with an SDK, src/daemon/driver-discovery.test.ts:133 (real discovery, fake filesystem and process runner) |
true; false (no backend, phones served); ["avd"] with no emulator binary → emulator skipped sdk-incomplete, phones served; no adb → no Android driver, as today; owned root refused → driver.root-rejected, platform skipped as today; adb server occupied → driver.adb-server-rejected as today; createCore gets backendBytesPerDevice from the listed and drained backends' bytesPerDevice(settings) (fake at 1 GiB → its devices count 1 GiB) |
#2050 |
| B35 | A backend taken off android.virtualDevices while records name it is drained (I16): loaded for cleanup only, makes no devices, not in the catalog or virtualTags; its free devices are deleted at start as under virtualDevices: false (src/core/startup-converger.ts:69), leased ones when their lease ends. |
discoverDrivers real-discovery tests (src/daemon/driver-discovery.test.ts:133) given recorded backends; src/core/startup-converger.test.ts; buildDispatcher with a fake drained backend |
["avd", "redroid"] → ["avd"], one free and one leased Redroid device: free deleted at start (virtual-devices-off), leased served to its end then deleted, --requires redroid → CAPABILITY_MISSING; engine down at start → both kept, unreadable, no driver call (B38); core.resumeBackend for it (engine back) → free one deleted then (B38); ["redroid"] from both → free emulators deleted, sources and baselines untouched; no record names it → not loaded |
#2050 |
| B37 | A configured worker tag or android.virtualTags entry equal to a backend id loads and names that backend: only its devices carry it; doctor warns tag-names-absent-backend (I16) when the worker does not run it. |
the config loader; src/daemon/dispatcher-leases.ts:66 through buildDispatcher; doctor with a FakeDriver |
android.virtualTags: ["redroid"], Redroid running → --requires redroid gets only Redroid, no finding; Redroid not listed → loads, finding, CAPABILITY_MISSING; worker tags: ["avd"] on ["redroid"] → finding; ["emulator"] → an ordinary tag, as today |
#2050 |
| B30 | catalog.get answers one android entry made from every running backend's catalog: models, runtimes, model runtimes, details and custom models in union, the first backend's default runtime and images from the backends that have them (I1). |
DriverCatalog.listCatalog (src/core/driver-catalog.ts:221) with the platform driver over two fake backends |
two backends with overlapping models; a model only one backend has; one backend's catalog throws → the other's; class defaults computed on the merged entry; no running backend → the entry a platform with no virtual devices has today (phonesOnlyEntry, src/core/driver-catalog.ts:54), so phones still route |
#2050 |
| B7 | An agent's virtual lease is routed to a backend by its requires and the operator's order (I4), class and range requests included. |
buildDispatcher with an Android FakeDriver that has two backends |
every row of the second Examples table but the baseline and physical rows; --requires redroid --image-tag google_apis with no model → BAD_REQUEST before the class path (src/leasing/acquisition-requests.ts:65 would else answer RUNTIME_MISSING); plain lease with ["redroid"] and its engine down, or true with avd skipped → NO_DRIVER; --requires avd --image-tag google_apis not installed → RUNTIME_MISSING as today; tag, only Redroid running → BAD_REQUEST |
#2050 |
| B34 | A class or ranged request walks the backends and never installs: with no installed pairing anywhere it answers the first candidate's RUNTIME_MISSING, downloadable: false (ADR 0015 §5). |
buildDispatcher with a two-backend Android FakeDriver, as src/leasing/create-leasing-restart-and-classes.test.ts:158 does for one |
--requires redroid --os 35, no 35 → RUNTIME_MISSING, no install; --os 36, order ["redroid", "avd"], neither has it → the same; --os ">=34", only avd has 35 → avd, 35; downloads on → no change |
#2050 |
| B8 | A lease naming a baseline goes to the backend that saved it, and is refused when requires names another backend. |
buildDispatcher with two fake backends and a saved baseline |
baseline of backend A, no requires → A; requires A → A; requires B → CAPABILITY_MISSING (I4) |
#2050 |
| B27 | catalog.get lists the running backends' ids in the platform's virtualTags, after the configured tags (a configured tag equal to a backend id: listed once, left out while that backend is not listed or running, so the gateway refuses up front); the gateway routes --requires redroid only to workers whose catalog has it, rereading a catalog at once on driver.backend-started and driver.backend-rejected. |
src/daemon/dispatcher.test.ts:297; the gateway's src/gateway/routing/pipeline.test.ts; WorkerLink tests for the refresh |
one backend; two; ["redroid"] → no avd; false → none, as today; 8 configured tags plus 2 ids → 10 accepted; redroid configured and running → once; android.virtualTags: ["redroid"] with Redroid not listed, or listed but not running → redroid left out, gateway CAPABILITY_MISSING; gateway: worker with redroid picked, worker without passed over; driver.backend-rejected pushed → catalog read again before the next pick; no event → the 30 s refresh |
#2050 |
| B11 | The warm pool learns a kind only from a grant on the platform's first running backend, and its targets resolve as plain leases. | src/leasing/create-leasing-warm-pool.test.ts with two fake backends |
a grant on the second backend learns nothing; a grant on the first learns as today; a target with order ["redroid", "avd"] makes the first backend's devices |
#2050 |
| B28 | Seeds, settles and baselines stay with the avd backend: listSources, destroySource, settleSeed, ensureSeed and simlock seed reach it whatever the order, and resolveSeedSpec resolves on avd alone, with no backend walk. |
AndroidDriver tests with a fake second backend; src/core/seed-settle/settle-choice.test.ts |
order ["redroid", "avd"]: simlock seed --platform android resolves an avd spec and settles an emulator seed; baseline list, stale check, remove and nuke reach the emulator's sources; with no avd backend → no sources, simlock seed refused as for a platform with no settle |
#2050 |
| B12 | The operator lists redroid; the platform driver starts the Redroid backend when the engine answers as Linux. Otherwise it skips it with driver.backend-rejected naming why, checks again every 30 s, and starts it with driver.backend-started when the engine answers. |
the Redroid backend over ScriptedProcessRunner (src/ports/scripted-process-runner.ts:51) answering I7, on a fake clock |
engine Linux arm64 → starts; docker not found; context not found; engine unreachable; engine not Linux; unreachable then answering after one 30 s tick → started, event once; the same reason twice → one event; config with both android.redroid.context and host → refused with the I9 message (config loader) |
#2051 |
| B36 | A running Redroid backend whose engine stops goes back to not running: the 30 s engine check (B12's timer, always on) or a failed docker ps in listManaged (health monitor, src/leasing/lease-health-monitor.ts:187) emits driver.backend-rejected engine-unreachable; redroid leaves virtualTags; its devices are unreadable (I14), leases run to their TTL; when it answers, driver.backend-started, and a stopped container boots at its port (B15). |
the Redroid backend over ScriptedProcessRunner on a fake clock; AndroidDriver tests |
docker info fails → one event, tag gone, --requires redroid → CAPABILITY_MISSING, held lease kept; that lease ends while the engine is down → device stays reclaiming, not quarantined, keeps its slot, reclaimed on driver.backend-started (B38, B39); answering after one tick → started, devices listed; container exited on return → recovered at the same port; docker ps fails between ticks → down at once; two failed ticks → one event |
#2051 |
| B33 | Redroid's resolveSpec with an image tag: a tag the request names is refused; the worker's default tag finds nothing, so the resolver's default-tag attempt falls through (src/leasing/acquisition-spec-resolver.ts:97). |
the Redroid backend's resolveSpec over ScriptedProcessRunner |
imageTag: "google_apis" → BAD_REQUEST android lease requests do not take an image tag on redroid; defaultTag: true → RuntimeMissingError with no component and downloadable: false; no tag, redroid-34 installed → spec 34 |
#2051 |
| B13 | An agent leases Redroid: simlock takes a free port of the range, creates a labelled container, starts it, connects adb on simlock's server and waits for boot (I7, I8), then grants serial 127.0.0.1:<port>. |
the Redroid backend over ScriptedProcessRunner with replies captured in I7 and I8; the slow-lane test e2e/slow-android-redroid.test.ts |
success; a port taken by another program (loopback probe answers) → next port; a port another instance's container holds (label) → next port; range full → provision failure No free Redroid port in 5700-5799; adb connect prints failed to connect (exit 0) then succeeds; device offline while booting; the readiness loop re-issues adb connect 127.0.0.1:<port> before every getprop poll (facts12.log); sys.boot_completed never 1 within android.bootTimeoutMs → boot failure, container removed; container exits during boot (docker inspect state exited) → failure naming the exit code; the engine refuses the port at start (port is already allocated) → boot failure; name clash on create (Conflict) → provision failure |
#2051 |
| B14 | A Redroid lease ends: simlock disconnects adb, stops the container and removes it; the next lease's device has none of the first's data. | the Redroid backend over ScriptedProcessRunner; the slow-lane test |
stop then remove; remove of a container already gone (docker rm -f exits 0, prints nothing) → done; docker stop of a missing container → treated gone; second lease: /data/local/tmp/m written by the first is absent |
#2051 |
| B15 | A Redroid device booted again (health recovery, or after the engine or the daemon restarted) answers at the serial it was granted. | the Redroid backend, makeReady with purpose: "recover"; recoverLeased (src/core/managed-device-lifecycle.ts:235) with a fake backend |
port 5701 before stop and after start (captured in I7); the stored port reused, never read back; address returned equals the stored one; docker stop -t 2 (exit 137) then docker start → the reconnecting readiness loop of B13 sees sys.boot_completed 1, with or without an adb disconnect first (facts12.log, 6 s and 7 s) |
#2051 |
| B16 | After a daemon restart the Redroid backend lists the containers labelled with this instance and connects adb to the running ones; doctor lists a labelled container no record names, and doctor --purge-orphans removes it. |
listManaged over ScriptedProcessRunner; doctor in src/core/doctor-observed-state.test.ts with a fake backend |
running container with a record → connected, running; stopped container → stopped; record whose container is gone → missing; container of another instance → not listed; orphan → finding, purged only with --purge-orphans |
#2051 |
| B31 | The health monitor sees a Redroid device as running only when its container runs and its serial is a device on simlock's server; a running container whose serial dropped off is connected again in the listing. |
listManaged over ScriptedProcessRunner |
container running, serial device → running; serial absent, connect succeeds → running; connect fails → stopped (the monitor recovers it after health.stableObservations); serial offline → transitioning |
#2051 |
| B17 | A Redroid lease's commands, screen, input and tunnels work through simlock's adb server: the lease environment names the server port; passthrough is scoped to the serial and refuses emu; the screen and input use the same target as an emulator's; the emulatorPort tunnel is refused. |
the Redroid backend's passthrough rules and screen target in unit tests; the slow-lane test for the rest | adb shell runs; adb emu ... refused; adb -s <other serial> refused; console stream shows frames (slow lane); a tap through the input socket lands (slow lane); tunnel --emulator-port adb → TUNNEL_UNSUPPORTED emulator adb: the lease is on a Redroid device; emulator ports need an Android emulator (supportsEmulatorPort false, src/drivers/android/device-tcp.ts:203; noun added to src/core/device-tcp.ts:25); reverse tunnel works (slow lane) |
#2051 |
| B18 | catalog.get on a worker with Redroid lists the phone and tablet library profiles and the API levels whose images are installed (I9). |
the Redroid backend's listCatalog over ScriptedProcessRunner |
image redroid-34 installed → runtime 34; none installed → no runtimes; TV, Wear, automotive and desktop profiles absent |
#2051 |
| B19 | baseline save on a Redroid lease is refused before the lease ends (I10); the lease goes on. |
src/core/baselines.ts save path with a FakeDriver whose saveRefusal answers |
Redroid lease → BAD_REQUEST, lease still held; emulator lease → saved as today |
#2051 |
| B29 | At daemon stop the shared adb server is kept while any Redroid serial is connected, as while an emulator is attached, and adopted by the next start. | AndroidDriver.dispose tests (src/drivers/android/index-lifecycle.test.ts) |
Redroid serial connected → server left; emulator attached → left as today; neither → stopped as today; adb devices unreadable → stopped as today |
#2051 |
| B21 | A Redroid lease whose image is missing pulls it when downloads are allowed (progress per layer), and records the component; otherwise answers RUNTIME_MISSING naming redroid-<API level>. |
the component installer tests with the Redroid backend over ScriptedProcessRunner replies from I12 |
downloads on → pull, component.installed; downloads off → RUNTIME_MISSING; tag not found upstream → install failure with the engine's message; second request during the pull joins it; pull past downloads.timeoutMs → the existing timeout error |
#2052 |
| B22 | An operator runs simlock component install, list or remove android redroid-34; remove is refused while a device uses it. |
the component installer and simlock component CLI tests |
install; already installed; list shows redroid-34 with its size; remove; remove in use → COMPONENT_IN_USE; redroid-99 → Unknown component redroid-99; known: redroid-31, redroid-33, redroid-34, redroid-35; redroid-34 on a worker not running Redroid → the same unknown-component refusal |
#2052 |
| B23 | simlock doctor on a worker that lists redroid reports what keeps Redroid from booting, with a fix line (I13). |
doctor with the Redroid prerequisites over ScriptedProcessRunner |
all fine → nothing; docker not found; context not found; engine unreachable; engine not Linux; binder missing; the alpine:3.20 run past its limit, or its pull refused → redroid-binder-unknown; worker that does not list redroid → no Redroid checks |
#2052 |
| B38 | Core leaves a device of a backend not running alone: a lease-end reclaim meeting BackendNotRunningError (I17) leaves it reclaiming, no quarantine, no event; a quarantine retry meeting it waits health.probeIntervalMs, uncounted, as for an absent phone (src/core/quarantine-coordinator.ts:222); startup's four steps skip it (StartupRead.isDeviceReadable, I17). It keeps its capacity slot. |
ReclaimCoordinator and QuarantineCoordinator tests with a FakeDriver that throws BackendNotRunningError; src/core/startup-converger.test.ts with a StartupRead naming an unreadable backend |
lease ends, shutdown throws it → reclaiming, no device.quarantined; destroy throws it after shutdown → shutdown, kept; quarantined device, retry throws it → attempts unchanged, re-armed, never stranded; any other error → quarantine as today; startup with the backend unreadable → none of the four steps calls the driver; capacity counts the device; core.resumeBackend(platform, backend) → the four steps for that backend's devices only: lease ended during the outage → reclaimed, deleted; quarantined → retried, attempts as before; another backend's → untouched; a second call → nothing more |
#2049 |
| B39 | A backend that starts calls the driver callback onBackendStarted(platform, backend); src/daemon/driver-discovery.ts bridges it, like onSlimmed (:209), to driver.backend-started and a BackendStartSink bound to core.resumeBackend (I17) after core.connect (earlier calls queue, run once after converge). What resumeBackend does is B38's. |
the bridge: discoverDrivers on a host with an SDK (src/daemon/driver-discovery.test.ts:133, scripted process runner, a sink spy); the sink: a unit test of BackendStartSink (src/daemon/backend-start-sink.test.ts, new); the end case: the slow lane |
callback → one event and one sink call; callback before the sink is bound → queued, run once after binding, never twice; a second start → nothing more; a Redroid lease ended while the engine was down → reclaimed after the engine returns (slow lane) | #2051 |
Stored state
| Id | What and where | Created, changed, deleted by | Listed or swept by | A restart mid-step leaves | Schema step | Task | Used by |
|---|---|---|---|---|---|---|---|
| S1 | devices.backend (nullable) in state.db (src/core/registry-schema.ts): the backend that made the virtual device; null for phones and iOS |
written by Registry.registerDevice from the spec, after the driver's provision (src/core/device-provisioner.ts:141 then :98); filled for old Android virtual rows by the migration (B1); never changed |
read by Registry.load, sameSpec, capacity and the device view |
nothing new: the row and its backend are one insert | registry +1 | #2049 | #2050, #2051 |
| S2 | baselines.backend (nullable) in state.db (src/core/baselines-schema.ts) |
written by a save from the device's spec; filled for old Android rows by the migration; deleted with the row | read by a lease naming the baseline (B8) | nothing new | baselines +1 | #2049 | #2050 |
| S3 | redroid_device_data in state.db, a second table of the Android device-data owner: device_id, container, port, image, image_id |
written by the Registry with the device row from the driverData the Redroid backend's provision returned; deleted with the row |
read by Registry.load through the Android device-data table, which reads both tables |
a crash after docker create and before the row is written leaves a labelled container with no row: an orphan, listed by doctor, removed only by --purge-orphans (B16) |
android-device-data +1 | #2051 | — |
| S4 | Docker containers on the engine, labelled simlock.instance=<instance id>, simlock.backend=redroid, simlock.device=<driver device id>, simlock.port=<port>, named simlock-<instance id first 8>-<driver device id>; /data inside the container |
created by provision (B13); stopped by shutdown; removed by destroy (B14) or doctor --purge-orphans (B16) |
listManaged (docker ps -a --filter label=simlock.instance=<id> --filter label=simlock.backend=redroid); the port allocator reads simlock.port of every instance's containers |
see S3 | none | #2051 | #2052 |
| S5 | Redroid images on the engine, recorded as components android / redroid-<API level> in the existing components records |
docker pull by the component installer (B21, B22); docker image rm by component remove |
component list, catalog.get |
a pull cut short leaves layers the engine keeps or discards itself; no record is written until the pull ends | none | #2052 | — |
Interfaces
| Id | What | Shape and bounds | Errors and limits | Where | Task | Used by |
|---|---|---|---|---|---|---|
| I1 | Backend on specs and catalogs | VirtualSpec and ExactDeviceRequest gain backend?: string ([a-z][a-z0-9-]{0,31}), part of sameSpec; absent on iOS and phones. Driver gains optional backends(): readonly string[] (running ids in order). Driver.listCatalog takes an optional { backend } and answers that backend's entry; without it, the merged entry (B30). DriverCatalog gains backends(platform) and listCatalog(platform, backend) |
merge: models, runtimes, modelRuntimes, modelAliases, modelClasses, modelDetails, customModels in union, first backend first; defaultRuntime of the first backend that has one; images concatenated; a backend whose catalog throws is logged and left out; all throw → the read throws |
src/core/driver.ts, src/core/domain.ts, src/core/driver-catalog.ts, src/drivers/android/ |
#2049 | #2050, #2051 |
| I2 | Backends inside the Android driver, and their light definitions | heavy: AndroidBackend in src/drivers/android/backend.ts with the virtual verbs of Driver (resolveSpec, provision, makeReady, shutdown, destroy, listManaged, listCatalog, components, estimate, screen target, passthrough rules, saveRefusal), built by a factory per id from src/drivers/android/backends.ts; light: BackendDefinition { platform; id; validators; defaults; bytesPerDevice?(settings): number; imageTags: boolean } (reads the backend's own setting, the one source of its figure), listed in src/driver-registry/index.ts; a new backend is its folder plus one line in each list |
a device id is routed by its backend's prefix: emulator ids as today, Redroid ids redroid-<12 hex> |
src/drivers/android/, src/driver-registry/ |
#2050 | #2051 |
| I3 | Config key android.virtualDevices, and tag lists |
boolean or a list of 1 to 4 backend ids known to the registry, no repeats; true = ["avd"]; ios.virtualDevices stays boolean. A configured worker tag or virtual tag equal to a backend id is accepted and names that backend (B37) |
Invalid config value for "android.virtualDevices": expected true, false, or a list of 1 to 4 backends; ... expected each backend once, "<id>" is listed twice; ... expected a backend this worker knows (<ids>), not "<id>" |
src/core/config-validators.ts, src/core/config-types.ts |
#2050 | #2051 |
| I4 | Backend routing of a virtual lease | candidates: the platform's running backends, narrowed to the one requires names, then, for a request naming an image tag, to backends that take image tags at all (BackendDefinition.imageTags, avd only; never installed images: an uninstalled tag on avd stays RUNTIME_MISSING, src/drivers/android/catalog.ts:197-202), before resolution (src/leasing/acquisition-spec-resolver.ts:78); a requires backend so dropped, or no candidate left (only Redroid running) → BAD_REQUEST android lease requests do not take an image tag on <backend>, naming the first dropped backend; no running backend → NO_DRIVER No driver registered for platform: android (src/core/driver-catalog.ts:23-26, as today); per candidate in order, the whole resolution (default-tag attempt, class or range, exact) on that backend's catalog with downloads off; the first success takes it; else the first whose failure is a RuntimeMissingError with a component runs again with the lease's download setting; else the first candidate's error |
CAPABILITY_MISSING, message This worker cannot serve <names> (existing), when a backend id in requires is not running; No one android backend here carries <names> when requires names two backends; a baseline of another backend: Baseline <name> was saved on <backend>; it cannot serve <names> |
src/leasing/acquisition-spec-resolver.ts, src/daemon/dispatcher-leases.ts, src/daemon/dispatcher-capabilities.ts |
#2050 | #2051 |
| I5 | Contract: backend in a device's spec; catalog virtualTags up to 12 |
deviceSpecSchema gains backend (optional, I1 pattern); CATALOG_VIRTUAL_TAGS_MAX 8 → 12 so 8 configured tags plus the backend ids fit. Bumps the protocol by one |
an older client ignores the field | src/contract/device-schemas.ts, src/contract/status-schemas.ts |
#2049 | #2050 |
| I6 | Events driver.backend-rejected and driver.backend-started |
rejected: { platform, backend, reason: "sdk-incomplete" | "docker-missing" | "context-missing" | "engine-unreachable" | "engine-not-linux", message }; started: { platform, backend }; both in EVENTS.md and events.mdx; driver.root-rejected and driver.adb-server-rejected stay platform-level |
rejected: once per skipped listed backend at start, on a retry only when the reason changes, and once when a running backend's engine stops; started: when a backend not running comes up. Both join WORKER_VIEW_CATALOG_EVENTS (src/contract/worker-view.ts:32) and the gateway's refresh filter (src/gateway/worker-link.ts:612). A drained backend emits neither |
src/bus/index.ts, docs/internal/EVENTS.md, src/daemon/driver-discovery.ts |
#2050 | #2051 |
| I7 | Docker CLI calls of the Redroid backend, each through ProcessRunner with --context <c> or DOCKER_HOST=<h> when set |
docker info --format '{{.OSType}} {{.Architecture}}' → linux aarch64; docker create --name simlock-<i8>-<id> --privileged --label simlock.instance=<i> --label simlock.backend=redroid --label simlock.device=<id> --label simlock.port=<p> -p 127.0.0.1:<p>:5555 [--cpus <n>] [--memory <m>] <image> androidboot.redroid_width=<w> androidboot.redroid_height=<h> androidboot.redroid_dpi=<dpi> → container id; docker start <name>; docker inspect --format '{{.State.Status}} {{.State.ExitCode}} {{.Image}}' <name>; docker stop -t 2 <name>; docker rm -f <name>; docker ps -a --filter label=... --format '{{.Names}} {{.State}} {{.Label "simlock.device"}} {{.Label "simlock.port"}}'; installed image (findComponent, listComponents, src/core/driver.ts:303,316): docker image inspect redroid/redroid:<tag> --format '{{.Id}} {{.Size}}' → sha256:0a61… 674553971, absent → exit 1 Error response from daemon: No such image: redroid/redroid:<tag> (facts13.log) |
captured on Colima, Docker 29.5.2 (/private/tmp/claude-501/redroid-design/), facts8.log unless named: port kept across stop and start (127.0.0.1:5701); stop -t 2 2.6 s; same port → start fails Bind for 127.0.0.1:5701 failed: port is already allocated (exit 1, left created); a macOS listener on the port is unseen by the engine, so the allocator probes it; name clash → Conflict. The container name "/<name>" is already in use (exit 1, facts2.log); rm -f of a missing container → exit 0, no output (facts4.log); stop missing → No such container (exit 1); context missing → Failed to initialize: unable to resolve docker endpoint: context "<c>": context not found: open … (exit 1, facts7.log), matched by the text context not found; engine unreachable → any other non-zero docker info, message its first stderr line, e.g. failed to connect to the docker API at <h>; … (exit 1, facts7.log). Limits: info 10 s, create/start/inspect/ps 30 s, stop 15 s, rm 30 s, port probe 1 s |
src/drivers/android/redroid/ |
#2051 | #2052 |
| I8 | adb on simlock's server for a Redroid device | adb -P <port> connect 127.0.0.1:<p> → connected to 127.0.0.1:<p> or already connected to ... (exit 0), refused → failed to connect to '127.0.0.1:<p>': Connection refused with exit 0, so the text decides; works on a server started with ADB_EMU=0 ADB_USB=0 ADB_MDNS=0 (facts11.log); adb -s <serial> shell getprop sys.boot_completed → 1; while starting → adb: device offline (exit 1); pm path android → package:/system/framework/framework-res.apk; disconnect → disconnected <serial>, again → error: no such device '<serial>' (exit 1, treated done); emu avd path exits 1 with no output (facts3.log); scrcpy-server 5.0.1 through the same serial streams video (Using video encoder: 'c2.android.avc.encoder', 200266 bytes in 3 s, facts9.log) |
boot wait bounded by android.bootTimeoutMs, each poll re-issuing connect first (facts12.log); each adb call 10 s |
src/drivers/android/redroid/ |
#2051 | — |
| I9 | Redroid settings android.redroid.* and image table |
context (Docker context name, 1 to 64 of [A-Za-z0-9._-]), host (a unix://, tcp:// or npipe:// URL, 1 to 512 chars), not both; cpus (number > 0, optional); memoryMiB (integer ≥ 512, optional); bytesPerDevice (positive integer, default 1 GiB). Image table in code, by API level: 31 → 12.0.0_64only-240527, 33 → 13.0.0_64only-240527, 34 → 14.0.0_64only-240527, 35 → 15.0.0_64only-250627, repository redroid/redroid (API levels read from each image's /system/build.prop, facts10.log) |
Invalid config value for "android.redroid": expected context or host, not both; other values use the loader's existing messages |
src/drivers/android/redroid/definition.ts |
#2051 | #2052 |
| I10 | Baseline save refused on a backend that keeps no sources | Driver gains optional saveRefusal(device: VirtualDriverDevice): string | undefined; baseline.save asks it before releaseToSave |
BAD_REQUEST: A redroid device cannot be saved as a baseline; lease an emulator (--requires avd) to save one |
src/core/driver.ts, src/core/baselines.ts |
#2051 | — |
| I11 | Per-backend RAM figure | resource strategy options gain backendBytesPerDevice: Readonly<Record<string, number>>; PlannedCapacityDevice gains backend?: string; the map is a new createCore option passed to createCapacityStrategy (src/core/create-core.ts:205), not an operator key (src/core/capacity/strategies/resource/index.ts:117-122 unchanged); the daemon fills it at start from each listed or drained backend's definition, bytesPerDevice(settings), whether it runs or not |
— | src/core/capacity/strategy.ts, src/core/capacity/devices.ts, src/core/capacity/strategies/resource/index.ts |
#2049 | #2050, #2051 |
| I12 | Components that serve a backend | InstalledComponent and DriverComponent gain serves: { backend?: string; osVersion: string }; Driver.componentFootprint becomes componentFootprint(component): { path; bytes } | undefined (undefined: no disk reservation). Redroid: id redroid-<API level> in the image table; install = docker pull redroid/redroid:<tag>, progress per <layer>: Pull complete; remove = docker image rm <tag>; size from docker image inspect --format '{{.Size}}' (674553971 for 34, facts1.log) |
unknown id: Unknown component redroid-99; known: redroid-31, redroid-33, redroid-34, redroid-35; tag missing upstream: the engine's failed to resolve reference ... not found passed on (facts6.log); pull bounded by downloads.timeoutMs |
src/core/driver.ts, src/core/component-installer.ts, src/drivers/android/redroid/ |
#2049 | #2052 |
| I13 | Doctor findings of the Redroid backend | redroid-docker-missing, redroid-context-missing, redroid-engine-unreachable, redroid-engine-not-linux, redroid-binder-missing, redroid-binder-unknown, each { prerequisite, message, remedy }; binder check docker run --rm alpine:3.20 grep -w binder /proc/filesystems (nodev binder, exit 0, when loaded, facts1.log; not-loaded exit 1 is grep's no-match, not captured); pulls alpine:3.20 (~4 MB) once, which the finding says |
limit 120 s, the pull included; exit 1 with no stderr → redroid-binder-missing; past the limit or any other failure (a refused or offline pull of alpine:3.20) → redroid-binder-unknown with message could not check binder: <first stderr line> (or within 120 s); remedies: install Docker / name the context / start Colima / a Linux engine / the two colima ssh lines in How it works (Linux: the same two commands with sudo) |
src/drivers/android/redroid/prerequisites.ts |
#2052 | — |
| I14 | Unreadable backends in a listing | DriverReality gains unreadableBackends?: readonly string[]; a device whose spec names one is neither running nor missing |
— | src/core/driver.ts, src/leasing/lease-reconciler.ts, src/leasing/lease-health-monitor.ts, src/core/doctor.ts |
#2049 | #2050, #2051 |
| I15 | Redroid port allocation | the lowest port of 5700 to 5799 that no labelled Redroid container of any instance holds (simlock.port), no provision in this process holds, and a 1 s loopback connect finds closed |
range full: provision fails No free Redroid port in 5700-5799 |
src/drivers/android/redroid/ |
#2051 | — |
| I16 | Drained backends and tags naming a backend | discoverDrivers gains recordedBackends: ReadonlyMap<Platform, readonly string[]> (the ids the loaded records name); the platform driver loads each unlisted one as drained; IdleDeviceDeletion (src/core/startup-converger.ts:27) gains backends: readonly string[]; doctor finding tag-names-absent-backend { key, tag } |
message Tag "<tag>" in <key> names the <backend> backend, which this worker does not run; remedy list <backend> in android.virtualDevices, or remove the tag; deletion keeps reason virtual-devices-off and its failure handling (src/core/create-core.ts:425) |
src/daemon/driver-discovery.ts, src/daemon/worker-composition.ts, src/core/startup-converger.ts, src/core/doctor.ts, src/drivers/android/index.ts |
#2050 | #2051 |
| I17 | Backend not running, to core | BackendNotRunningError(platform, backend) in src/core/driver.ts, thrown by the platform driver for any verb on a device of a backend that is not running; StartupRead.isDeviceReadable(device) = platform readable and its backend not in unreadableBackends (replaces isReadable(device.spec.platform) at src/core/startup-converger.ts:61, :111); core.resumeBackend(platform: Platform, backend: string): Promise<void> |
message The <backend> backend of <platform> is not running; never reaches a caller: leasing and core treat it as a wait |
src/core/driver.ts, src/core/startup-read.ts, src/core/startup-converger.ts, src/core/reclaim-coordinator.ts, src/core/quarantine-coordinator.ts, src/core/create-core.ts |
#2049 | #2050, #2051 |
Existing code
Commit 447cc5bbca2a7071d855a52296c42a80478814aa.
Searches: drivers.get( / catalog.get( / #drivers.get( over src without tests (57 hits, 41 lookups by platform); listCatalog( (10); listManaged() / .reality( (9); virtualDevices (24); virtualTags (19); tagsValidator( (4); deviceDataTables (20); claimProvision / #simlockDevices / componentFootprint (6); CREATE TABLE devices / CREATE TABLE baselines (2); virtualLeaseEnvironment (3); releaseToSave (4); class .* implements Driver (3); RuntimeMissingError( (14).
| Id | Code (path:line) | Today | With this feature | Handled by |
|---|---|---|---|---|
| X1 | src/core/driver-catalog.ts:84 |
one driver per platform; get(platform) at :94 |
unchanged: the Android driver is the platform driver | B2 |
| X2 | src/core/driver-catalog.ts:221 |
listCatalog asks each platform's driver for one entry and rethrows for a named platform |
the Android driver answers the merged entry; a per-backend read is added | B30, I1 |
| X3 | src/core/domain.ts:105 |
sameSpec compares platform, model, OS, mode, tag, baseline |
and backend | B4 |
| X4 | src/core/registry-schema.ts:4 |
devices has platform and no backend; the owner is at version 11 (:182) |
backend column, filled for Android virtual rows |
B1, S1 |
| X5 | src/core/baselines-schema.ts:4 |
baselines has no backend |
backend column |
B1, S2 |
| X6 | src/core/device-provisioner.ts:141 |
the driver provisions, then #register (:98) writes the row |
unchanged; the Redroid container exists before its row, which is where orphans come from (src/core/doctor.ts:218) |
S3, B16 |
| X7 | src/core/registry-rows.ts:320 |
a device's data goes to its platform's device-data table | unchanged; the Android table reads and writes redroid_device_data too |
S3 |
| X8 | src/daemon/driver-discovery.ts:103; e2e/fake-driver/fake-driver.ts:237 |
production device-data tables by platform; the e2e fake driver holds componentFootprint as an object |
tables unchanged by platform, and e2e/fake-driver/index.ts keeps its deviceDataTables contract; the fake driver's componentFootprint becomes the I12 function and its components carry serves |
S3; I12 |
| X9 | src/leasing/lease-reconciler.ts:58 |
a device of an unreadable platform waits; one absent from the reality is missing | a device of an unreadable backend waits too | B24 |
| X10 | src/leasing/lease-health-monitor.ts:187 |
one listManaged per platform; a throw skips the platform's devices (:153) |
a device of an unreadable backend is skipped too | B24, B31 |
| X11 | src/core/doctor.ts:77 |
drift and orphans per observed platform; drivers mapped by platform (:91); purge by platform (:240) |
unchanged map; an unreadable backend's devices get no drift finding; a Redroid orphan reaches the platform driver, which routes it by id | B24, B16 |
| X12 | src/core/component-installer.ts:406 |
claimProvision keys on platform and spec.osVersion; #simlockDevices (:451) counts devices by osVersion === version |
both match the backend and API level the component serves | B26 |
| X13 | src/core/component-installer.ts:525 |
every install reserves componentFootprint bytes on a host path |
a component with no footprint reserves nothing | B26, B21 |
| X14 | src/core/component-installer.ts:197 |
install and remove find the driver by platform (also :285) |
unchanged; the Android driver routes redroid- ids to Redroid |
B21, B22 |
| X15 | src/core/capacity/devices.ts:12 |
a capacity device carries platform and mode | and backend | B20 |
| X16 | src/core/capacity/strategies/resource/index.ts:26 |
RAM per device is per platform | a backend in backendBytesPerDevice uses its own figure; the options are fixed when the strategy is built (:26-41), so the map is filled at start from the listed and drained backends' settings |
B20, B6 |
| X17 | src/contract/device-schemas.ts:142 |
the device spec on the wire has no backend | backend added |
B9, I5 |
| X18 | src/contract/status-schemas.ts:159 |
virtualTags holds at most 8 |
12 | B27, I5 |
| X19 | src/core/config-validators.ts:271 |
android.virtualDevices is booleanValue; Android's driver validators merge under android.* (:269) |
a list of backend ids; Redroid's validators under android.redroid |
B5, I3, I9 |
| X20 | src/core/config-validators.ts:338 |
tagsValidator refuses module names, for worker tags (:165) and virtual tags |
unchanged; a tag equal to a backend id is read as that backend at dispatch and in the catalog (B37) | B37 |
| X21 | src/core/config-validators.ts:439 |
drivers.<platform>.* leaves are flat strings, numbers, booleans |
unchanged: nothing new goes there | I9 |
| X22 | src/daemon/driver-discovery.ts:274 |
Android starts only with a full SDK; root and adb-server refusals skip the platform | starts with adb alone; the avd backend needs the rest; refusals unchanged |
B6 |
| X23 | src/drivers/android/sdk-paths.ts:107 |
an SDK is complete only with the emulator and adb (:111), and cmdline-tools (:140) |
the platform needs adb: <sdk root>/platform-tools/adb (:107-117), then PATH, carried in the incomplete and absent results (:60-62); avd checks the rest |
B6 |
| X24 | src/daemon/dispatcher-leases.ts:66 |
a virtual lease's requires is checked against the platform's virtualTags |
against those plus the running backend ids | B7 |
| X25 | src/daemon/dispatcher-status.ts:64 |
a catalog entry's virtualTags is the platform's config list |
plus the running backend ids | B27 |
| X26 | src/gateway/routing/stages/has-capabilities.ts:22 |
a worker serves a name its catalog's virtualTags has |
unchanged code; the tags now hold backend ids | B27 |
| X27 | src/leasing/acquisition-spec-resolver.ts:66 |
one resolution on the platform's driver: default tag (:84), class (:243) and range (:278) read listCatalog(...)[0] |
the resolution runs per backend on that backend's catalog (I4) | B7 |
| X28 | src/leasing/acquisition-spec-resolver.ts:203 |
a baseline request reads the platform's catalog | the baseline's backend's catalog; baselineSpec (:412) carries the backend |
B8 |
| X29 | src/leasing/acquisition-spec-resolver.ts:390 |
warm targets resolve on the platform's driver | as plain leases, through I4 | B11 |
| X30 | src/core/warm-pool/learned.ts:7 |
learned kinds key on platform, model, OS, mode, tag, baseline | unchanged; a grant off the first backend teaches nothing | B11 |
| X31 | src/core/seed-settle/settler.ts:218 |
the settler finds the platform's driver | unchanged; the Android driver sends settles to the avd backend |
B28 |
| X32 | src/core/baselines.ts:334 |
baselines list sources on the platform's driver (also destroy at :416, :480) |
unchanged; the Android driver answers the avd backend's sources |
B28 |
| X33 | src/core/baselines.ts:139 |
#save ends the lease first (releaseToSave), then asks the driver |
asks saveRefusal before the lease ends |
B19, I10 |
| X34 | src/core/physical-enrollment.ts:121 |
enrolment finds the platform's driver (also :235) |
unchanged; the Android driver serves phones whatever the list | B2 |
| X35 | src/core/physical-auto-enrollment.ts:119 |
auto-enrolment finds the platform's driver | unchanged, as X34 | B2 |
| X36 | src/leasing/physical-device-watcher.ts:154 |
presence reads go to the platform's driver | unchanged, as X34 | B2 |
| X37 | src/leasing/lease-acquisition-coordinator.ts:217 |
a physical lease finds the platform's driver | unchanged, as X34 | B2 |
| X38 | src/core/managed-device-lifecycle.ts:235 |
recoverLeased drops the address makeReady returns, since no driver moves it |
unchanged: Redroid keeps its stored port | B15 |
| X39 | src/drivers/android/index.ts:571 |
dispose keeps the adb server only while an emulator is attached (:581) |
also while a Redroid serial is connected | B29 |
| X40 | src/drivers/android/index.ts:963 |
emulatorScreenTarget aims adb at a serial on simlock's server |
Redroid uses the same target with its serial | B17 |
| X41 | src/drivers/android/index.ts:469 |
AndroidDriver.create finds the full SDK and starts simlock's adb server (:498) |
the platform driver needs adb only and builds the listed backends | B6, B12 |
| X42 | src/drivers/android/profiles/index.ts:21 |
the library profiles; pixel-7.ts:76 holds hw.lcd.density 420 |
Redroid reads width, height and density from the same entries, phone and tablet only | B18 |
| X43 | src/drivers/android/AGENTS.md:43 |
readiness needs emu avd path naming the device's folder |
Redroid's readiness is sys.boot_completed and pm path android; emu exits 1 there (I8) |
B13 |
| X44 | src/daemon/worker-composition.ts:301 |
the lease environment merges every driver's virtualLeaseEnvironment() |
unchanged: one Android driver, one adb server port | B17 |
| X45 | src/core/startup-converger.ts:69 |
at start, idle (ready, shutdown) devices of a platform whose virtual devices are off are shut down and deleted (IdleDeviceDeletion, :27) |
also devices whose spec names a drained backend | B35 |
| X46 | src/core/create-core.ts:425 |
deleteIdle shuts down and destroys with reason virtual-devices-off; a failure leaves the device for the next start |
unchanged, now also for drained backends | B35 |
| X47 | src/daemon/worker-composition.ts:168 |
the registry loads (:168) before discoverDrivers (:208) |
discovery gets the backend ids the records name | B35, I16 |
| X48 | src/leasing/acquisition-spec-resolver.ts:256 |
a class request with no installed pairing throws RuntimeMissingError with no component, so it never installs (ADR 0015 §5; src/leasing/create-leasing-restart-and-classes.test.ts:158) |
unchanged, per backend | B34 |
| X49 | src/leasing/acquisition-spec-resolver.ts:375 |
resolveSeedSpec resolves a seed's spec on the platform's driver as a lease does |
on the avd backend only, with no walk |
B28 |
| X50 | src/core/seed-settle/settler.ts:488 |
#ensure calls the driver's ensureSeed with the operator's spec |
unchanged; the spec names avd, which the Android driver routes |
B28 |
| X51 | src/contract/worker-view.ts:32 |
WORKER_VIEW_CATALOG_EVENTS holds component.installed; changesCapacityOrLeases (src/gateway/worker-link.ts:612) picks the events that refresh a view; backstop 30 s (:68) |
both backend events added | B27 |
| X52 | src/leasing/acquisition-spec-resolver.ts:97 |
the default-tag attempt falls through only on RuntimeMissingError |
unchanged; Redroid answers one with no component | B33 |
| X53 | src/core/startup-converger.ts:61, :111 |
quarantine re-arm and every startup step check read.isReadable(device.spec.platform) only |
read.isDeviceReadable(device): a device of an unreadable backend is skipped |
B24, B38 |
| X54 | src/core/reclaim-coordinator.ts:321-331, :338-348 |
a shutdown or destroy failure at lease end quarantines the device | BackendNotRunningError leaves it as it is, no quarantine |
B38 |
| X55 | src/core/quarantine-coordinator.ts:222-224, :355-380 |
a phone not present waits uncounted (#waitForPresence); a virtual destroy that fails at the last retry strands the device |
a retry meeting BackendNotRunningError waits uncounted, so a stopped engine never strands a device |
B38 |
| X56 | src/core/startup-read.ts:22 |
isReadable(platform) |
gains isDeviceReadable(device) from the reality's unreadableBackends |
B38 |
| X57 | src/leasing/acquisition-spec-resolver.ts:412, src/core/warm-pool/converger.ts:291, src/core/warm-pool/learned.ts:301 |
build Android virtual specs with no backend | set backend: "avd" while avd is the only backend; #2050 makes them backend-aware (X28, B11) |
B4 |
Tasks
flowchart LR
A[#2042 ADR] --> B[#2049] --> C[#2050] --> D[#2051] --> E[#2052]
- #2049 Records and baselines name their backend (
avdtoday); core leaves a not-running backend's devices alone. Risk: an upgrade mislabels or strands a device. - #2050 One Android driver runs the listed backends;
requires, then order, picks one; one merged catalog. Risk: a plain lease lands wrong, or phones stop. - #2051 Redroid devices: a container on a fixed port with adb, screen and input. Risk: a lease hangs, or a container outlives it.
- #2052 Redroid components, doctor checks, setup guide. Risk: an image in use is removed, or doctor names the wrong fix.
Completion conditions: all but two → #2051 (routing in #2050); component install and doctor → #2052; Linux → by hand.
Open work: #2037, #2038 (acquisition, warm pool) → #2050 depends on both; #2043 (startup converger, health monitor, idle deletion, events) → #2049 and #2050 depend on it; #2044, #2046 (src/drivers/ios/index.ts) → #2049 depends on them; #1904, #1905, #1154, #1155, #1907, #2005, #2006, #2045 (protocol range) → #2049 depends on them; PR #1927 (Android seeds): no shared function.
Written by an agent.
- 主要语言
- TypeScript
- 星标
- 730
- 派生
- 44
- 平均合并
- 15 小时 28 分钟
- 30 天内合并 PR
- 387
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
callstackincubator/simlock 的其他 Issue
-
bug:new
难度 2/5 1-3 小时 新手友好度 73/100
callstackincubator/simlock#2088 ·
维护者通常 1 天内回复
-
bug:new
难度 2/5 1-3 小时 新手友好度 64/100
callstackincubator/simlock#2080 · 1 条评论 ·
维护者通常 1 天内回复
-
task:ready
难度 4/5 3-5 天 新手友好度 52/100
callstackincubator/simlock#2079 ·
维护者通常 1 天内回复
-
platform:ios task:ready
难度 5/5 一周以上 新手友好度 18/100
callstackincubator/simlock#2078 ·
维护者通常 1 天内回复
-
iOS copy: keep the app database at the copy's own UDID可能已有人在做 @V3RON 今天认领。 未关闭platform:ios task:ready
callstackincubator/simlock#2077 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 callstackincubator/simlock 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
melgarafael/DeskcommCRM#5614 · 1 条评论 ·
维护者通常 1 天内回复
-
documentation
难度 1/5 1 小时以内 新手友好度 76/100
slackapi/slack-health-score#253 ·
维护者通常 1 天内回复
-
feature needs triage site
难度 2/5 1-3 小时 新手友好度 64/100
owid/owid-grapher#8019 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
simstudioai/sim#10710 ·
维护者通常 1 天内回复
-
via-triage
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复