Skip to content

Stop every Harness session process tree on interruption - #443

Merged
JacobStephens2 merged 2 commits into
issue-432from
issue-435
Oct 6, 2026
Merged

JacobStephens2 merged 2 commits into
issue-432from
issue-435

Conversation

@JacobStephens2

@JacobStephens2 JacobStephens2 commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Summary

Interrupting a Command stops each session's whole process tree on every Harness, including commands that created their own process group or session.

Harness adapter.stop
  ps snapshot: session descendants and process groups
  send each Harness stop signal; allow 10 seconds each
    CLI exited → skip the remaining grace periods
  ps snapshot again: include commands started during shutdown
  SIGKILL every known process group

Closes #435

Evidence

  • Before: interrupting_a_claude_run_stops_a_command_in_its_own_session failed: "the detached command survived interruption".
    After: cargo test --test process_tree --test codex_sessions --test failed_run passes all 26 tests, covering detached commands on Claude and Codex, Codex's SIGINT → SIGTERM order, and prompt cleanup after the CLI exits.
  • Removing the second snapshot makes a_command_started_during_the_stop_grace_period_is_killed_too fail; restoring it passes.
  • cargo check --all-targets, cargo fmt --check, and cargo clippy --all-targets -- -D warnings pass.
  • cargo test: 1089 passed, 0 failed, 0 ignored across 35 test targets.

Seam under test: real Runs through the scenario harness with fake CLIs on PATH; observe recorded stop signals and the detached command's recorded pid after interruption.

Review against issue-432 at 860f48e: one Standards finding (duplicated test polling) addressed and verified by the reviewer; no Spec findings.

Merge Danger

Door: two-way

Blast Radius: sessions

Descendant discovery requires ps on PATH. A snapshot failure warns and still stops every known process group.

Unaddressed findings

Standards

None. The single finding was addressed.

Spec

None. No findings were reported.

Built with codex · gpt-6.1-sol · xhigh

@JacobStephens2
JacobStephens2 merged commit 7136bcd into issue-432 Oct 6, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-435 branch October 6, 2026 16:46
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.

1 participant