Repository navigation
fix(daemon): close the session app when close omits the app - #4697
xiatiandeairen wants to merge 2 commits into
Conversation
close without an app ended the session but skipped the platform close, so the app kept running on iOS simulators and Android emulators although close help says it closes the active session app. A native session with an app now closes that app the same way close <app> does, Android close fences included. A session that never opened an app still closes without a platform close.
…app close Plain close now stops the session app, so the scripted Android providers report the app gone after force-stop, the repair close scenario reuses the shared repair world instead of its own copy, and the Maestro suite counts the stop that each flow's session close adds.
|
Thanks for the fix. At 0918145, plain The new dispatch in session-close.ts:84 reaches routes that were never run. A macOS native app-device session now runs Not blocking, and you can take or leave these: the repair-armed close receipt at session-close.ts:100 is still keyed on the request positionals, while the platform operation now comes from |
|
On the two live runs from my last comment (a macOS native app device, and a physical iOS device with CoreDevice): if you have either device, please run that sequence at this head and post the output. If you're missing one or both, reply here and say which. A maintainer will then run the missing route on their device, so the PR won't wait on hardware you don't have. |
|
Closing this one. Thanks for the careful review. We don't need the behavior change ourselves: our runs now always pass the app to The mismatch in #4684 still stands: |
|
I ran the two routes from your comment live at (a) macOS native app (
|
open … --platform macos --session s |
close --session s |
Calculator after close | |
|---|---|---|---|
| base | Opened, exit 0, pid 57291 |
Closed: s, exit 0 |
still running (pgrep -x Calculator → 57291) |
| head | Opened, exit 0, pid 57880 |
Closed: s, exit 0, 0.8 s |
gone (pgrep empty, lsappinfo empty) |
| head, re-run | exit 0 | Closed: s, exit 0, 0.8 s |
gone |
No app-device-scope, COMMAND_FAILED or MACOS_APP_TERMINATION_TIMEOUT error appeared. One base close took 13.6 s, and a base re-run took 0.5 s. I did not look into the slow one. It happened on base, so it is not from this change.
(b) Physical iOS device, CoreDevice backend (iPhone 17, iOS 27.2 24B119, developer-signed com.todoapp.ios)
open … --udid <udid> --session s |
close --session s |
xcrun devicectl device info processes after close |
|
|---|---|---|---|
| base | Opened, exit 0, pid 5130 |
Closed: s, exit 0, 0.4 s |
still running (pid 5130) |
| head | Opened, exit 0, pid 5148 |
Closed: s, exit 0, 0.9 s |
absent |
Simulator and emulator runs from the PR body (re-run)
| Device | Before close | After close --session s |
|
|---|---|---|---|
| base | iOS simulator, com.apple.Preferences |
1 UIKitApplication: entry in launchctl list |
still 1 entry, exit 0 |
| head | iOS simulator | 1 entry | 0 entries, exit 0 |
| base | Android emulator, com.android.settings |
pidof 4523 |
still 4523, exit 0, 0.5 s |
| head | Android emulator | pidof 4619 |
empty, exit 0, 0.8 s |
Not covered. I did not time close --shutdown. It shuts down the device, and these simulators and emulators come from a host pool that other agents use. The other non-blocking notes are also not done yet: the repair-armed receipt keyed on the positionals, the stale shouldDispatchPlatformClose comments, and the impact sentence. CI on this fork head still needs a maintainer to approve it.
Summary
closewithout an app ended the session but left the app running on iOS simulators and Android emulators, althoughhelp closesays it closes the active session app. The daemon now closes the session'sappBundleIdthe same wayclose <app>does, Android close fences included.9 files: 1 source file (+13/-4), the rest tests and integration fakes.
Fixes #4684
Validation
Head
09181458eon baseaa600e980.check:quickpassed.check:affected --run --head 09181458e: all stages pass exceptunit. 21 of its 22 failures pass when re-run alone. The remaining one,android-sdk-setup-action.test.ts, fails the same way onaa600e980on this host, where a local Android SDK path leaks into the expected path.open→close, MultiTodo stays inlaunchctlon base and is gone on head.pidof4746 → 4746 on base, 3382 → empty on head.Impact to review: a plain
closenow also stops the app on macOS, on physical Apple devices, on cloud providers, at the end of.adscripts, and inreplay testsuite teardown (closeReplayTestSession). Teardown adds Android close-fence time per flow. None of these were run live.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.