Skip to content

[eas-cli] Upload agent-device session artifacts#3939

Open
szdziedzic wants to merge 3 commits into
mainfrom
szdziedzic-codex/agent-device-retain-artifacts-env
Open

[eas-cli] Upload agent-device session artifacts#3939
szdziedzic wants to merge 3 commits into
mainfrom
szdziedzic-codex/agent-device-retain-artifacts-env

Conversation

@szdziedzic

@szdziedzic szdziedzic commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

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@latest unless package_version is provided. npm agent-device@latest is currently 0.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

  • Start agent-device daemon with AGENT_DEVICE_RETAIN_ARTIFACTS=1 so the local remote client and the VM uploader can both download the same artifacts.
  • After the remote config is reported and the DeviceRunSession is in progress, poll the local daemon over http://127.0.0.1:<daemonPort>/artifacts using the daemon token, independent of the public ngrok tunnel.
  • Download each new artifact by ID and upload it through the existing DeviceRunSession artifact upload helper.
  • Track uploading and uploaded artifact IDs separately, so in-flight uploads are not duplicated and failed uploads can retry on the next poll.
  • Update the git fallback clone URL to https://github.com/callstack/agent-device.git.
  • Add focused tests for listing, unsupported inventory, uploading, and upload retry behavior.

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.ts
  • corepack 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.ts
  • corepack 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.ts
  • corepack yarn workspace @expo/build-tools typecheck currently fails on existing unrelated src/steps/functions/repack.ts(329,5): Object literal may only specify known properties, and useAppEntitlements does not exist in type IosSigningOptions.

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.24%. Comparing base (72ca5c2) to head (ca058c2).

Files with missing lines Patch % Lines
...uild-tools/src/steps/utils/agentDeviceArtifacts.ts 59.10% 27 Missing ⚠️
...c/steps/functions/startAgentDeviceRemoteSession.ts 75.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@szdziedzic szdziedzic force-pushed the szdziedzic-codex/agent-device-retain-artifacts-env branch 2 times, most recently from aa85a35 to e20b67d Compare July 2, 2026 19:05
@szdziedzic szdziedzic force-pushed the szdziedzic-codex/agent-device-retain-artifacts-env branch from e20b67d to 4a56388 Compare July 2, 2026 19:07
@szdziedzic szdziedzic added the no changelog PR that doesn't require a changelog entry label Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

⏩ The changelog entry check has been skipped since the "no changelog" label is present.

@szdziedzic szdziedzic marked this pull request as ready for review July 2, 2026 19:12
@szdziedzic szdziedzic requested review from Copilot and sjchmiela July 2, 2026 19:12
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
**/* @douglowder

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=1 and 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.

Comment on lines 3199 to 3203
ascAppIdentifier: Scalars['String']['output'];
createdAt: Scalars['DateTime']['output'];
id: Scalars['ID']['output'];
remoteAppStoreConnectApp: RemoteAppStoreConnectApp;
remoteAppStoreConnectApp?: Maybe<RemoteAppStoreConnectApp>;
updatedAt: Scalars['DateTime']['output'];
Comment on lines 84 to 90
/** 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 */
Comment on lines +62 to +85
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);
});
}
Comment on lines +149 to +151
afterEach(() => {
jest.useRealTimers();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog PR that doesn't require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants