Skip to content

fix: prevent Windows subprocess output decode crashes - #510

Merged
Bill-Billion merged 3 commits into
shareAI-lab:mainfrom
xiarimr:fix-windows-encoding-crash
Aug 25, 2026
Merged

fix: prevent Windows subprocess output decode crashes#510
Bill-Billion merged 3 commits into
shareAI-lab:mainfrom
xiarimr:fix-windows-encoding-crash

Conversation

@xiarimr

@xiarimr xiarimr commented Aug 11, 2026

Copy link
Copy Markdown

Problem

subprocess.run and subprocess.Popen decode text output with the platform's active encoding and strict error handling by default. On Windows, mixed or malformed command output can therefore raise UnicodeDecodeError; the original UTF-8-to-GBK fallback still raised for bytes invalid in both codecs and only covered s07.

Solution

  • Keep subprocesses in text mode and use the platform's active encoding with errors="replace".
  • Apply the policy consistently to all 42 text-output calls in the lessons, reference agents, and Agent Builder templates.
  • Refresh the generated course source snapshot.
  • Add regression coverage for UTF-8, GBK, invalid stdout/stderr bytes, empty output, timeouts, and future policy omissions.

Verification

  • python -m pytest tests -q: 287 passed, 100 subtests passed
  • Python 3.11 compile check: passed
  • npm run build: passed
  • Real API tool-use loop: invalid subprocess output became , message roles remained valid, and the model completed normally

@Bill-Billion Bill-Billion changed the title fix(s07): resolve Windows subprocess UnicodeDecodeError with UTF-8/GBK fallback fix: prevent Windows subprocess output decode crashes Aug 25, 2026
@Bill-Billion

Copy link
Copy Markdown
Collaborator

Thanks for identifying and reproducing the Windows decoding failure. I merged the latest main and extended the fix across all lesson and reference subprocess paths, with regression coverage and full Python, web-build, and real-model verification now passing.

@Bill-Billion
Bill-Billion merged commit 0448620 into shareAI-lab:main Aug 25, 2026
3 of 5 checks passed
@xiarimr
xiarimr deleted the fix-windows-encoding-crash branch August 30, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants