[PR #4679] [CLOSED] [Other] handle non-UTF-8 Windows subprocess output #5135

Closed
opened 2026-11-07 16:32:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4679
Author: @dannyward630
Created: 10/30/2026
Status: ❌ Closed

Base: main ← Head: fix/issue-4675-windows-output-encoding


📝 Commits (1)

  • 0eee988 [Other] handle non-UTF-8 Windows subprocess output

📊 Changes

5 files changed (+49 additions, -11 deletions)

View changed files

📝 setup.py (+5 -3)
📝 strata_control/engine_component.py (+11 -7)
📝 tests/terminal/test_engine_component.py (+18 -0)
📝 tools/strata_mcp.py (+2 -1)
📝 tools/test_setup_amd.py (+13 -0)

📄 Description

Fixes #4675.

Problem and result

On a Chinese-locale Windows system, PowerShell emits OEM/GBK text. Python subprocess readers configured for UTF-8 can raise UnicodeDecodeError, terminate their reader threads, and leave callers with missing stdout. A replacement character in an adapter name can also block the existing name check from reaching the AMD registry's 64-bit VRAM value. This change makes subprocess decoding resilient, treats missing stdout as empty output, and keeps PCI-ID matching available when the adapter name is damaged.

#4675, a bug report. The reporter offered to test a patch on the affected Windows machine.

Approach

Use UTF-8 replacement decoding at the affected subprocess boundaries. Guard the affected output parsers against missing stdout. In AMD registry matching, preserve the name check for intact names and skip it only when the adapter name contains U+FFFD; PCI ID remains the required match.

AI assistance: Codex (GPT-6) assisted with implementation and regression tests.

Validation

Run against the PR tree on Windows with Python 3.11.9.

Passed:

  • python -m unittest tools.test_setup_amd — 55 tests passed.
  • python -m pytest tests/terminal/test_engine_component.py -q — 41 passed, 2 skipped.
  • Focused Ruff check passed with existing diagnostics E402, E741, F841, F541, and E721 excluded; the default check reports 13 diagnostics on untouched lines.
  • git diff --check passed.
  • Synthetic PowerShell CP936 pipe check returned replacement text and preserved the ASCII PCI ID.

Failed:

  • python -m unittest tools.test_strata_mcp -q — 52 tests ran; 4 failed and 2 errored in process cancellation/start-stop behavior. Those failures are outside the changed encoding paths by inspection; I did not run the base revision to establish whether they predate this patch.

Not run:

  • Native Windows 10 Simplified Chinese locale with the affected GPU: python setup.py --check and strata launch. That hardware/locale environment is unavailable here. The issue reporter offered to run these checks; please share the results before this PR leaves draft.

Limits

Replacement decoding can replace non-UTF-8 characters in subprocess text. PCI identifiers and other ASCII output remain intact, which is sufficient for the affected device detection paths.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4679 **Author:** [@dannyward630](https://github.com/dannyward630) **Created:** 10/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/issue-4675-windows-output-encoding` --- ### 📝 Commits (1) - [`0eee988`](https://github.com/Niko1221/Strata/commit/0eee9887c98d590e4868e582e16681e0a428aacd) [Other] handle non-UTF-8 Windows subprocess output ### 📊 Changes **5 files changed** (+49 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `setup.py` (+5 -3) 📝 `strata_control/engine_component.py` (+11 -7) 📝 `tests/terminal/test_engine_component.py` (+18 -0) 📝 `tools/strata_mcp.py` (+2 -1) 📝 `tools/test_setup_amd.py` (+13 -0) </details> ### 📄 Description Fixes #4675. ## Problem and result On a Chinese-locale Windows system, PowerShell emits OEM/GBK text. Python subprocess readers configured for UTF-8 can raise UnicodeDecodeError, terminate their reader threads, and leave callers with missing stdout. A replacement character in an adapter name can also block the existing name check from reaching the AMD registry's 64-bit VRAM value. This change makes subprocess decoding resilient, treats missing stdout as empty output, and keeps PCI-ID matching available when the adapter name is damaged. ## Related discussion [#4675](https://github.com/Niko1221/Strata/issues/4675), a bug report. The reporter offered to test a patch on the affected Windows machine. ## Approach Use UTF-8 replacement decoding at the affected subprocess boundaries. Guard the affected output parsers against missing stdout. In AMD registry matching, preserve the name check for intact names and skip it only when the adapter name contains U+FFFD; PCI ID remains the required match. AI assistance: Codex (GPT-6) assisted with implementation and regression tests. ## Validation Run against the PR tree on Windows with Python 3.11.9. **Passed:** - `python -m unittest tools.test_setup_amd` — 55 tests passed. - `python -m pytest tests/terminal/test_engine_component.py -q` — 41 passed, 2 skipped. - Focused Ruff check passed with existing diagnostics E402, E741, F841, F541, and E721 excluded; the default check reports 13 diagnostics on untouched lines. - `git diff --check` passed. - Synthetic PowerShell CP936 pipe check returned replacement text and preserved the ASCII PCI ID. **Failed:** - `python -m unittest tools.test_strata_mcp -q` — 52 tests ran; 4 failed and 2 errored in process cancellation/start-stop behavior. Those failures are outside the changed encoding paths by inspection; I did not run the base revision to establish whether they predate this patch. **Not run:** - Native Windows 10 Simplified Chinese locale with the affected GPU: `python setup.py --check` and `strata launch`. That hardware/locale environment is unavailable here. The issue reporter offered to run these checks; please share the results before this PR leaves draft. ## Limits Replacement decoding can replace non-UTF-8 characters in subprocess text. PCI identifiers and other ASCII output remain intact, which is sufficient for the affected device detection paths. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:32:58 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5135
No description provided.