Skip to content

[build-tools] Stabilize remote simulator tunnels - #4226

Draft
szdziedzic wants to merge 2 commits into
mainfrom
szdziedzic-codex/stabilize-simulator-ngrok-tunnels
Draft

[build-tools] Stabilize remote simulator tunnels#4226
szdziedzic wants to merge 2 commits into
mainfrom
szdziedzic-codex/stabilize-simulator-ngrok-tunnels

Conversation

@szdziedzic

Copy link
Copy Markdown
Contributor

Why

Remote simulator jobs only polled the device-run session status while ngrok forwarding tasks and the agent-device, Argent, and serve-sim processes ran unsupervised. If one of those resources stopped, the already-published URL stayed visible but ngrok returned ERR_NGROK_3200 because its endpoint was offline. The detached-process helper also retained unbounded output.

How

  • create one explicit ngrok session per device-run session and share it between its tool and serve-sim tunnels
  • keep transient ngrok reconnects enabled, log disconnect/reconnect health, and fail after a 60-second disconnect grace period
  • use joinable ngrok listeners so terminal forwarding failures are observable
  • supervise the ngrok listeners and agent-device, Argent, and serve-sim processes while polling session status
  • abort background status polling when a supervised resource fails
  • cap detached process diagnostics at 256 KiB and include them in unexpected-exit errors
  • attach device-run session metadata to ngrok sessions and endpoints for diagnosis

Test plan

  • corepack yarn workspace @expo/build-tools jest-unit --runInBand src/steps/utils/__tests__/remoteDeviceRunSession.test.ts src/steps/functions/__tests__/startArgentRemoteSession-orchestration.test.ts (36 tests passed)
  • corepack yarn workspace @expo/build-tools typecheck
  • corepack yarn fmt:check
  • oxlint on all six changed files
  • full build-tools unit run: 1,015 tests passed; the remaining pre-existing environment-dependent tests could not access npm, macOS keychain services, or ps/pgrep in the sandbox

@github-actions

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.98374% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.61%. Comparing base (0e85408) to head (3974d9d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ld-tools/src/steps/utils/remoteDeviceRunSession.ts 75.43% 28 Missing and 1 partial ⚠️
...c/steps/functions/startAgentDeviceRemoteSession.ts 0.00% 2 Missing ⚠️
.../src/steps/functions/startServeSimRemoteSession.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4226      +/-   ##
==========================================
+ Coverage   63.54%   63.61%   +0.07%     
==========================================
  Files        1028     1028              
  Lines       47054    47167     +113     
  Branches     9891     9914      +23     
==========================================
+ Hits        29898    29999     +101     
- Misses      17055    17066      +11     
- Partials      101      102       +1     

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

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.

1 participant