Skip to content

test --maestro attempts can't use the device the outer session opened (DEVICE_IN_USE) #5129

Backlog

Description

@V3RON

Summary

agent-device test <flow> --maestro fails with DEVICE_IN_USE when the same session has already run open on the device. Each test attempt runs in its own child session (<session>:test:<id>:<n>-<flow>:attempt-<k>). That child session can't claim the device the outer session holds, so the flow's launchApp is refused.

Versions

  • agent-device 0.21.41 (client and daemon), iOS simulator

Steps

agent-device open --platform ios
agent-device install <app id> ./App.app
agent-device test ./flows/first-launch.yaml --maestro --platform ios

first-launch.yaml launches the app and calls one runFlow subflow.

Result

total 1, passed 0, failed 1
REPLAY_DIVERGENCE: Replay failed at step 1 (launchApp): Device is already in use by session "<session>". (first-launch.yaml:line 3)
cause: DEVICE_IN_USE

The refused session is <session>:test:<id>:1-first-launch:attempt-1.

Running test without open first doesn't work either, when the daemon is reached through a proxy: the client says No active proxy device lease for this session; run open first.

Expected

Test attempts run on the device the outer session already holds, or lease it from that session.

Where

  • packages/replay-test/src/internal/session-test-attempt.ts: each attempt gets its own session.
  • packages/daemon/src/resources/device/device-claim-admission.ts: a device is claimed per session, and child sessions get no exception.

Follow-up to #4561 (fixed the ENOENT part in #4623). This part stayed open.

Written by an agent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions