Skip to content

slow-agent-device: the simlock-kill test claims the lease ends, but ADR 0071 §4 says a standalone worker restart keeps it #1578

Closed

Description

@V3RON

e2e/slow-agent-device.test.ts:517 ("after the simlock daemon is killed and started again, … the agent's next command fails with lease ended by simlock, and its old simlock lease is released") still claims ADR 0023 §3. ADR 0071 §4 and #1468 say a standalone worker's restart rebuilds the lease (adoptable, src/agent-device/front/host-link.ts:99) and the next heartbeat succeeds on the same device; agent-device.mdx:209 says the same. A SIGKILLed holder keeps its lease (src/leasing/AGENTS.md, Known gaps), so the adopt should apply.

Not run: it needs the slow lane. #1577's report says only the agent-device-kill test failed in three runs. If this one passes, the code contradicts the ADR; if it fails, its claim is stale like #1577's.

Found while triaging #1577.

Written by an agent.

Activity

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

    @V3RON
    ContributorAuthor

    Reproduction

    It fails: the test is stale, and the code follows ADR 0071 §4. The test is e2e/slow-agent-device.test.ts:517, unchanged on main. bug/1578-repro points at origin/main. I did not run the slow lane. I read a slow-lane run that was already going on this host (#1569's worktree at 2c6d716, with #1573's helper, Android). The old-pid wait passes and :535 fails:

    # /var/folders/tb/j39z273s5kn7lb9tz1dhk8l00000gn/T/simlock-slow-e2e-20261115-180422.log
    SLOW END failed 48s … (Android) > after the simlock daemon is killed and started again, …
    SLOW ERROR expected +0 not to be +0 // Object.is equality      # expect(next.code).not.toBe(0)
    # passed 2026-11-03, before #1466: simlock-slow-e2e-20261103-223944.log
    

    The right behaviour already passes at unit level:

    pnpm exec vitest run --project unit src/agent-device/edge-restart.test.ts -t "after a standalone worker restarts, the agent's next heartbeat succeeds"
    Tests  2 passed | 20 skipped (22)
    

    Root cause

    Defect, in the test. e2e/slow-agent-device.test.ts:534-541 still asserts ADR 0023 §3, which ADR 0071 replaced. The emulator outlives the SIGKILL, and the reconciler keeps a lease whose device is running (ADR 0019). The restarted front rebuilds the entry (adoptable, src/agent-device/front/host-link.ts:99), and the next heartbeat re-allocates the lease (agent-device.mdx:209). #1466 did not update this case, the twin of #1577.

    Simplest fix

    Use #1577's shape. Before the kill: install Appduct <app> and record listLeases. After the old pid is gone: ok(open <bundleId>) and ok(snapshot). Assert one lease, with the same id and deviceId. New title: "…pid is gone within 60 s; the agent opens the installed Appduct fixture app again and takes a snapshot, and its simlock lease stays, on the same device". The open also covers iOS (SESSION_NOT_FOUND comes before a new open).

    Alternatives rejected

    • Flip not.toBe(0) to ok(next) only: fails on iOS.
    • Delete the case: it is the only real-device check of ADR 0071 §4.

    Risk

    Fast track

    • Defect: yes
    • Fix tried: no — the test runs only on the slow lane
    • 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 15, 2026
  5. added
    bug:ready
    and removed
    bug:new
    on Nov 19, 2026
  6. self-assigned this
    on Nov 19, 2026
  7. V3RON commented on Nov 19, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1782 (#1578)
    Parked: none
    Waiting: none
    Decided: none

    Written by an agent.

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