fix(logs): keep an early iOS simulator logs stop from hanging the session
Merged
TH
3d ago+253+253+012345678901234567890123456789-11-11-01234567890123456789
Summary
On an Apple simulator, a logs stop sent ~400 ms after logs start could hang the session (found by #3885).
Root cause: simctl spawn … log stream forwards a stop signal only after the in-simulator log process has launched. An earlier SIGINT ended simctl, and the orphaned log process kept the output pipes open, so the managed app-log wait never settled.
- Simulator
logs startreturns once the stream writes output. If that takes more than 10 s, it fails withdetails.reason: "simulator-log-stream-launch-timeout". - Managed app-log termination now releases pipes that a process outside the child's tree still holds.
6 files plus a commands.md note.
Validation
Head 872985b93d.
- New tests fail on base. Removing the stream release fails the real-process test.
- Live at
872985b93d(iOS 27.0 sim, Xcode 27.1, host load 380–930 on 12 cores), see this comment:- start → 400 ms → stop →
appstate: 24 runs. Stop never hung: 0.8 / 1.8 / 6.2 s (min/median/max). 0 in-sim and 0 host leftovers. - 1/24 starts hit the 10 s launch timeout. It failed with the typed reason and left the session clean.
- Mid-launch cancels: 8 runs, 0 leftovers, session continued.
- start → 400 ms → stop →
- Earlier, at
0d3c327, baseb74fcebdc1hung 2 times in 10 runs. check:affected --run --head 872985b93d: format, lint, and typecheck passed. Vitest passed 1299/1300. Its one failure (apple-platform-output-guardrecordtimeout) also fails on maine3ed027a1dat load ~900. CI Integration Tests passes.
🤖 Generated with Claude Code