fix(daemon): close the session app when close omits the app

XI
2h ago
+95-49

Summary

close without an app ended the session but left the app running on iOS simulators and Android emulators, although help close says it closes the active session app. The daemon now closes the session's appBundleId the same way close <app> does, Android close fences included.

  • A session that never opened an app still closes without a platform close.
  • Web sessions are unchanged.
  • The positional-only gate predates #826, which added only the web exception. I found no decision to skip the session app.

9 files: 1 source file (+13/-4), the rest tests and integration fakes.

Fixes #4684

Validation

Head 09181458e on base aa600e980.

  • The new unit test fails on base and passes on head. Provider integration: 79/79 files pass. check:quick passed.
  • check:affected --run --head 09181458e: all stages pass except unit. 21 of its 22 failures pass when re-run alone. The remaining one, android-sdk-setup-action.test.ts, fails the same way on aa600e980 on this host, where a local Android SDK path leaks into the expected path.
  • iOS 27.2 simulator: after open โ†’ close, MultiTodo stays in launchctl on base and is gone on head.
  • Android emulator: pidof 4746 โ†’ 4746 on base, 3382 โ†’ empty on head.
  • Sessions that opened no app close with exit 0 on both.

Impact to review: a plain close now also stops the app on macOS, on physical Apple devices, on cloud providers, at the end of .ad scripts, and in replay test suite teardown (closeReplayTestSession). Teardown adds Android close-fence time per flow. None of these were run live.

๐Ÿค– Generated with Claude Code


Autofix with [code]smith
Open in [code]smith ยท Need help on this PR? Tag @codesmith-bot with what you need.