5e1867bb50
After test runs that use live_gui, dozens of sloppy.py --enable-test-hooks processes can leak (the watchdoge1c8730fbounds the hang but doesn't kill the spawned GUI subprocesses). This script: - Enumerates all python.exe / uv.exe processes via CIM - Categorizes each by command-line content: - sloppy.py --enable-test-hooks -> KILL (orphans) - scripts/mcp_server.py -> PRESERVE (manual_slop's MCP server, used by opencode) - minimax-coding-plan-mcp -> PRESERVE (opencode's MCP server, used by opencode) - pytest runner / stuck App() test -> PRESERVE by default, kill with --kill-tests - Defaults to DRY-RUN; pass --kill to terminate - --kill-tests: also kill stuck test subprocesses - --kill-mcp: also kill MCP servers (off by default; usually DON'T want this) - --json: machine-readable output for CI/scripting Verified after a 10-batch test run: 28 sloppy.py orphans identified, 21 MCP servers (9 manual_slop + 12 minimax) preserved correctly. The watchdog fix (e1c8730f) bounds the test hang; this script cleans up the leaked GUI subprocesses afterward. Usage: uv run python scripts/cleanup_orphaned_processes.py # dry-run uv run python scripts/cleanup_orphaned_processes.py --kill # kill sloppy.py orphans uv run python scripts/cleanup_orphaned_processes.py --kill --kill-tests