Skip to content

fix(install): windows-safe liveness probe in runtime_status#1746

Open
ketpatil77 wants to merge 1 commit into
headroomlabs-ai:mainfrom
ketpatil77:codex/headroom-runtime-windows-pid
Open

fix(install): windows-safe liveness probe in runtime_status#1746
ketpatil77 wants to merge 1 commit into
headroomlabs-ai:mainfrom
ketpatil77:codex/headroom-runtime-windows-pid

Conversation

@ketpatil77

@ketpatil77 ketpatil77 commented Jul 3, 2026

Copy link
Copy Markdown

Description

Windows-safe liveness probe for headroom install status.

runtime_status() now checks PID liveness through a helper that avoids blindly calling os.kill(pid, 0) on Windows.

Closes #1746

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Changes Made

  • headroom/install/runtime.py: added _pid_alive() with psutil.pid_exists first, then a safe os.kill fallback that catches SystemError.
  • headroom/install/runtime.py: runtime_status() now calls _pid_alive() instead of signalling the PID directly.
  • tests/test_install/test_runtime.py: added regression tests for helper behavior and runtime status wiring.

Testing

  • Unit tests pass (pytest)
  • Linting passes (ruff check .)
  • Type checking passes (mypy headroom)
  • New tests added for new functionality
  • Manual testing performed

Test Output

$ pytest tests/test_install/test_runtime.py
Focused runtime-status regression suite passed during local verification before PR submission.

$ ruff check headroom/install/runtime.py tests/test_install/test_runtime.py
Lint checks passed during local verification before PR submission.

Real Behavior Proof

  • Environment: Windows local Headroom install-status flow.
  • Exact command / steps: Exercised runtime-status helper path with Windows-safe PID liveness checks and regression coverage for fallback behavior.
  • Observed result: runtime_status() no longer crashes on detached Windows PIDs and routes through helper logic instead of direct os.kill(pid, 0).
  • Not tested: Cross-platform manual runtime install flow in this verification pass.

Review Readiness

  • I have performed a self-review
  • This PR is ready for human review

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the CHANGELOG.md if applicable

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

PR governance

This PR follows the template and is marked ready for human review.

@github-actions github-actions Bot added status: needs author action Pull request body or readiness checklist still needs author updates status: has conflicts Pull request has merge conflicts with the base branch and removed status: has conflicts Pull request has merge conflicts with the base branch labels Jul 3, 2026

@JerrettDavis JerrettDavis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the runtime liveness change. The new helper avoids the Windows os.kill(pid, 0) crash path by preferring psutil when available, preserves a POSIX fallback, treats permission as live, and catches the Windows SystemError failure mode. The tests cover the helper and runtime_status wiring. Checks are green; this looks ready.

@github-actions github-actions Bot added status: ready for review Pull request body is complete and the author marked it ready for human review status: has conflicts Pull request has merge conflicts with the base branch and removed status: needs author action Pull request body or readiness checklist still needs author updates status: ready for review Pull request body is complete and the author marked it ready for human review labels Jul 4, 2026
# Conflicts:
#	headroom/install/runtime.py
#	tests/test_install/test_runtime.py
@ketpatil77 ketpatil77 force-pushed the codex/headroom-runtime-windows-pid branch from 3921915 to 29f5b06 Compare July 4, 2026 15:23
@github-actions github-actions Bot added status: ready for review Pull request body is complete and the author marked it ready for human review and removed status: has conflicts Pull request has merge conflicts with the base branch labels Jul 4, 2026
@ketpatil77

Copy link
Copy Markdown
Author

Conflict rebase is done. Branch now sits on current main, keeps the Windows-safe liveness behavior, and re-runs clean locally: pytest tests/test_install/test_runtime.py -q (21 passed) and ruff check headroom/install/runtime.py tests/test_install/test_runtime.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: ready for review Pull request body is complete and the author marked it ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants