Skip to content

agent-device test --maestro does not run through the agent-device proxy #1458

Todo

Description

@mrzmyr

Summary

agent-device test --maestro <flow> does not run through simlock's agent-device proxy from a remote client. open, install, snapshot, screenshot, and replay --maestro work through the same proxy.

Versions

  • simlock 0.6.0: gateway, plus one worker with capabilities.agent-device.enabled
  • agent-device 0.21.36 on the client and on the worker
  • Client and worker are two different Macs

Steps

export AGENT_DEVICE_DAEMON_AUTH_TOKEN=<agent token> AGENT_DEVICE_SESSION=e2e
agent-device connect proxy --daemon-base-url "$SIMLOCK_URL/v1/agent-device"
agent-device open --platform ios
agent-device install <app id> ./App.app
agent-device test ./flows/first-launch.yaml --maestro --platform ios

Result

  1. The worker reads the flow from the client's local path and fails with ENOENT. replay --maestro in the same session uploads the flow and its runFlow subflows.
  2. With the flow copied to the same path on the worker, the child session of test fails because the device is busy: the open session holds it.
  3. Without an open session, test fails with "run open first".

Expected

test --maestro uploads the flow files like replay does and runs them on the session's leased device, or leases one itself.

Impact

We run Maestro flows on simulators with test (reporters, retries, JUnit). On leased phones we can only use replay per flow, so phone e2e runs are off for now.

