Skip to content

test --maestro on a remote daemon copies the flow from the client's path (ENOENT) #4561

Closed

Description

@V3RON

Summary

agent-device test <flow> --maestro fails with ENOENT when the daemon runs on another machine (a remote daemon or a connect proxy connection). Before each attempt, the daemon copies the flow from the client's local path on its own disk. replay --maestro on the same connection works, because it uses the flow sources the client sends.

Versions

Steps

  1. Capture the RPC that agent-device test ./flows/first-launch.yaml --maestro --platform ios sends. It already carries the flow and its runFlow subflow in flags.replayScriptSources.
  2. Send that request to a 0.21.36 daemon after moving the caller's paths to a folder the daemon host does not have (as if the client were another machine).

Result

status 500
ENOENT: no such file or directory, copyfile '/Users/someone-else/app/flows/first-launch.yaml' -> '<artifacts>/first-launch.yaml/attempt-1/replay.ad'

The request fails before it reaches a device.

Cause

packages/replay-test/src/internal/session-test-attempt.ts:145 calls prepareReplayTestAttemptArtifacts(entry.path, …). That leads to copyReplaySourceFile in packages/replay-test/src/internal/session-test-artifacts.ts:130, which runs fs.copyFileSync(filePath, …) on the caller's path. It never reads the shipped replayScriptSources.

Expected

test --maestro on a remote connection reads the flow and subflows from replayScriptSources, the way replay --maestro does, both for the attempt artifacts and for the run.

Related: attempts can't use the outer session's leased device

Once the flow exists on the daemon host (copied there by hand), the next blocker shows up. Each attempt runs in its own session, <session>:test:…:attempt-<k> (session-test-discovery.ts:163). On a leased connection, that session's launchApp tries to open the device the outer open session already holds, and fails because the device is busy. Without an open first, nothing is leased. So test can't run on a leased remote device at the moment. A fix would need the attempt sessions to run on the outer session's lease. If you want this tracked separately, say so and I'll split it out.

Written by an agent.

Activity

  1. added
    bug
    on Nov 16, 2026
  2. thymikee commented on Nov 16, 2026

    @thymikee
    Member

    Triage: bug; the source-path failure is confirmed on current main. Attempt preparation copies entry.path directly before replay runs, so the supplied source bundle cannot prevent this ENOENT. Source materialization and leased-attempt ownership are separate problems: fixing the first does not establish that an attempt may reuse the outer lease. The active replay/plugin extraction also changes these owners, so its integration needs to account for this report before a separate implementation starts.

  3. mvanhorn commented on Nov 17, 2026

    @mvanhorn
    Contributor

    Each attempt called prepareReplayTestAttemptArtifacts with only entry.path, and copyReplaySourceFile always used copyFileSync on that path.

    inspectReplayTestSource now returns the script it read as sourceText, and discoverReplayTestEntries copies that field onto a run entry when the source has it. runSingleReplayTestAttempt passes entry.sourceText into prepareReplayTestAttemptArtifacts.

    #4623

  4. thymikee commented on Nov 21, 2026

    @thymikee
    Member

    Fixed by #4623, first released in v0.21.40: a remote test --maestro attempt now writes its artifacts from the shipped script source instead of copying the flow from the client's path. Reopen with the version and command output if it still fails on 0.21.40 or later.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions