Skip to content

Conversation

@mmereu
Copy link
Contributor

@mmereu mmereu commented Jan 24, 2026

Summary

  • 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
  • Add PYTHONUNBUFFERED env var for immediate output

Problem

On Windows, the agent subprocess would block with "Press any key to continue" message, requiring manual restart.

Test plan

  • Tested on Windows - agent runs without blocking
  • Server continues responding while agent is running

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Suppressed unexpected console windows on Windows and added stronger cleanup of background processes to avoid lingering/zombie processes.
    • Ensured feature state is reset when a background agent fails to start so it can be retried.
  • Improvements

    • Improved background process I/O for real‑time, unbuffered output and more robust input handling.
    • Streamlined UI startup by removing an unnecessary pause after launch.

✏️ Tip: You can customize this high-level summary in your review settings.

mmereu and others added 2 commits January 24, 2026 10:40
- 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>
@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

📝 Walkthrough

Walkthrough

Replaces 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

Cohort / File(s) Summary
Parallel orchestrator changes
parallel_orchestrator.py
Use popen_kwargs for Popen (stdin=DEVNULL, stdout/stderr preserved, text, cwd, env); on win32 include creationflags=CREATE_NO_WINDOW; add child-process cleanup (_kill_process_tree(proc, timeout=2.0)) in _read_output finally block; reset feature in_progress flag on spawn failure and commit.
Process manager updates
server/services/process_manager.py
Replace direct Popen with subprocess.Popen(cmd, **popen_kwargs) using stdin=DEVNULL, stdout=PIPE, stderr=STDOUT, cwd, and set PYTHONUNBUFFERED=1 in env; add win32 creationflags=CREATE_NO_WINDOW.
Batch script
start_ui.bat
Removed final pause so the script exits immediately after launching the Python process.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nudged spawns to sleep, then swept the mess away,
No windows popping up to shout throughout the day.
Outputs flow unbuffered, children gently end,
The batch script hops off—no pause to apprehend. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of the PR: preventing Windows subprocess blocking through stdin and console window handling.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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 Popen call lacks stdin=subprocess.DEVNULL and the Windows CREATE_NO_WINDOW flag 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 — this Popen call is missing stdin=subprocess.DEVNULL and the Windows CREATE_NO_WINDOW flag.

🔧 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>
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