fix: add encoding='utf-8' to subprocess calls with text=True - #53549
Closed
AlexFucuson9 wants to merge 1 commit into
Closed
fix: add encoding='utf-8' to subprocess calls with text=True#53549AlexFucuson9 wants to merge 1 commit into
AlexFucuson9 wants to merge 1 commit into
Conversation
On non-UTF-8 Windows locales (e.g. CP936/GBK), subprocess.run/Popen with text=True but no explicit encoding crashes _readerthread when child outputs UTF-8 text: UnicodeDecodeError: 'gbk' codec can't decode byte 0xae This triggers cascading failure: pipe buffers fill → event loop stalls → ws write slow → TUI freezes → gateway restarts. Fix by adding encoding='utf-8', errors='replace' to all 22 bare text=True subprocess calls across 13 files. Fixes NousResearch#53428
Contributor
|
Closing as superseded by the consolidated Windows console-flash work tracked in #54220. The relevant pieces from this PR/cluster have now landed through the targeted follow-up PRs #54236, #53892, and #54417, or are recorded in the umbrella tracker for any remaining native-Windows verification. Keeping this separate PR open would duplicate the tracker and the merged follow-up work. Thanks for digging into this — the reports and PRs in this cluster helped identify the remaining spawn legs. |
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.
Bug
On non-UTF-8 Windows locales (e.g. CP936/GBK),
subprocess.run/Popenwithtext=Truebut no explicitencodingcrashes_readerthreadwhen child outputs UTF-8 text:This triggers cascading failure: pipe buffers fill → event loop stalls →
ws write slow→ TUI freezes → gateway restarts.Fix
Add
encoding='utf-8', errors='replace'to all 22 baretext=Truesubprocess calls across 13 files:tui_gateway/server.py(4)tui_gateway/git_probe.py(1)agent/lsp/install.py(3)agent/anthropic_adapter.py(2)agent/context_references.py(2)agent/secret_sources/bitwarden.py(2)agent/copilot_acp_client.py(1)agent/skill_preprocessing.py(1)agent/coding_context.py(1)agent/transports/codex_app_server.py(1)agent/shell_hooks.py(1)gateway/status.py(2)gateway/shutdown_forensics.py(1)Fixes #53428