Android backends: Redroid devices in Docker or Colima
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- android, docker, typescript
- Lĩnh vực
- infrastructure, mobile
Hướng nghiên cứu
Start with the listed Android backend and driver discovery modules, then read ADR 0102 §6 and src/drivers/android/AGENTS.md for the ownership, retry and adb rules. Use ScriptedProcessRunner and the named lifecycle and driver discovery tests to cover the specified cases; run pnpm test:changed and pnpm typecheck. Done when the slow lane e2e/slow-android-redroid.test.ts passes with Colima and the run leaves no labelled containers.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Part of #2041.
Scope
An operator adds redroid to android.virtualDevices, points simlock at a Docker engine (android.redroid.context for Colima, or host), and an agent leases a Redroid device with --requires redroid and an installed image: simlock creates a labelled privileged container on a fixed loopback port, waits for the boot, and the agent gets 127.0.0.1:<port> with adb, the console's screen stream, input and reverse tunnels. The device keeps its serial across recovery and daemon restarts; the backend retries an engine that is not up yet, goes back to retrying when the engine stops, and its orphans are listed by doctor.
If it goes wrong, a Redroid lease hangs or times out, a container is left running after its lease, or the agent's serial stops answering mid-lease.
Technical spec
Commit b037ae2a0.
Rows
- Behaviours: B32, B12, B36, B33, B13, B14, B15, B16, B31, B17, B18, B19, B29, B39
- Stored state: S3, S4
- Interfaces: I7, I8, I9, I10, I15
- Existing code: X6, X7, X8, X10, X11, X19, X21, X33, X38, X39, X40, X41, X42, X43, X44, X52
Facts
| # | Fact | Source |
|---|---|---|
| F1 | The slow lane runs a named test file with scripts/slow-e2e.sh <test files>; e2e/slow-android-smoke.test.ts is the Android model |
docs/internal/agent-rules/toolchain.md:224; ls e2e/slow-android-smoke.test.ts |
| F2 | The pinned images 31, 33, 34 and 35 boot on Colima and answer pm path android; a restart boots again when the readiness loop reconnects adb |
/private/tmp/claude-501/redroid-design/facts12.log (2026-12-02); cited by the parent's I9 and B15 |
| F3 | An installed image reads docker image inspect redroid/redroid:<tag> --format '{{.Id}} {{.Size}}' → sha256:0a61… 674553971; an absent one exits 1 Error response from daemon: No such image: …; findComponent/listComponents (src/core/driver.ts:303,316) map to it (I7) |
/private/tmp/claude-501/redroid-design/facts13.log (2026-12-02) |
Modules touched
New src/drivers/android/redroid/ (definition.ts, the backend, Docker CLI calls, port allocator, device data table), src/drivers/android/backends.ts (one line), src/driver-registry/index.ts (one line), src/drivers/android/index.ts (adb server kept at dispose, B29), src/drivers/android/profiles/index.ts, src/drivers/android/device-tcp.ts and src/core/device-tcp.ts and its caller src/tunnel/sessions.ts:429-432, which passes the backend (emulatorPort refused, B17), src/core/driver.ts (saveRefusal, I10), src/core/fake-driver.ts (B19's seam), src/core/baselines.ts (save refusal), src/daemon/driver-discovery.ts (onBackendStarted bridge), new src/daemon/backend-start-sink.ts, src/daemon/worker-composition.ts, new e2e/slow-android-redroid.test.ts. Searches: rg "saveSource|ScreenTarget|emulatorAttached|onSlimmed" src.
Rules in play
- ADR 0102 §6 and the port, retry and engine-stop rules: Accepted — not yet implemented; the parent's rows hold the shapes.
- ADR 0001 (as applied by the parent): ownership is the container's labels, never its name; only
doctor --purge-orphansdestroys what the registry does not hold. - ADR 0061 §4: Redroid refuses
baseline savebefore the lease ends (I10). - ADR 0022 §5 and
src/drivers/android/AGENTS.md: Redroid serials live on simlock's adb server, never 5037; the server is kept while a Redroid serial is connected. src/ports/AGENTS.md: everydockerandadbcall throughProcessRunnerwith itstimeoutMs(I7, I8).docs/internal/VENDORED-CODE.mdand ADR 0102 §6: simlock pullsredroid/redroidat run time and ships no image.
Tests
Seam: each row's Seam cell in #2041, the Redroid backend over ScriptedProcessRunner (src/ports/scripted-process-runner.ts:51) answering the captured replies of I7 and I8; model on src/drivers/android/index-lifecycle.test.ts and src/daemon/driver-discovery.test.ts.
- B32: With the real backend registry the config loader accepts
["avd", "redroid"],["redroid", "avd"]and["redroid"], and refuses an unknown id namingavd, redroid.: the Examples rows namingredroid;["docker"]→expected a backend this worker knows (avd, redroid), not "docker" - B12: The operator lists
redroid; the platform driver starts the Redroid backend when the engine answers as Linux. Otherwise it skips it withdriver.backend-rejectednaming why, checks again every 30 s, and starts it withdriver.backend-startedwhen the engine answers.: engine Linux arm64 → starts;dockernot 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 bothandroid.redroid.contextandhost→ refused with the I9 message (config loader) - 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 psinlistManaged(health monitor,src/leasing/lease-health-monitor.ts:187) emitsdriver.backend-rejectedengine-unreachable;redroidleavesvirtualTags; its devices are unreadable (I14), leases run to their TTL; when the engine answers,driver.backend-started, and a stopped container boots again at its port (B15).:docker infofails → one event, tag gone,--requires redroid→CAPABILITY_MISSING, held lease kept; that lease ends while the engine is down → device staysreclaiming, not quarantined, keeps its slot, reclaimed ondriver.backend-started(B38, B39); answering after one tick → started, devices listed; containerexitedon return → recovered at the same port;docker psfails between ticks → down at once; two failed ticks → one event - B33: Redroid's
resolveSpecwith 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).:imageTag: "google_apis"→BAD_REQUESTandroid lease requests do not take an image tag on redroid;defaultTag: true→RuntimeMissingErrorwith nocomponentanddownloadable: false; no tag,redroid-34installed → spec34 - 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>.: 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 failureNo free Redroid port in 5700-5799;adb connectprintsfailed to connect(exit 0) then succeeds;device offlinewhile booting; the readiness loop re-issuesadb connect 127.0.0.1:<port>before everygetproppoll (facts12.log; facts4.log's lastingdevice offlinecame from not reconnecting);sys.boot_completednever 1 withinandroid.bootTimeoutMs→ boot failure, container removed; container exits during boot (docker inspectstateexited) → 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 - 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.: stop then remove; remove of a container already gone (
docker rm -fexits 0, prints nothing) → done;docker stopof a missing container → treated gone; second lease:/data/local/tmp/mwritten by the first is absent - B15: A Redroid device booted again (health recovery, or after the engine or the daemon restarted) answers at the serial it was granted.: 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) thendocker start→ the reconnecting readiness loop of B13 seessys.boot_completed1, with or without anadb disconnectfirst (facts12.log, 6 s and 7 s) - 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-orphansremoves it.: 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 - B31: The health monitor sees a Redroid device as running only when its container runs and its serial is a
deviceon simlock's server; a running container whose serial dropped off is connected again in the listing.: container running, serialdevice→running; serial absent,connectsucceeds →running;connectfails →stopped(the monitor recovers it afterhealth.stableObservations); serialoffline→transitioning - 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; theemulatorPorttunnel is refused.:adb shellruns;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_UNSUPPORTEDemulator adb: the lease is on a Redroid device; emulator ports need an Android emulator;reversetunnel works (slow lane) - B18:
catalog.geton a worker with Redroid lists the phone and tablet library profiles and the API levels whose images are installed (I9).: imageredroid-34installed → runtime34; none installed → no runtimes; TV, Wear, automotive and desktop profiles absent - B19:
baseline saveon a Redroid lease is refused before the lease ends (I10); the lease goes on.: Redroid lease →BAD_REQUEST, lease still held; emulator lease → saved as today - 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.: Redroid serial connected → server left; emulator attached → left as today; neither → stopped as today;
adb devicesunreadable → stopped as today - B39: A backend that starts calls the driver callback
onBackendStarted(platform, backend);src/daemon/driver-discovery.tsbridges it, likeonSlimmed(:209), todriver.backend-startedand aBackendStartSinkbound tocore.resumeBackend(I17) aftercore.connect(earlier calls queue, run once after converge). WhatresumeBackenddoes is #2049's (B38).: 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)
Done when
pnpm test:changedandpnpm typecheckpass; each Tests line above is a case table in one test, its fake replies taken from the parent's captured runs.- Slow lane, on a Mac with Colima and binder loaded:
scripts/slow-e2e.sh e2e/slow-android-redroid.test.tspasses. Its setup pulls each image of the table withdocker pull redroid/redroid:<tag>(component installarrives in #2052), boots each, leases with--requires redroid, drives adb, the screen stream, input and a reverse tunnel, restarts the daemon mid-lease and finds the same serial, and ends the lease with no container left. A tag that fails to boot is dropped from the table in this PR. - The same run leases an
avdemulator beside a Redroid device on one worker. docker ps -a --filter label=simlock.instance=<id>lists nothing after the slow-lane run.- The website pages updated in this PR (documentation rule 9):
website/src/content/docs/docs/reference/configuration.mdx(android.redroid.*),.../reference/events.mdx(reasons),.../using-devices/run-commands.mdxand.../using-devices/tunnels.mdx(a127.0.0.1:<port>serial; noemulatorPorttunnel on Redroid).
Out of scope
Redroid components (component install/list/remove), the doctor checks and the setup guide (#2052); baselines and warm-pool devices on Redroid; Windows hosts.
Depends on
- #2050
- #2049
Written by an agent.
- Ngôn ngữ chính
- TypeScript
- Star
- 730
- Fork
- 44
- Merge trung bình
- 15 giờ 28 phút
- Pull request đã merge (30 ngày)
- 387
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của callstackincubator/simlock
-
bug:new
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
callstackincubator/simlock#2088 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug:new
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
callstackincubator/simlock#2080 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
task:ready
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
callstackincubator/simlock#2079 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
platform:ios task:ready
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 18/100
callstackincubator/simlock#2078 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
iOS copy: keep the app database at the copy's own UDIDCó thể đã có người làm @V3RON đã nhận hôm nay. Đang mởplatform:ios task:ready
callstackincubator/simlock#2077 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của callstackincubator/simlock
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
melgarafael/DeskcommCRM#5614 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
slackapi/slack-health-score#253 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature needs triage site
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
owid/owid-grapher#8019 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
simstudioai/sim#10710 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
via-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày