GCWing / GCWing/OpenBitFun

[Bug]: CLI treats a macOS process group as exited while TERM-resistant children remain alive

Offen
#2,645 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
2.2k
Forks
229
Ø Merge
2 Std. 46 Min.
Gemergte PRs (30 T.)
577

Beschreibung

## Summary

On macOS kill(-pgid, 0) returns ESRCH for an orphaned process group whose only remaining members are TERM-resistant children, so wait_for_process_group_exit believed the group had exited and terminate_worker returned early, letting SIGKILL follow a vanished leader.

The macOS branch of process_group_alive now enumerates group members with pgrep -g (Apple's ps -g is a no-op unless unix2003 compat mode is active) and requires at least one live member judged with the existing macos_process_state_allows_escalation stat semantics; a failed or empty query fails closed. The Linux kill(-pgid, 0) + EPERM path is unchanged.

## Area

src/apps/cli/src/dispatch/runner.rs (process_group_alive only). Crate: bitfun-cli.

## Reproduction or evidence

At 32f2427697, process_group_alive (:206-215) is a single kill(-pgid,0) probe with no macOS branch; macos_process_state_allows_escalation (:262-269) already encodes live-state/no-exit-modifier semantics used by process_alive. Test: cancellation_does_not_escalate_after_term_exits_the_verified_leader fails when the leader is reaped while TERM-resistant children survive.

## Environment

macOS runners (Apple ps -g is a no-op unless unix2003 compat mode is active; pgrep -g is the reliable PGID probe); baseline 32f2427697. A Windows host cannot compile the macOS face, so verification of that face relies on the remote CI CLI Tests(macos) run for the corresponding PR; unix-only tests are cfg-excluded on Windows locally.

---
AI-assisted change. Testing: verified locally (`cargo check -p bitfun-cli` exit 0; `cargo test --bin bitfun dispatch::runner` 7 passed, 0 failed); macOS face covered by remote CI CLI Tests(macos).

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start in src/apps/cli/src/dispatch/runner.rs at process_group_alive, then read macos_process_state_allows_escalation and the cancellation_does_not_escalate_after_term_exits_the_verified_leader test. Verify the macOS process-group behavior with the existing runner tests and cargo check -p bitfun-cli; done means the local tests pass and the macOS CLI Tests run confirms the macOS face.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
macos, rust
Bereich
cli, operating-systems
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
72/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.