Repository navigation
Description
Part of #1732.
Scope
An Android worker (macOS, Linux and Windows) settles its quick seeds in the background: after a kind's first lease, once the worker is quiet, the seed's simlock_boot is saved again from an idle copy that has a default network (#1631), and later Android leases boot with almost no post-boot work. A seed's copies and its deletion take turns, so no copy is made from a folder being deleted.
If this goes wrong, a user would notice an Android lease waiting behind a settle, a copy that fails because its seed folder vanished, or an emulator left running after a restart mid-settle.
Technical spec
Commit fb42676.
Rows
- Behaviours: B18, B19, B20, B21, B22
- Stored state: S3, S4
- Interfaces: I1, I2, I3, I10, I11 (implements or uses)
- Existing code: X8, X9, X10, X11
Facts
| # | Fact | Source |
|---|---|---|
| F1 | android_source_data has a unique index on spec_key for ready seeds, and its schema owner is at version 2 |
src/drivers/android/source-data.ts:29-33 |
| F2 | provision finds the seed under seed:<spec key> and copies it after the lock is let go |
src/drivers/android/seeds.ts:439-455 |
| F3 | withLock is a per-id promise chain with no time limit |
src/drivers/android/device-table.ts:84-96 |
| F4 | A lease boots a copy with -snapshot simlock_boot on a reserved console port |
src/drivers/android/index.ts:631-632 |
| F5 | The snapshot save is emu avd snapshot save simlock_boot, checked with snapshot list |
src/drivers/android/seeds.ts:663-685 |
| F6 | A snapshot saved before the guest has a default network restores offline; one saved with it restores online at ready | #1631 (13 of 13 leases offline); measured here on Android 36 google_apis, emulator 37.2.13 (3 of 3 restores online, ping 8.8.8.8 at ready) |
| F7 | ConnectivityService logs Sending CONNECTED broadcast for type <n> [<id> <transport>] isDefaultNetwork=true at debug level when it picks a default network; logcat -e matches the message only, not the tag, so the tag goes in the filter spec |
measured on Android 36; -e 'ConnectivityService.*…' never matched |
| F8 | Before that, dumpsys connectivity prints Active default network: none; after it, Active default network: <netId> |
measured on Android 36 |
Modules touched
Searches: android_source_data, findReadySeed, #copySeed, #removeSource, #removeSeed, destroySource, destroySeedsOf, #sweepLeftovers, withReservedPort, currentConfigHash. Files: src/drivers/android/seeds.ts, source-data.ts, index.ts, the driver's AGENTS.md, and the Android create options in src/daemon/driver-discovery.ts (the processTable #1746 adds to the context).
Rules in play
- android manual "Seeds and copies": "A seed is never leased or booted after its snapshot save" holds for the seed; the copy boots (ADR 0090 §3); the manual line is reworded to say so.
- android manual "Boot": the copy boots with
-snapshot simlock_boot,-no-snapshot-saveand the leases' launch flags; the save is the explicitsnapshot save. - android manual "One make per kind at a time": the settle holds
seed:<spec key>only for the check and the swap. - android manual "Containment": every call carries the copy's
ANDROID_AVD_HOMEand Simlock's adb port; an emulator is stopped only afteremu avd pathnames its folder. - ADR 0090 §3: the swap is one transaction; the old folder is deleted once its copies end.
- Android: android.emulator.cores sets the cores of new emulators and baselines #1740: a settle copy boots with the launch settings a lease copy gets once Android: android.emulator.cores sets the cores of new emulators and baselines #1740 lands (its
android.emulator.coreswritten before the boot), so the new seed's config hash matches what a provision checks.
Tests
Driven through AndroidDriver with the fake emulator host of src/drivers/android/test-seed-harness.ts, modelled on src/drivers/android/seeds-copies.test.ts.
- B18: a plain lease adds one to its seed's lease count: plain provision; a baseline copy; a copy that fails; a seed from before this feature; a first lease of a new kind
- B19:
settleSeedsaves an idle copy's snapshot as the seed: idle at 181 s; idle with no default network yet (waits for the listener, then saves); listener never fires butdumpsys connectivityshows a default network (saved); no default network by the cap (saved); idle only at the cap; busy at the cap; a provision of the kind meanwhile; snapshot not listed; emulator exits early; aborted; not a ready quick seed;win32readings - B20: copies and deletions take turns: stale remake,
destroySource,destroySeedsOfand a settle's swap during a copy; a copy asked for after a deletion began; two deletions of one seed at once run one after the other (decided in delivery, pending the maintainer) - B21: a restart's leftovers of a settle are swept: another process's settle row; a retired quick seed's row; a make during this process's settle
- B22:
ensureSeed: fresh; stale; none; two calls at once
Done when
pnpm test:changedpasses, with the B18 to B22 cases above.pnpm typecheckpasses.- The Android driver manual's Seeds rules say what a settle does and that copies and deletions take turns.
- On a Mac with an Android SDK,
scripts/slow-e2e.sh e2e/slow-android-smoke.test.tspasses. - On a Mac with an Android SDK, a lease of a kind whose seed was settled has
Active default network: <number>indumpsys connectivitywhensimlock leasereturns (Android: boot snapshot is saved before the cellular data call is up, so every lease starts offline #1631). - B19's
win32case parses aGet-CimInstance Win32_Processanswer captured on a real Windows host and checked in as its fixture; the PR says where it was captured.
Out of scope
- Core's scheduling (Core settles quick seeds in the background, one at a time, when the worker is quiet #1746);
simlock seed(simlock seed makes and settles a kind's seed on a worker #1749).
Depends on
- Core settles quick seeds in the background, one at a time, when the worker is quiet #1746
- Android: android.emulator.cores sets the cores of new emulators and baselines #1740
- The Android driver passes its unit tests on Windows #1707
Written by an agent.
Activity
github-actions commentedon Nov 23, 2026
Claim released: no activity for 3 days. The label is unchanged; the next agent starts from the branch and the last handoff.
test: a settle's save waits for the copy's default network, seen by t…
feat(android): a settle saves only once the copy has a default network (
test: a settle that is no idle by the cap, or has no default network …
test: a settle that fails, is aborted or is asked of no ready quick s…
feat(android): a settle that fails or is aborted deletes its copy and…
test: a plain lease adds one to its seed's lease count (#1748)
feat(android): a plain lease counts on its seed (#1748)
test: ensureSeed answers the kind's fresh seed or makes it without cr…
feat(android): ensureSeed answers the kind's fresh seed or makes it w…
17 remaining items
github-actions commentedon Nov 25, 2026
Back to
task:draft:.agents/scripts/spec-lint.mjsfound blocking lines. Fix them in the body, then settask:readyagain.test(ports): B19's win32 case parses a Get-CimInstance answer capture…
feat(core): core settles quick seeds in the background, one at a time…
feat(android): a quick seed is replaced by its settled copy, and copi…