Activity

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

    @V3RON
    Contributor

    Reproduction

    This is a gap, too large for one fix: I recommend a spec session. There is no bug/1458-repro branch. Result 1 reproduces against agent-device 0.21.36 alone, with no simlock in the path, so a simlock test cannot prove it.

    I captured the RPC that agent-device test ./flows/first-launch.yaml --maestro --platform ios sends. It ships the flow and its runFlow subflow in flags.replayScriptSources. I sent it to a real 0.21.36 daemon (dist/src/internal/daemon.js, simlock's daemon environment) with the caller's paths moved to a folder this Mac lacks:

    entry sent: /Users/someone-else/app/flows/first-launch.yaml exists here: false
    files shipped: 2
    status 500
    "message":"ENOENT: no such file or directory, copyfile '/Users/someone-else/app/flows/first-launch.yaml' -> '<artifacts>/first-launch.yaml/attempt-1/replay.ad'"
    

    Root cause

    A gap in simlock, plus one upstream defect. (1) Before each attempt, agent-device's packages/replay-test/src/internal/session-test-attempt.ts:145 copies the source from the caller's path on the daemon's disk (session-test-artifacts.ts:132, fs.copyFileSync). It does not read the bundle the client shipped. This is still on agent-device main. (2) Each attempt runs in its own session, <session>:test:…:attempt-<k> (session-test-discovery.ts:163). Its launchApp opens the device that the outer open session holds. e2e/slow-agent-device.test.ts:816 already notes this. (3) The front leases a device only on lease.allocate (src/agent-device/front/front.ts:139), so a test that names no lease is forwarded with nothing leased. Simlock's refused: no device leased; run open first comes only with a shard flag (request-rules.ts:277). Which line printed the reporter's message needs their exact command.

    Simplest fix

    None in one PR. (1) belongs in agent-device: copy from replayScriptSources. (2) and (3) need a design: either attempts reuse the outer session's lease (an agent-device change), or the front leases a device for a test that names none.

    Alternatives rejected

    • Copying flows to the worker by hand: fixes (1) only.
    • Refusing test --maestro in the front: names the gap but closes nothing.

    Risk

    • Filing (1) upstream is the maintainer's call; I filed nothing outside this repo.

    Fast track

    • Defect: no — a gap; result 1 is agent-device's
    • Fix tried: no — needs a spec
    • Nothing public added or broken: no — not checked; any fix changes what test does
    • No ADR or rule changed: no — not checked
    • One fix: no — part belongs in agent-device

    Written by an agent.

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

    @V3RON
    Contributor

    Filed upstream: callstack/agent-device#4561. It covers the ENOENT (result 1) and notes that attempt sessions can't use the outer session's lease (result 2).

    Written by an agent.

  6. V3RON commented on Nov 15, 2026

    @V3RON
    Contributor

    Waiting on upstream

    Upstream: callstack/agent-device#4561 (agent-device)

    • Result 1 (ENOENT) comes from agent-device: before each attempt, its daemon copies the flow from the client's path on its own disk instead of using the replayScriptSources the client sends. Simlock can't fix this.
    • Result 2 (device busy) also comes from agent-device: each test attempt runs in its own session, which can't use the outer session's lease. #4561 asks for attempts to run on the outer lease.
    • Result 3 ("run open first") is simlock's call, and it can wait until #4561 lands. The front leases only on lease.allocate. The conservative option is to keep "run open first" and document it. The other option is for the front to lease a device for a test that names none.

    Until then, run Maestro flows on leased devices with replay --maestro, one flow at a time.

    When #4561 ships in a release: bump @agent-device/proxy to that version, add a slow-lane test for test --maestro through the proxy (replacing the note at e2e/slow-agent-device.test.ts:816), and move this issue back to bug:new for triage of result 3.

    Written by an agent.

  7. added
    bug:blocked
    upstream
    on Nov 15, 2026
  8. removed
    bug:new
    on Nov 15, 2026
  9. V3RON commented on Nov 23, 2026

    @V3RON
    Contributor

    Upstream check

    Next: bump agent-device to 0.21.41, then move this issue back to the label it came from.

    Written by an agent.

  10. added
    bug:new
    and removed
    upstream
    bug:blocked
    on Nov 23, 2026
  11. V3RON commented on Nov 26, 2026

    @V3RON
    Contributor

    Unblocked

    The pins on main are now at 0.21.41 (@agent-device/proxy in package.json, agent-device in packages/e2e/package.json), through #1808 (merged a6e3709). That release includes the fix for callstack/agent-device#4561. Moved back to bug:new so result 3 gets triaged and a slow-lane test --maestro check can replace the note in e2e/slow-agent-device.test.ts.

    Written by an agent.

  12. self-assigned this
    on Nov 26, 2026
  13. V3RON commented on Nov 26, 2026

    @V3RON
    Contributor

    Handoff

    Done: pushed bug/1458-repro, one slow-lane test in e2e/slow-agent-device.test.ts: "an agent that opened a device and installed the Appduct fixture app runs test --maestro on it…". Not run.

    Not done: the triage report; any slow-lane run.

    Findings: on agent-device 0.21.41 all three results are agent-device's. Simlock's front forwards test unchanged.

    • Result 1 is fixed: attempts write the shipped sourceText (#4623).
    • Result 2 remains: each attempt runs in its own session (session-test-attempt.ts:137), and each session is a separate device owner (device-claim-admission.ts:41). #4623 left this alone and #4561 is closed, so no upstream issue tracks it now.
    • Result 3 is agent-device's client guard, not simlock's front. Nothing reaches simlock:
    $ agent-device connect proxy --daemon-base-url http://127.0.0.1:9/v1/agent-device
    $ agent-device test ./flows/first-launch.yaml --maestro --platform ios
    Error (INVALID_ARGS): No active proxy device lease for this session; run open first.
    

    Blocked on: a slow-lane run of that test: scripts/slow-e2e.sh e2e/slow-agent-device.test.ts -t "test <flow> --maestro". If it fails on a device claim, result 2 needs a new upstream issue.

    Written by an agent.

  14. added
    bug:blocked
    and removed
    bug:new
    on Nov 26, 2026
  15. removed their assignment
    on Nov 26, 2026
  16. V3RON commented on Nov 26, 2026

    @V3RON
    Contributor

    Waiting on upstream

    Upstream: callstack/agent-device#5129 (agent-device)

    • Result 2 (device busy) is confirmed on 0.21.41 on real devices. The repro test on bug/1458-repro (c3c300a) fails with DEVICE_IN_USE: the test attempt session can't use the device the agent's open session holds.
    • Result 1 (ENOENT) is fixed upstream in 0.21.41.
    • Result 3 ("run open first") comes from the agent-device client, not simlock.

    Until then, run Maestro flows on leased devices with replay --maestro, one flow at a time.

    When #5129 ships in a release: bump the agent-device pins, run the repro test on bug/1458-repro, and move this issue back to bug:new.

    Written by an agent.

  17. added
    upstream
    on Nov 26, 2026
  18. V3RON commented on Nov 26, 2026

    @V3RON
    Contributor

    Delivery run

    Merged: none
    Parked: #1458 — result 2 (DEVICE_IN_USE) is agent-device's; confirmed on the slow lane, filed callstack/agent-device#5129
    Waiting: #1458 — on callstack/agent-device#5129

    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:blockedupstream

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions