fix(gateway): use canonical _pid_exists in restart watcher; /restart …#42338
fix(gateway): use canonical _pid_exists in restart watcher; /restart …#42338riyas22 wants to merge 1 commit into
Conversation
…silently no-ops on Windows - Replace inline _alive() with gateway.status._pid_exists (fixes inverted WaitForSingleObject == 0x102 comparison that made /restart no-op on Windows) - Bound POSIX poll loop with 120s deadline matching Windows branch - Add stdin=DEVNULL to POSIX Popen calls - Add sh fallback when bash not found (Alpine/musl)
|
✅ Verified — restart watcher PID check + bounded deadline Reviewed the diff for Windows fix: Replacing the inline Linux fix: The shell-based Shell fallback: Test coverage: Updated No issues found. |
…silently no-ops on Windows
What does this PR do?
Fixes a critical silent failure in /restart on Windows where an inverted WaitForSingleObject comparison caused the restart watcher to exit immediately, preventing the gateway from ever respawning. Also bounds the POSIX poll loop with a 120s deadline (matching the Windows branch), adds stdin=DEVNULL to POSIX Popen calls, and adds sh fallback for Alpine/musl systems.
Related Issue
Fixes #42116
Fixes #29180
Type of Change
Changes Made
How to Test
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
hermes --toolsets skills -q "Use the X skill to do Y"Screenshots / Logs
$ python -m pytest tests/gateway/test_restart_drain.py -v
...
PASSED tests/gateway/test_restart_drain.py::test_restart_watcher_uses_canonical_pid_exists
PASSED tests/gateway/test_restart_drain.py::test_posix_watcher_has_deadline
PASSED tests/gateway/test_restart_drain.py::test_posix_popen_uses_devnull_stdin
PASSED tests/gateway/test_restart_drain.py::test_posix_watcher_uses_sh_fallback
... (17 passed)
$ python -m pytest tests/gateway/ --tb=no -q
6188 passed, 3 failed in Xs