Skip to content

slow-agent-device: daemon-kill test still expects the next command to fail, but #1466 restores the lease #1577

Open

Description

@V3RON

The slow-lane test e2e/slow-agent-device.test.ts > agent-device through simlock (Android) > "when the agent-device daemon is killed, a new one with a new pid runs; the agent's next command fails with lease ended by simlock, and its simlock lease is released" fails on main, at e2e/slow-agent-device.test.ts:507: expect(next.code).not.toBe(0) gets 0.

Why: #1466 (fadc7ae) changed the behaviour. When agent-device's heartbeat gets LEASE_NOT_FOUND for a lease Simlock still holds, it now allocates the lease again on the same device (src/agent-device/front/heartbeat.ts, src/agent-device/AGENTS.md). So after an agent-device daemon kill, the next snapshot succeeds (success: true) and the lease stays held. The test still claims the old behaviour. Its iOS twin makes the same claim, but it is skipped on an Android-only lane.

Reproduced: on a worktree of main 6dcbd34, with only the session-naming helper line from #1573 applied (the unfixed helper can't run the test at all; agent-device 0.21.36 refuses connect proxy without a session). Log: /var/folders/tb/j39z273s5kn7lb9tz1dhk8l00000gn/T//simlock-slow-e2e-20261115-180104.log, "expected +0 not to be +0". It failed in three runs, so it is not a flake.

Decision needed: rewrite the test's claim to match #1466 (the next command succeeds and the lease stays held), or change #1466.

Found while delivering #1569 (PR #1573).

Written by an agent.

Activity

  1. added
    bug:newReported. An agent may triage it (rule 8); the fast track may set it ready (rule 17).
    on Nov 15, 2026
  2. self-assigned this
    on Nov 15, 2026
  3. V3RON commented on Nov 15, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    The failing test is on main, unchanged since #1366: e2e/slow-agent-device.test.ts:489, "when the agent-device daemon is killed, … the agent's next command fails with lease ended by simlock, and its simlock lease is released". Slow lane only, so not rerun here; the reporter's three runs fail at :507. bug/1577-repro is origin/main, which holds it.

    scripts/slow-e2e.sh e2e/slow-agent-device.test.ts   # needs #1573's AGENT_DEVICE_SESSION helper line
    AssertionError: expected +0 not to be +0             # expect(next.code).not.toBe(0), :507
    

    The behaviour the test should claim passes at unit level:

    pnpm exec vitest run --project unit src/agent-device/edge-restart.test.ts -t "next heartbeat succeeds"
    Tests  6 passed | 16 skipped (22)
    

    Root cause

    Defect, in the test. e2e/slow-agent-device.test.ts:506-513 still asserts ADR 0023 §3, which ADR 0071 §1 superseded. #1466 (src/agent-device/front/heartbeat.ts, restoreLease) re-allocates the lease, as ADR 0071, src/agent-device/AGENTS.md and agent-device.mdx:209 say. #1464 named only unit tests, so this test was never updated.

    Simplest fix

    Rewrite the test (about 15 lines). Before the kill: install Appduct <app> and record listLeases. After it: ok(open <bundleId>) and ok(snapshot). The test then asserts the lease's id and deviceId are unchanged and one lease is listed. New title: "…a new one with a new pid runs; the agent opens the installed Appduct fixture app again and takes a snapshot, and its simlock lease stays, on the same device". The open <app> covers iOS, where mdx:209 says a command before a new open answers SESSION_NOT_FOUND.

    Alternatives rejected

    Risk

    Fast track

    Side findings

    Written by an agent.

  4. removed their assignment
    on Nov 15, 2026
  5. V3RON commented on Nov 15, 2026

    @V3RON
    ContributorAuthor

    Maintainer decision

    Option A: keep #1466 (ADR 0071 §1). Rewrite the daemon-kill test so it claims the current behaviour: after the agent-device daemon is killed, the agent opens the app again, its next command succeeds, and the lease keeps its id and device. #1466 stays as it is.

    Recorded on the maintainer's instruction.

    Written by an agent.

  6. added
    bug:readyAn agent may fix it.
    and removed
    bug:newReported. An agent may triage it (rule 8); the fast track may set it ready (rule 17).
    on Nov 15, 2026
  7. self-assigned this
    on Nov 15, 2026
  8. V3RON commented on Nov 15, 2026

    @V3RON
    ContributorAuthor

    Handoff

    Done: #1579 rewrites the daemon-kill test at e2e/slow-agent-device.test.ts:489 for Option A (ADR 0071 §1): after the kill the agent opens the app again, its snapshot succeeds, and the lease keeps its id and device. Review round 1: 0 findings in all three lenses. The PR is ready and labelled needs-hardware.

    Not done: the slow-lane run, so the Done when line is unticked. The gate has not run.

    Findings: the lane stopped in setup, before the test's assertions: agent-device replied REMOTE_SESSION_REQUIRED from connect proxy (e2e/helpers/agent-device.ts:173). This is the session-naming helper that #1573 fixes, not the daemon-kill behaviour.

    Blocked on: #1573 merging. Then run verify-hardware on #1579, and the gate.

    Written by an agent.

  9. removed their assignment
    on Nov 15, 2026
  10. added
    bug:blockedAgent stopped on a blocker in its handoff. Maintainer re-adds the label it came from.
    on Nov 15, 2026
  11. V3RON commented on Nov 15, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: none
    Parked: #1577 — #1579 needs-hardware: the slow lane cannot run the test until #1573's session helper merges
    Decided: #1577 — rewrite the test or change #1466 → rewrite the test (maintainer's choice)

    Written by an agent.

  12. V3RON commented on Nov 15, 2026

    @V3RON
    ContributorAuthor

    Reproduced on base 6dcbd34 (with only the agent-device session-name helper line applied), run alone with -t: the daemon-kill test fails with expected +0 not to be +0. So it is not caused by the #1569 stack (PR #1573); same #1466 staleness this issue describes.

    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

No one assigned

    Labels

    bug:blockedAgent stopped on a blocker in its handoff. Maintainer re-adds the label it came from.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions