Conversation
On Japanese-locale Windows (ANSI cp932), subprocess.run(text=True) decodes pipes as cp932/strict. Window titles containing non-cp932 bytes (e.g. "#vrc写真 | Concord - Discord") kill the reader thread with UnicodeDecodeError, leaving proc.stdout as None and causing the whole CLI fallback transport to report "got no JSON" despite the driver emitting valid UTF-8 JSON. Fix all three subprocess.run call sites with encoding="utf-8", errors="replace": - _resolve_mcp_invocation (manifest probe) - cua_driver_update_check - _CuaDriverSession._call_tool_via_cli Also fix TestCuaDriverSessionReconnect to build the FakeProc.stdout JSON payload via json.dumps() so Windows backslash paths are properly escaped and the test passes on Windows hosts. Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
|
Thanks for the focused Windows fix. The three Problems
Suggested changes
Automated hermes-sweeper review. |
Collaborator
|
Closing with credit — UTF-8 subprocess decoding is already implemented on main: every cua subprocess call site now passes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
subprocess.run(text=True)decodes pipes as cp932/strict. Any window title containing non-cp932 bytes (e.g.#vrc写真 | Concord - Discord) kills the reader thread withUnicodeDecodeError: 'cp932' codec can't decode byte 0x94,proc.stdoutbecomes None, and the whole CLI fallback transport reports "got no JSON" even though cua-driver emitted valid UTF-8 JSON (verified by redirecting the same call to a file).subprocess.runcall sites withencoding="utf-8", errors="replace":_resolve_mcp_invocation(manifest probe),cua_driver_update_check, and_CuaDriverSession._call_tool_via_cli.scripts/check-windows-footguns.pyfor file I/O. Cross-platform impact: none — cua-driver always emits UTF-8.TestCuaDriverSessionReconnect.test_cli_fallback_reads_screenshot_from_fileto build the FakeProc.stdout JSON payload viajson.dumps()so Windows backslash paths are properly escaped and the test passes on Windows hosts.Test plan
PYTHONUTF8=1 uv run --extra dev python -m pytest tests/tools/test_computer_use.py -q:(){ :|: & };:fork bomb pattern test, Windows-only EventLoop teardown issue)uv run --extra dev python scripts/check-windows-footguns.py tools/computer_use/cua_backend.py#vrc写真channel visible — no UnicodeDecodeError, full JSON returnedPart of a series
fix(tools): decode cua-driver subprocess output as UTF-8(this PR)fix(tools): surface cua-driver UIA-timeout errors instead of retrying CLI transportfix(tools): bound get_window_state UIA walk and re-fetch dropped som/ax screenshots via CLICo-Authored-By: Claude noreply@anthropic.com