[build-tools][worker][eas-cli] Collect and upload agent-device session artifacts#3853
Draft
szdziedzic wants to merge 2 commits into
Draft
[build-tools][worker][eas-cli] Collect and upload agent-device session artifacts#3853szdziedzic wants to merge 2 commits into
szdziedzic wants to merge 2 commits into
Conversation
…n artifacts
Device run sessions now persist the screenshots and screen recordings that
agent-device produces in remote mode:
- build-tools: the start_agent_device_remote_session step hardlink-collects
agent-device media files from /tmp into an artifacts dir while the session
runs (immune to the daemon's delete-after-download cleanup), and replaces
its block-forever tail with a poll loop on the session status. When the
session is stopped (or the job approaches its max runtime, via the
__MAX_RUN_TIME_SECONDS env injected by the API server), it finalizes
in-flight recordings through the daemon's local record-stop RPC, uploads
each collected file as a job artifact, and ends the job as a normal
success - no cancellation involved.
- worker: createUploadSessionAsync learns a third upload-session endpoint for
device run sessions (device-run-sessions/{id}/upload-sessions), used when
only DEVICE_RUN_SESSION_ID is present in the job env.
- eas-cli: new 'eas simulator:artifacts' command downloads session artifacts;
simulator:start/stop print an artifact summary and download hint after the
session stops.
Requires the www upload-sessions endpoint and pairs with the www change that
stops cancelling in-progress agent-device jobs on session stop (this worker
change must be deployed before that www change ships).
|
❌ It looks like a changelog entry is missing for this PR. Add it manually to CHANGELOG.md. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Part 2 of persisting the screenshots and screen recordings agent-device produces during
AGENT_DEVICEdevice run sessions, so users can view them after the session ends. Today nothing survives: agent-device deletes media from the VM right after the remote client downloads it, and stopping a session cancels the job, destroying the VM within seconds.Depends on the www upload endpoint (expo/universe#28121). The www behavior flip that stops cancelling in-progress agent-device jobs (expo/universe#28122) must only ship after this worker change is deployed to builder VMs.
How
No agent-device changes — collection relies only on its existing observable behavior:
build-tools): agent-device's remote client rewrites media output paths to predictable temp paths (/tmp/agent-device-{screenshot,recording}-*). The step watches /tmp and hardlinks each match into its own artifacts dir — a hardlink shares the inode, so it survives agent-device's delete-after-download cleanup and converges to the final bytes even when linked mid-write. Entirely best-effort; can never fail a session.build-tools):start_agent_device_remote_sessionreplaces its block-forever tail with a 5s poll of the session status (robot token, same GraphQL client as the remote-config upload). When the session goes final — or a self-deadline ahead of__MAX_RUN_TIME_SECONDSpasses, covering the timeout case — it finalizes in-flight recordings through the daemon's own localrecord stopRPC, uploads each collected file (agent-device/<basename>, individual files so the website can render them inline), and returns normally so the job ends as a regular success. No orchestrator involvement.worker):createUploadSessionAsynclearns a third endpoint,device-run-sessions/{id}/upload-sessions/, used when onlyDEVICE_RUN_SESSION_IDis present in the job env.eas-cli): neweas simulator:artifacts [--id] [--output-dir] [--json]download command;simulator:start/simulator:stopprint an artifact summary and download hint after the session stops (skippable, suppressed in non-interactive mode).Test Plan
fmt:checkclean; full unit suites pass locally: build-tools (628), worker (52), eas-cli (1725).isDeviceRunSessionFinalAsync(final/non-final statuses, query errors keep polling), upload-session endpoint selection for DRS jobs, and simulator command fixtures.eas simulator:artifacts) pending the www endpoint deploy; will attach a terminal recording before marking ready.🤖 Generated with Claude Code