fix(host-kit): read every host ps field in one pinned UTF-8 locale
Summary
Invariant: a process identity that one daemon records must read the same in the next daemon.
macOS ps prints non-ASCII argv bytes as text in a UTF-8 locale and as escapes in C. A daemon inherits the locale of the client that starts it. The USB capture helper from #5201 has the device name in its argv, and default iPhone names have a curly apostrophe. A daemon that restarts under the other locale reads a different command for an orphaned helper and judges it unverified. The startup reaper keeps it without a signal, recovery reports ownership_fence_lost, and the helper continues to record.
Every host ps read now pins LC_ALL=C.UTF-8 TZ=UTC. C.UTF-8 keeps the POSIX lstart form, so start tokens do not change. The lstart pin from #4682 now also covers command= and the listHostProcesses scan.
The rest of the crash path traced clean: the same envelope and owned-process record as simctl, a reaper SIGTERM that finishes the file, and a flock start lock released on helper exit.
Before / after
readProcessCommand(pid) for perl … --device-name Michał’s iPhone, reader under LC_ALL=C:
- base:
--device-name MichaM-EM^BM-bM^@M^Ys iPhone(underen_US.UTF-8:Michał’s iPhone) - head:
--device-name Michał’s iPhonein both locales
Validation
- Head
fd5ae38:host-process-liveness.test.tspasses (39). The updated test fails on base. - Before/after above: a live macOS host read through the real module.
- CI owns the gates.
- Risk: a record from a pre-fix daemon under
C, with a non-ASCII command, mismatches once after the upgrade.
🤖 Generated with Claude Code