Skip to content

Pin Python SDK app-server stdio to UTF-8 on Windows#15244

Merged
shaqayeq-oai merged 2 commits intomainfrom
dev/shaqayeq/python-sdk-windows-utf8-encoding
Mar 20, 2026
Merged

Pin Python SDK app-server stdio to UTF-8 on Windows#15244
shaqayeq-oai merged 2 commits intomainfrom
dev/shaqayeq/python-sdk-windows-utf8-encoding

Conversation

@shaqayeq-oai
Copy link
Collaborator

TL;DR

Pin the Python app-server SDK subprocess pipes to UTF-8 so Windows users on non-UTF-8 locales do not hit UnicodeDecodeError when the codex child emits UTF-8 text.

  • add encoding="utf-8" to the subprocess.Popen(...) call in AppServerClient.start()
  • add a focused regression test that asserts the client launches the subprocess with UTF-8 text I/O
  • validates with python -m pytest sdk/python/tests/test_client_rpc_methods.py sdk/python/tests/test_client_process_launch.py sdk/python/tests/test_public_api_runtime_behavior.py

Fixes #14311.

@shaqayeq-oai shaqayeq-oai added the oai PRs contributed by OpenAI employees label Mar 20, 2026
from codex_app_server.client import AppServerClient, AppServerConfig


def test_start_launches_subprocess_with_utf8_text_io(
Copy link
Collaborator

@owenlin0 owenlin0 Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i find that codex can add tests that are not super high signal. imo this is one of them (just asserting that we pass encoding = "utf-8" to Popen)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea i agree. will remove

@shaqayeq-oai shaqayeq-oai enabled auto-merge (squash) March 20, 2026 18:25
@shaqayeq-oai shaqayeq-oai merged commit 9e31aea into main Mar 20, 2026
18 checks passed
@shaqayeq-oai shaqayeq-oai deleted the dev/shaqayeq/python-sdk-windows-utf8-encoding branch March 20, 2026 18:26
@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[codex-app-server Python SDK] UnicodeDecodeError with Popen(text=True) on non-ASCII Windows locales

2 participants