Compare commits

...

1 Commits

Author SHA1 Message Date
Shaqayeq
cdd8653855 Pin Python SDK app-server stdio to UTF-8 2026-03-19 16:54:21 -07:00
2 changed files with 39 additions and 0 deletions

View File

@@ -181,6 +181,7 @@ class AppServerClient:
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
encoding="utf-8",
cwd=self.config.cwd,
env=env,
bufsize=1,

View File

@@ -0,0 +1,38 @@
from __future__ import annotations
from typing import Any
import pytest
import codex_app_server.client as client_module
from codex_app_server.client import AppServerClient, AppServerConfig
def test_start_launches_subprocess_with_utf8_text_io(
monkeypatch: pytest.MonkeyPatch,
) -> None:
launched: dict[str, Any] = {}
class FakeProc:
stdin = None
stdout = None
stderr = None
def fake_popen(args: list[str], **kwargs: Any) -> FakeProc:
launched["args"] = args
launched["kwargs"] = kwargs
return FakeProc()
monkeypatch.setattr(client_module.subprocess, "Popen", fake_popen)
client = AppServerClient(
config=AppServerConfig(
launch_args_override=("codex", "app-server", "--listen", "stdio://")
)
)
client.start()
assert launched["args"] == ["codex", "app-server", "--listen", "stdio://"]
assert launched["kwargs"]["text"] is True
assert launched["kwargs"]["encoding"] == "utf-8"