Files
Filip131311 b41cca4efe fix(boot-device): refresh stale native-devtools/ax-service after a reboot
A simulator reboot resets the simulator's launchd environment (clearing
DYLD_INSERT_LIBRARIES) and restarts SpringBoard/cfprefsd, but the cached
per-device services from the previous boot are never refreshed:

- native-devtools latches `envSetup=true` after its first successful
  setup, so `ensureEnvReady()` short-circuits and never re-writes the
  DYLD_INSERT_LIBRARIES the reboot cleared. Injection silently breaks
  while `native-devtools-status` keeps reporting `envSetup: true`, and
  restart-app can never re-inject.
- ax-service computes `degraded` once at factory time and holds a daemon
  socket bound to the now-dead boot, so `describe` falls back with an
  empty tree and the stale "this simulator was not booted through argent
  … call boot-device with force=true" hint — even when it WAS just booted
  through argent. The advised remedy (force=true) hits the same bug, so
  there is no recovery.

`boot-device force=true` reproduces this every time: it reboots inside the
tool but reuses the cached services. (A full shutdown→boot recovers only
because the daemon process exits, fires `terminated`, and the registry
tears the service down — so the next resolve rebuilds fresh.)

Fix: on the real (re)boot paths (`needsPreBoot`: Shutdown, or force+Booted),
dispose the cached native-devtools and ax-service (every transport variant)
before re-resolving, so the next resolve rebuilds them against the fresh
boot. The native-devtools resolve immediately after then re-runs ensureEnv
and re-establishes injection. The already-Booted-without-force path does
not reboot, so it leaves the live services untouched.
2026-06-03 18:15:46 +02:00
..