Skip to content

fix(runtime): tell users to restart when an update removes bundled runtimes - #63

Merged
lauridskern merged 3 commits into
mainfrom
cindara/fix-bundled-runtime-installation
Oct 29, 2026
Merged

lauridskern merged 3 commits into
mainfrom
cindara/fix-bundled-runtime-installation

Conversation

@lauridskern

Copy link
Copy Markdown
Collaborator

Closes #48.

Why

Hosts can update or uninstall Mobile Dev while its server is still running. The update deletes the version folder that the old server reads serve-emu and Baguette from, so the next Android stream or simulator open fails.

The Sentry users match up:

  • 9 of the 15 users in MOBILE-DEV-SERVER-68 (serve-emu) also appear in MOBILE-DEV-SERVER-7B (failed updates).
  • The Baguette issue, MOBILE-DEV-SERVER-7C (14 users), overlaps with both.
  • Several users lost both runtimes in the same second, minutes after a failed update, on the same release.

The packages themselves were complete. Users saw a developer message ("Run npm run vendor:serve-emu…"), and the panel retried on every reconnect.

What changes

  • Install integrity. packages/core/src/install-integrity.ts records the inode and modification time of the server's bundle file when it loads. Later it can tell whether those files are intact, removed or replaced.
  • A message the user can act on. A missing serve-emu or Baguette throws MissingRuntimeError:
    • When the server's files were removed or replaced, it says Mobile Dev was updated or removed while running, and asks the user to restart the app running it.
    • When the server's files are intact but the runtime was never there, it asks for a reinstall.
  • No retry storms. The panel now gets retryable: false for missing runtimes, as it already did for unavailable devices. The three duplicated checks became one retryableFailure().
  • Telemetry. A client event processor tags every error event from a server whose files are gone with install_integrity, however the event was captured. Missing-runtime errors also carry bundled_runtime, with install_integrity: incomplete when the install never had the runtime.
  • Store migration. installLatest no longer exists. Its replacement, migrateToStore, reported the same single generic error. It now tags plugin_update_step and plugin_update_failure, and the user-facing messages are unchanged.
  • docs/telemetry.md documents the new tags.

Not in this PR

  • Surviving the deletion. The old server could keep working if it ran from a stable copy of dist/, the way the Android CPU collector keeps its binaries in memory. But dist/ is about 131 MB, and this would change how every host launches the server, so it belongs in its own PR.
  • Other bundled helpers. iOS logs, the iOS mirror, FPS and agent-device still fail with their own errors after a deletion. Their events now carry install_integrity, so Sentry can show how often this happens.
  • Expected outcome. Once the field data confirms the cause, removed and replaced could count as expected outcomes, with only incomplete reported as an issue.

Testing

  • npm test: 877 of 880 passed, 1 skipped. Two TraceSift tests failed while npm run build ran at the same time; tracesift-client.test.ts passes on its own (14/14).
  • npm run typecheck:telemetry passes. A full tsc reports the same errors as main.
  • New tests:
    • install-integrity.test.ts bundles the module as a real server.mjs, then deletes or replaces that file.
    • android.test.ts calls mobile_android_stream_session through the real ServeEmu start path and checks the message and retryable: false.
    • Telemetry and migration tests check the Sentry tags.
  • End to end with npm run build, running dist/server.mjs from a copy:
    • Deleting the copy while the server ran made mobile_open_simulator say: "Mobile Dev was updated or removed while it was running and cannot find its simulator backend. Restart the app running Mobile Dev to load the installed version."
    • Starting a copy without baguette/ made it say: "This Mobile Dev installation is missing its simulator backend. Reinstall Mobile Dev, then restart the app running it."

…ntimes

Hosts can update or uninstall Mobile Dev while its server runs, deleting
the version folder the server reads serve-emu and Baguette from. Users
then saw a developer message about vendoring, and the panel retried the
failure on every reconnect.

The server now records its bundle file's identity when it loads. A
missing runtime tells the user to restart when the server's files were
removed or replaced, or to reinstall when the installation lacked the
runtime from the start, and the panel stops retrying it. Every error
event from a server whose files are gone carries install_integrity, and
missing-runtime errors also carry bundled_runtime.

Store migration failures now report which step failed and why, instead
of one generic error.

Closes #48
@lauridskern

Copy link
Copy Markdown
Collaborator Author

@codex review this

@lauridskern
lauridskern merged commit 0f803ec into main Oct 29, 2026
11 checks passed
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.

fix(packaging): installed plugin missing bundled serve-emu runtime

1 participant