Skip to content

[DRAFT] MAINT Separate server launch, readiness, and cleanup state (#2415) - #2445

Draft
Zhenyu Wang (zhenyu-02) wants to merge 1 commit into
microsoft:mainfrom
zhenyu-02:codex/pyrit-2415
Draft

[DRAFT] MAINT Separate server launch, readiness, and cleanup state (#2415)#2445
Zhenyu Wang (zhenyu-02) wants to merge 1 commit into
microsoft:mainfrom
zhenyu-02:codex/pyrit-2415

Conversation

@zhenyu-02

@zhenyu-02 Zhenyu Wang (zhenyu-02) commented Aug 21, 2026

Copy link
Copy Markdown

Description

Closes #2415.

This refactors ServerLauncher.start_async into three internal seams while preserving it as the public orchestrator:

  • a pure launch plan for validation, command construction, and Windows/Unix process settings;
  • explicit startup state for process ownership, PID persistence, readiness, timeout, diagnostics, and cleanup results;
  • one idempotent, cancellation-safe cleanup path shared by launch failure, readiness failure, timeout, cancellation, and stop().

The process-group, detached-launch, PID-record, log, and public return/exception behavior remain unchanged. Focused tests cover platform-specific planning, invalid timeouts, cancellation during spawn/PID persistence/health polling/cleanup, repeated cancellation, readiness success, crash diagnostics, timeout cleanup, and cleanup failure retention.

Tests and Documentation

  • pytest -q tests/unit/cli/test_server_launcher.py — 67 passed, 1 skipped
  • pytest -q tests/unit/cli — 430 passed, 1 skipped
  • ruff check pyrit/cli/_server_launcher.py tests/unit/cli/test_server_launcher.py
  • ruff format --check pyrit/cli/_server_launcher.py tests/unit/cli/test_server_launcher.py
  • ty check pyrit/cli/_server_launcher.py tests/unit/cli/test_server_launcher.py
  • python -m compileall -q pyrit/cli/_server_launcher.py tests/unit/cli/test_server_launcher.py
  • git diff --check
  • diff coverage: 100% of 169 changed executable lines

No public API or documentation behavior changed. JupyText: N/A.

@zhenyu-02

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@romanlutz

Copy link
Copy Markdown
Contributor

Is this meant to be a draft PR or ready for review? Zhenyu Wang (@zhenyu-02)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MAINT Separate server launch, readiness, and cleanup state

2 participants