-
Notifications
You must be signed in to change notification settings - Fork 301
fix: prevent agent subprocess blocking on Windows #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Add stdin=subprocess.DEVNULL to prevent blocking on stdin reads - Add CREATE_NO_WINDOW flag on Windows to prevent console pop-ups - Remove trailing pause from start_ui.bat Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolved conflicts by combining: - stdin=DEVNULL and CREATE_NO_WINDOW (blocking fix) - PYTHONUNBUFFERED env var (output buffering fix) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughReplaces direct subprocess Popen calls with explicit popen_kwargs, adds stdin=DEVNULL and Windows CREATE_NO_WINDOW handling, ensures unbuffered Python output, introduces child-process-tree cleanup and feature in_progress reset on spawn failure, and removes a final pause from the UI batch script. (50 words) Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
parallel_orchestrator.py (2)
519-527: Inconsistent: Missing Windows subprocess handling in testing agent spawner.This
Popencall lacksstdin=subprocess.DEVNULLand the WindowsCREATE_NO_WINDOWflag that were added to_spawn_coding_agent. Testing agents could still block on stdin or show console pop-ups on Windows.🔧 Proposed fix to align with _spawn_coding_agent
try: - proc = subprocess.Popen( - cmd, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - text=True, - cwd=str(AUTOCODER_ROOT), - env={**os.environ, "PYTHONUNBUFFERED": "1"}, - ) + popen_kwargs = { + "stdin": subprocess.DEVNULL, + "stdout": subprocess.PIPE, + "stderr": subprocess.STDOUT, + "text": True, + "cwd": str(AUTOCODER_ROOT), + "env": {**os.environ, "PYTHONUNBUFFERED": "1"}, + } + if sys.platform == "win32": + popen_kwargs["creationflags"] = subprocess.CREATE_NO_WINDOW + + proc = subprocess.Popen(cmd, **popen_kwargs)
570-577: Inconsistent: Missing Windows subprocess handling in initializer.Same issue as
_spawn_testing_agent— thisPopencall is missingstdin=subprocess.DEVNULLand the WindowsCREATE_NO_WINDOWflag.🔧 Proposed fix to align with _spawn_coding_agent
- proc = subprocess.Popen( - cmd, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - text=True, - cwd=str(AUTOCODER_ROOT), - env={**os.environ, "PYTHONUNBUFFERED": "1"}, - ) + popen_kwargs = { + "stdin": subprocess.DEVNULL, + "stdout": subprocess.PIPE, + "stderr": subprocess.STDOUT, + "text": True, + "cwd": str(AUTOCODER_ROOT), + "env": {**os.environ, "PYTHONUNBUFFERED": "1"}, + } + if sys.platform == "win32": + popen_kwargs["creationflags"] = subprocess.CREATE_NO_WINDOW + + proc = subprocess.Popen(cmd, **popen_kwargs)
Added _kill_process_tree call in _read_output finally block to ensure child processes (Claude CLI) are cleaned up when agents complete or fail. This prevents accumulation of zombie processes that was causing 78+ Python processes when max concurrency was set to 5. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
stdin=subprocess.DEVNULLto prevent blocking on stdin readsCREATE_NO_WINDOWflag on Windows to prevent console pop-upspausefrom start_ui.batPYTHONUNBUFFEREDenv var for immediate outputProblem
On Windows, the agent subprocess would block with "Press any key to continue" message, requiring manual restart.
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.