perf(host-kit): read Linux process identity from /proc before ps
Summary
On Linux the selected-PID identity snapshot ran ps, then replaced state and start token with /proc facts for every listed row. It now reads /proc first and runs one batch ps only for the PIDs left unread. Async identity reads (snapshot and ownership) read /proc through fs/promises. macOS and Windows still use their process tools; token formats are unchanged.
Intended change: a PID that /proc answers is observed even when ps fails, times out or omits it. Unread PIDs behave as before.
Out of scope: the ownership read still needs ps for command lines.
Stop and Windows row types moved to the type-only module, keeping host-process.ts at 1000 lines without adding a module to any import closure.
Tests that count process-tool runs hide /proc or claim a non-Linux platform.
Validation
Tested d294adcae654da5a6767876f0bfca55995a56c4d on macOS.
Process-tool runs per snapshot, counted by tests with Linux faked:
| Selected PIDs | Base | Head |
|---|---|---|
| all readable | 1 | 0 |
| some unread | 1, asking all | 1, asking only unread |
- Liveness, lock-wait, metadata tests: 48 passed, 6 Linux-only skipped; with Linux simulated, all 54 passed.
- The async no-blocking-read test fails against a75f848635.
- Scoped
tscpassed. - e2e82f79dc (tests, comments): changed test files 46 passed, 6 skipped; 52 passed with Linux simulated; package-boundary test passed.
- CI owns the full gates. Latency was not measured: no Linux host.
š¤ Generated with Claude Code