Skip to content

Run Expo serve-sim under EAS supervision - #4114

Merged
szdziedzic merged 4 commits into
mainfrom
szdziedzic-codex/expo-serve-sim
Jul 30, 2026
Merged

Run Expo serve-sim under EAS supervision#4114
szdziedzic merged 4 commits into
mainfrom
szdziedzic-codex/expo-serve-sim

Conversation

@szdziedzic

@szdziedzic szdziedzic commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Why

EAS Simulator currently launches the production-only serve-sim-szdziedzic fork and depends on its private tunnel flags and Tunnel: stdout format. The official @expo/serve-sim package is now published, but it is not a safe drop-in until EAS owns the production concerns that do not belong in the OSS server.

Coordinated serve-sim change: expo/serve-sim#36

That PR must merge and be published to npm's latest dist-tag before this change is rolled out, because the currently published package must contain the readiness/encoder startup contract.

How

  • always install @expo/serve-sim@latest instead of using the personal fork or a hard-coded package version
  • translate the VM-safe production streaming policy to the official CLI flags: explicit WebRTC/VP8, 1280px, 60 fps, 3 Mbps, and MJPEG fallback quality 0.55
  • allocate a loopback port, launch serve-sim, and poll its stable /readyz endpoint instead of scraping stdout
  • keep Cloudflare TURN discovery in EAS and pass the resulting ICE arguments to serve-sim
  • make EAS own ngrok setup, the auth token, high-entropy tunnel hostname, and lifecycle
  • return explicit cleanup handles for ngrok and detached processes, and stop preview resources from every remote-session caller

This is intentionally split across repositories: serve-sim owns generic streaming/readiness primitives; EAS owns infrastructure, credentials, policy, versioning, and supervision.

Test Plan

  • yarn build — all 13 monorepo targets passed, including @expo/build-tools
  • all directly affected suites outside the sandbox — 24 tests passed
  • focused final suites plus build-tools typecheck — 15 tests passed
  • yarn fmt:check
  • yarn lint — 0 errors (13 unrelated existing warnings)
  • the broader build-tools unit run reached 918 passing tests; its 10 failures were local sandbox restrictions around npm access, process inspection, and macOS keychain creation. The affected process-inspection suite passes outside the sandbox.
  • end-to-end verified the coordinated serve-sim build negotiated VP8 and delivered live 589×1280 video while applying the requested 60 fps / 3 Mbps sender policy

Rollout order

  1. Merge Add supervised stream startup contract serve-sim#36.
  2. Publish and verify that npm's latest dist-tag contains the coordinated serve-sim changes.
  3. Exercise this draft in an EAS Simulator staging session.
  4. Merge this PR to switch production off serve-sim-szdziedzic.

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 31.70732% with 84 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.25%. Comparing base (6fa71f8) to head (cc0a823).

Files with missing lines Patch % Lines
...ld-tools/src/steps/utils/remoteDeviceRunSession.ts 35.49% 58 Missing and 2 partials ⚠️
...c/steps/functions/startAgentDeviceRemoteSession.ts 0.00% 13 Missing and 3 partials ⚠️
.../src/steps/functions/startServeSimRemoteSession.ts 0.00% 6 Missing ⚠️
...ls/src/steps/functions/startArgentRemoteSession.ts 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4114      +/-   ##
==========================================
- Coverage   62.27%   62.25%   -0.02%     
==========================================
  Files         994      994              
  Lines       44735    44820      +85     
  Branches     9412     9425      +13     
==========================================
+ Hits        27854    27897      +43     
- Misses      15434    15474      +40     
- Partials     1447     1449       +2     

☔ 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.

@github-actions

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@szdziedzic
szdziedzic requested a review from sjchmiela July 30, 2026 11:52
@szdziedzic
szdziedzic marked this pull request as ready for review July 30, 2026 11:52
];
}

async function findAvailablePortAsync(): Promise<number> {

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.

This is weird to me. Shouldn't serve-sim pick a port itself? Or, couldn't we just assign a well known port to serve-sim?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

serve-sim can choose/scan for a port, but EAS needs to know the selected port to poll /readyz and configure ngrok. I allocated one in EAS to avoid parsing serve-sim output. That said, since the runner is single-tenant and only starts one serve-sim instance, using a well-known port like 3200 is simpler. I can switch this to a constant.

@szdziedzic
szdziedzic merged commit f145ed7 into main Jul 30, 2026
12 checks passed
@szdziedzic
szdziedzic deleted the szdziedzic-codex/expo-serve-sim branch July 30, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants