mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-08-14 00:47:52 +00:00
* fix: use a signal-free liveness probe for the daemon on Windows `_read_pid()` probed the recorded pid with `os.kill(pid, 0)`. That is a POSIX idiom: on Windows signal 0 is `CTRL_C_EVENT`, so the call routes to `GenerateConsoleCtrlEvent` rather than testing for existence, and raises `OSError` (WinError 87, "The parameter is incorrect") for any pid that is not a live console process-group leader — which includes both dead pids and the detached server `jarvis start` creates. That single call produced three symptoms. `jarvis status` propagated the error and crashed. `_read_pid`'s `except OSError` swallowed it for a running server, so `status` and `stop` reported "not running" and deleted a live pid file. And because the probe *sends* a console control event rather than merely asking, running `status` against the daemon could terminate it. Add `_pid_alive()`, which opens a process handle and checks it on Windows and keeps the signal-0 probe on POSIX, and use it for both liveness checks. `SIGKILL` in the stop path is now reached on Windows for the first time, so guard it — it is POSIX-only, and `SIGTERM` already maps to `TerminateProcess` there. The existing round-trip test mocked `os.kill` to succeed, which is why this passed CI on Linux while failing on every Windows run. Point it at the new seam and add `TestPidLiveness`, which exercises real pids so the platform behaviour is actually covered. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * style: format daemon tests with CI Ruff --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Elliot Slusky <elliot@slusky.com>