Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/conductor/providers/copilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,15 @@ def _fix_pipe_blocking_mode(self) -> None:
BlockingIOError instead of blocking until the reader drains the pipe.
Since the SDK already runs writes in a thread-pool executor, blocking
is safe and correct here.

Skipped on Windows where O_NONBLOCK does not exist and pipes are
always blocking.
"""
import sys

if sys.platform == "win32":
return

import fcntl
import os

Expand Down
21 changes: 21 additions & 0 deletions tests/test_providers/test_copilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,3 +556,24 @@ def test_log_parse_recovery_truncates_long_error(
max_attempts=5,
error=long_error,
)


class TestFixPipeBlockingMode:
"""Tests for _fix_pipe_blocking_mode Windows platform guard."""

def test_skips_on_windows(self, monkeypatch: pytest.MonkeyPatch) -> None:
"""Test that _fix_pipe_blocking_mode is a no-op on Windows."""
monkeypatch.setattr("sys.platform", "win32")
provider = CopilotProvider(mock_handler=stub_handler)
# Should return immediately without importing fcntl
provider._fix_pipe_blocking_mode()

def test_runs_on_unix(self, monkeypatch: pytest.MonkeyPatch) -> None:
"""Test that _fix_pipe_blocking_mode does not skip on non-Windows."""
monkeypatch.setattr("sys.platform", "linux")
provider = CopilotProvider(mock_handler=stub_handler)
# On actual Windows, fcntl is unavailable so the import will fail.
# The important assertion is that the platform guard did NOT return
# early — it proceeded past the guard and attempted the import.
with contextlib.suppress(ModuleNotFoundError):
provider._fix_pipe_blocking_mode()