Describe the bug
The process_is_alive function in src/yoke/providers/runtime_deployment.py crashes on Windows when attempting to check if a process is still running during the cleanup of stale temporary runtime deployments.
When os.kill(pid, 0) is called on a non-existent PID on Windows, it raises a generic OSError: [WinError 87] The parameter is incorrect, rather than the ProcessLookupError seen on Unix systems. Because this exception is unhandled, it bubbles up and completely crashes the deploy_runtime function, preventing the harness from starting.
Steps to reproduce
- Run Yoke on a Windows machine.
- Have a stale/abandoned Yoke deployment directory (e.g.
yoke-codex-<pid>-...) in your temporary folder, where the <pid> no longer exists.
- Attempt to run any agent via Yoke.
- The application crashes during
reclaim_stale_deployments.
Expected behavior
The function should safely catch the Windows-specific OSError and return False, correctly identifying the process as dead and allowing the stale directory to be cleaned up without crashing.
Suggested Fix
Update process_is_alive in src/yoke/providers/runtime_deployment.py to catch OSError:
def process_is_alive(pid: int) -> bool:
if pid == os.getpid():
return True
try:
os.kill(pid, 0)
except ProcessLookupError:
return False
except PermissionError:
return True
except OSError:
# On Windows, os.kill(pid, 0) for a non-existent process raises OSError: [WinError 87]
return False
return True
Describe the bug
The
process_is_alivefunction insrc/yoke/providers/runtime_deployment.pycrashes on Windows when attempting to check if a process is still running during the cleanup of stale temporary runtime deployments.When
os.kill(pid, 0)is called on a non-existent PID on Windows, it raises a genericOSError: [WinError 87] The parameter is incorrect, rather than theProcessLookupErrorseen on Unix systems. Because this exception is unhandled, it bubbles up and completely crashes thedeploy_runtimefunction, preventing the harness from starting.Steps to reproduce
yoke-codex-<pid>-...) in your temporary folder, where the<pid>no longer exists.reclaim_stale_deployments.Expected behavior
The function should safely catch the Windows-specific
OSErrorand returnFalse, correctly identifying the process as dead and allowing the stale directory to be cleaned up without crashing.Suggested Fix
Update
process_is_aliveinsrc/yoke/providers/runtime_deployment.pyto catchOSError: