Skip to content

fix(mcp): clean up owned POSIX process groups on cancellation - #219

Merged
abruption merged 10 commits into
mainfrom
fix/206-mcp-cleanup
Sep 27, 2026
Merged

abruption merged 10 commits into
mainfrom
fix/206-mcp-cleanup

Conversation

@abruption

@abruption abruption commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Give each POSIX MCP invocation a separately owned process group. Use Popen without early child reaping, preserve stdout/exit semantics, and finish group/pipe cleanup despite repeated async cancellation.

Closes #206

Type

  • fix

Checklist

  • python3 cc_peer.py list works locally (live-session inspection not performed)
  • python3 cc_peer.py list --host <a real host> works over SSH (out of scope)
  • --dry-run resolves a target without posting anything (covered by existing mocked contracts; no live target)
  • Commits follow Conventional Commits
  • Docs updated if behavior changed
  • No secrets, tokens, or session keys in the diff (synthetic sentinels only)

Verified against

macOS arm64; Python 3.14.7, websockets 17.1; Node 22.14.0 for Control. Linux/Windows matrix results are left to PR CI, not claimed from this machine.

Full Python suite after incorporating the merged stability fixes: 552 tests, 12 skipped. MCP fixtures: 17 tests under -X dev -W error::ResourceWarning, including timeout/repeated cancellation, a TERM-resistant descendant with detached stdio, and isolation from a saturated shared executor. Documentation: 10 tests.

Notes

Dependency PR #218 is now merged. This PR has been retargeted and updated to main; the remaining diff is MCP cleanup only. Windows retains existing direct-child cleanup, not a process-tree guarantee. Deliberately escaped sessions and remote SSH processes are outside the owned group. Timeout remains outcome_unknown; never automatically resend.

Prepared in an isolated worktree from main 03d4bd4. No merge, release, production deployment, real send or ACK test is included. CI status is independent of the local checks above.

@abruption abruption added this to the v1.0.2 milestone Sep 27, 2026
@abruption
abruption changed the base branch from fix/205-wake-cleanup to main September 27, 2026 05:02
@abruption
abruption merged commit 5004fcf into main Sep 27, 2026
24 checks passed
@abruption
abruption deleted the fix/206-mcp-cleanup branch September 27, 2026 05:21
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.

fix(mcp): bound cleanup of CLI descendants on cancellation and timeout

1 participant