Skip to content

[eas-cli] Keep simulator control connections alive - #4791

Open
gwdp wants to merge 1 commit into
mainfrom
gwdp/simulator-control-keep-alive
Open

gwdp wants to merge 1 commit into
mainfrom
gwdp/simulator-control-keep-alive

Conversation

@gwdp

@gwdp gwdp commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Why

Repeated control commands reconnect to the preview server. Let agents keep the connection ready between commands.

How

Add an optional local helper and share action preparation, uploads, downloads and execution. Ordinary control commands reuse the helper when available. The idle timeout defaults to 120 seconds.

eas simulator:control:connection open --idle-timeout 300
eas simulator:control appearance.set dark
eas simulator:control:connection status --id <session-id> --json
eas simulator:control:connection close

# Or keep the connection after an action:
eas simulator:control hardwareKeyboard.set off --keep-alive --idle-timeout 30

--idle-timeout takes seconds. Closing the connection leaves the simulator session running. Keep-alive supports macOS and Linux; ordinary commands still work on Windows. Control import (#4686) and start import (#4687) use this shared executor.

Security and cleanup

The helper uses an owned, private Unix socket directory. Processes running as the same OS user share this authority. Discovery is scoped to EAS credentials, project, session, API environment and CLI installation/version. Preview credentials pass over parent-child IPC; no new credential file is written.

Callers run one at a time. A dropped reply never triggers an automatic replay. Messages, queues and waits are bounded. Close finishes the in-flight action, rejects later actions and permits bounded upload cleanup. Immediate reopen waits for the drain.

Saved-login changes, idle expiry and remote disconnect close the helper. Server-side access-token revocation is not polled. An already-dispatched action can finish during shutdown.

Test Plan

Codex reproduced the shutdown-test races under coverage. Tests now allow close events to settle and retry dropped status probes until the helper confirms closing. The old test fails a deterministic reset injection; the correction passes. Destroying active work still fails the corrected test. The base passed 759 simulator/help tests with coverage, clean build, typecheck, lint and formatting; the complete stack passed 901 tests. Production code is unchanged. Current-head CI passes on Node 22 and Node 24. Devin completed with no unresolved findings.

Current-head Codecov patch coverage is 94.57%. Worker bootstrap/exit paths and some error branches remain uncovered; no coverage exclusions were added. Hosted EAS session testing and latency measurements remain pending.

Authorship and LLM use

Gabe chose the connection commands and timeout, then asked to share the control code with imports. Codex implemented the helper, moved the action executor into this layer and restacked the imports. Gabe reviewed the changes at 1899090. Codex then rebased onto current main and later corrected shutdown-test races exposed by Node 22 CI. The existing poll delay now lets the close event abort the connection before checking refusal replies. The close-caller test also retries transient probe disconnects and still checks the close acknowledgement and active-work drain. These test-only adjustments have not had a new human review; production code is unchanged.

Astra and Opus reviews led to removing redundant authentication and validation, then fixing admission and shutdown races. Devin identified the close/reopen race. Coverage reviews corrected a masked shutdown assertion and a fake-timer race. Independent rechecks were clean on the earlier combined implementation; Codex checked the reorganized layers and preserved feature tree. Those independent reviews and hosted testing were not repeated for the split.

— Codex

@gwdp

gwdp commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Codex corrected shutdown-test event ordering and retry of transient status-probe disconnects. A reset injection fails the old test and passes the correction; destroying active work still fails it. Passed 759 base tests with coverage, build, typecheck, lint and formatting, plus 901 tests and a clean build/typecheck on the restacked tip. Production code is unchanged. Current-head Node 22/24 CI and Devin pass; no unresolved review threads remain. Earlier human reviews predate these test-only changes.

— Codex

@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.56825% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.85%. Comparing base (156e38e) to head (ee19c5d).

Files with missing lines Patch % Lines
...s/eas-cli/src/simulator/controlConnectionWorker.ts 78.37% 36 Missing and 1 partial ⚠️
packages/eas-cli/src/simulator/hostActions.ts 96.08% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4791      +/-   ##
==========================================
+ Coverage   76.64%   76.85%   +0.22%     
==========================================
  Files        1102     1108       +6     
  Lines       55495    56124     +629     
  Branches    12236    12424     +188     
==========================================
+ Hits        42530    43130     +600     
- Misses      11976    12004      +28     
- Partials      989      990       +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.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from 7b3bbf9 to 04b5495 Compare October 30, 2026 01:15
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

devin-ai-integration[bot]

This comment was marked as outdated.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from 04b5495 to 5261e34 Compare October 30, 2026 01:33
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from 5261e34 to f2c3b5c Compare October 31, 2026 06:01
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from f2c3b5c to 0de7ec0 Compare October 31, 2026 06:34
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp changed the base branch from gwdp/start-import-second-20261018 to main November 3, 2026 04:27
@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from 0de7ec0 to 1899090 Compare November 3, 2026 04:27
@gwdp
gwdp added this pull request to stack #4804 November 3, 2026 04:33
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

devin-ai-integration[bot]

This comment was marked as outdated.

@gwdp
gwdp marked this pull request as ready for review November 3, 2026 05:08
@gwdp
gwdp requested a review from szdziedzic November 3, 2026 05:08
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
packages/eas-cli/** @douglowder

Generated by CodeMention

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

@linear-code

linear-code Bot commented Nov 3, 2026

Copy link
Copy Markdown

ENG-28817

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from 1899090 to 011dfd3 Compare November 4, 2026 04:39
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from 011dfd3 to ff2aea7 Compare November 4, 2026 05:19
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from ff2aea7 to ee19c5d Compare November 4, 2026 05:40
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

✅ Thank you for adding a changeset!

@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

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