diff --git a/src/conductor/providers/copilot.py b/src/conductor/providers/copilot.py index ff8c60d..297ac9e 100644 --- a/src/conductor/providers/copilot.py +++ b/src/conductor/providers/copilot.py @@ -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 diff --git a/tests/test_providers/test_copilot.py b/tests/test_providers/test_copilot.py index bc0ef0b..a8c9f57 100644 --- a/tests/test_providers/test_copilot.py +++ b/tests/test_providers/test_copilot.py @@ -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()