[eas-cli] Upload agent-device session artifacts#3939
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3939 +/- ##
==========================================
+ Coverage 59.24% 59.24% +0.01%
==========================================
Files 935 936 +1
Lines 41061 41130 +69
Branches 8650 8658 +8
==========================================
+ Hits 24323 24364 +41
- Misses 16644 16672 +28
Partials 94 94 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
aa85a35 to
e20b67d
Compare
e20b67d to
4a56388
Compare
|
⏩ The changelog entry check has been skipped since the "no changelog" label is present. |
|
Subscribed to pull request
Generated by CodeMention Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead. |
There was a problem hiding this comment.
Pull request overview
This PR adds support for uploading artifacts produced during agent-device remote sessions into EAS Device Run Session artifacts (so they’re available via the existing artifact UI/API), and wires the polling/uploader into the remote session startup flow.
Changes:
- Add agent-device daemon artifact inventory polling, download, and DeviceRunSession artifact upload logic.
- Start the daemon with
AGENT_DEVICE_RETAIN_ARTIFACTS=1and kick off background artifact polling during remote sessions. - Update EAS CLI GraphQL schema/typegen outputs (appears unrelated to the agent-device artifact work).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/eas-cli/src/graphql/generated.ts | Regenerated GraphQL TS types (includes new nullable/optional fields and new schema types). |
| packages/eas-cli/graphql.schema.json | Updated GraphQL introspection schema JSON. |
| packages/build-tools/src/steps/utils/agentDeviceArtifacts.ts | New implementation for listing/downloading/polling agent-device artifacts and uploading them to DeviceRunSession artifacts. |
| packages/build-tools/src/steps/utils/tests/agentDeviceArtifacts.test.ts | Adds unit tests for listing, unsupported endpoint behavior, uploading, and retrying after failed uploads. |
| packages/build-tools/src/steps/functions/startAgentDeviceRemoteSession.ts | Starts agent-device with artifact retention enabled and spawns background polling to upload artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ascAppIdentifier: Scalars['String']['output']; | ||
| createdAt: Scalars['DateTime']['output']; | ||
| id: Scalars['ID']['output']; | ||
| remoteAppStoreConnectApp: RemoteAppStoreConnectApp; | ||
| remoteAppStoreConnectApp?: Maybe<RemoteAppStoreConnectApp>; | ||
| updatedAt: Scalars['DateTime']['output']; |
| /** Server account feature gate values for this account, optionally filtering by desired gates. */ | ||
| accountFeatureGates: Scalars['JSONObject']['output']; | ||
| /** Coalesced project activity for all apps belonging to this account. */ | ||
| activityTimelineProjectActivities: Array<ActivityTimelineProjectActivity>; | ||
| aiChatEnabled: Scalars['Boolean']['output']; | ||
| appCount: Scalars['Int']['output']; | ||
| /** @deprecated Use appStoreConnectApiKeysPaginated */ |
| for (const artifact of artifacts) { | ||
| if (uploadedArtifactIds.has(artifact.id) || uploadingArtifactIds.has(artifact.id)) { | ||
| continue; | ||
| } | ||
| uploadingArtifactIds.add(artifact.id); | ||
| void uploadAgentDeviceArtifactAsync(ctx, { | ||
| deviceRunSessionId, | ||
| daemonUrl, | ||
| daemonToken, | ||
| artifact, | ||
| logger, | ||
| }) | ||
| .then(() => { | ||
| uploadedArtifactIds.add(artifact.id); | ||
| }) | ||
| .catch(err => { | ||
| const error = err instanceof Error ? err : new Error(String(err)); | ||
| Sentry.capture('Could not upload agent-device remote session artifact', error); | ||
| logger.warn({ err: error }, 'Could not upload agent-device remote session artifact.'); | ||
| }) | ||
| .finally(() => { | ||
| uploadingArtifactIds.delete(artifact.id); | ||
| }); | ||
| } |
| afterEach(() => { | ||
| jest.useRealTimers(); | ||
| }); |
Why
Agent-device now exposes daemon artifact inventory and download endpoints, and EAS remote sessions should upload those artifacts to DeviceRunSession artifacts the same way Argent sessions do. This lets artifacts produced during an agent-device remote session become available through the existing EAS artifact download UI/API instead of staying only on the VM.
Release constraint: the EAS VM installs
agent-device@latestunlesspackage_versionis provided. npmagent-device@latestis currently0.18.2, which predates the landed artifact endpoint changes in callstack/agent-device#1020 and callstack/agent-device#1027. This PR wires EAS CLI support, but a real run needs an agent-device release that contains those endpoints, or the step must be run with such a package version once available. If the installed daemon does not expose/artifacts, EAS logs once and disables artifact uploads for that session.How
AGENT_DEVICE_RETAIN_ARTIFACTS=1so the local remote client and the VM uploader can both download the same artifacts.http://127.0.0.1:<daemonPort>/artifactsusing the daemon token, independent of the public ngrok tunnel.https://github.com/callstack/agent-device.git.Test Plan
corepack yarn workspace @expo/build-tools jest-unit packages/build-tools/src/steps/utils/__tests__/agentDeviceArtifacts.test.ts packages/build-tools/src/steps/utils/__tests__/argentArtifacts.test.ts packages/build-tools/src/steps/utils/__tests__/deviceRunSessionArtifacts.test.tscorepack yarn oxfmt --check packages/build-tools/src/steps/functions/startAgentDeviceRemoteSession.ts packages/build-tools/src/steps/utils/agentDeviceArtifacts.ts packages/build-tools/src/steps/utils/__tests__/agentDeviceArtifacts.test.tscorepack yarn oxlint --type-aware --import-plugin --tsconfig ./tsconfig.oxlint.json packages/build-tools/src/steps/functions/startAgentDeviceRemoteSession.ts packages/build-tools/src/steps/utils/agentDeviceArtifacts.ts packages/build-tools/src/steps/utils/__tests__/agentDeviceArtifacts.test.tscorepack yarn workspace @expo/build-tools typecheckcurrently fails on existing unrelatedsrc/steps/functions/repack.ts(329,5): Object literal may only specify known properties, and useAppEntitlements does not exist in type IosSigningOptions.