Skip to content

Android adb reattach comment says a released device may stay running, kept by the warm pool #1375

Closed

Description

@V3RON

src/drivers/android/device-table.ts:156 (origin/main 42b114c) explains why emulators outlive a daemon restart with "a released device may stay running, kept by the warm pool". Since ADR 0061 §2 a released virtual device is destroyed; what the warm pool keeps running is a never-leased ready device. The reasoning still holds with "a warm device" in place of "a released device".

Found while triaging #1373.

Written by an agent.

Activity

  1. added
    bug:new
    on Nov 6, 2026
  2. self-assigned this
    on Nov 6, 2026
  3. V3RON commented on Nov 6, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Confirmed, and the issue's proposed wording is wrong too. This is a comment-only defect, so no test can fail and no bug/1375-repro branch was pushed (precedent: #1095, #666). Passing tests already prove the three facts that make the comment false. Adding another would break testing rule 7.

    src/leasing/create-leasing.test.ts:416  "a release destroys the released device instead of reclaiming it, ..."   1 passed
    e2e/daemon-lifecycle.test.ts:263        "daemon stop shuts down every idle device it booted and leaves the leased one running"   1 passed (pnpm test:e2e)
    src/drivers/android/index.test.ts:1666  "when the daemon disposes of the adb server it adopted and $attached, ..."   2 passed
    

    Root cause

    Defect, in a comment: src/drivers/android/device-table.ts:154-157 (written in 298af1c, #1285). A released device is destroyed (ADR 0061 §2), so "a released device may stay running" is false. "A warm device", as the issue proposes, is also false: at stop, core.shutdownIdle() (src/core/create-core.ts:435, called from src/daemon/worker-composition.ts:533) shuts down every ready unleased device. Only leased devices keep running across a stop (daemon.stop releases nothing). The same sentence says "A clean daemon stop reaps that server", but AndroidDriver#dispose (src/drivers/android/index.ts:528) keeps the server while adb devices lists an emulator.

    Simplest fix

    Reword the paragraph. The code stays as it is:

       * An emulator announces itself exactly once, at its own startup, to the server that
       * existed then. A `daemon stop` keeps that server only while `adb devices` lists an
       * emulator (`AndroidDriver#dispose`); one that is reaped or dies is replaced by a server
       * that, with `ADB_EMU=0`, has no scanner to rediscover anything -- so every emulator that
       * survived the restart (which is by design: a leased device keeps running across a stop)
       * would be invisible forever.

    Tried with this wording, then discarded: pnpm exec vitest run --project unit src/drivers/android gave 708 passed, 1 skipped. The comment lint was not run (agents may not run it). The commit hook runs it.

    Alternatives rejected

    • "a warm device" (the issue's wording): the warm pool's devices are shut down at stop.
    • Deleting the parenthesis: the reader loses why an emulator outlives the daemon at all.

    Risk

    • Only a comment changes. The commit hook's comment lint must accept the new block.

    Fast track

    • Defect: yes
    • Fix tried: no — comment-only, no failing reproduction to make pass
    • Nothing public added or broken: yes
    • No ADR or rule changed: yes
    • One fix: yes

    Written by an agent.

  4. removed their assignment
    on Nov 6, 2026
  5. added
    bug:ready
    and removed
    bug:new
    on Nov 6, 2026
  6. self-assigned this
    on Nov 6, 2026
  7. V3RON commented on Nov 6, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1380 (#1375)
    Parked: none
    Waiting: none
    Decided: #1375 — fast track held a comment-only bug → maintainer asked to set bug:ready by hand

    Written by an agent.

  8. added a commit that references this issue on Nov 10, 2026
    adec8af
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions