fix(extensions): preserve subprocess errors for non-UTF8 stderr - #5186
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
markstuart-oai
left a comment
There was a problem hiding this comment.
Reviewed at 450788d3d5c0d585a37b00d4b0a7a00d33066fb5. The replacement decode is in the existing nonzero-exit path after stderr is fully collected, so invalid bytes no longer mask the exit code while valid UTF-8 remains intact. The captured CP950 regression exercises both public run methods and checks the caller-visible error; the ASCII/UTF-8 controls preserve exact diagnostics. No blocking findings.
Verified all 22 hosted checks passed on this commit, including Windows tests. This was a source review; I did not run local tests or independently reproduce the native Windows npm-shim failure.
This pull request fixes Codex subprocess error reporting when stderr contains non-UTF-8 bytes, as reported for the Windows npm shim in #5185.
Summary
Decode stderr with replacement on nonzero exit so callers receive
RuntimeErrorwith the exit code and readable diagnostic text instead ofUnicodeDecodeError. Valid UTF-8 diagnostics remain intact; undecodable bytes become replacement characters.The regression uses the captured CP950 diagnostic from #5185 through both
Thread.run()andThread.run_streamed(), with ASCII and UTF-8 controls. Scope is limited to failure stderr decoding.Test plan
UnicodeDecodeError.Issue number
Closes #5185
Checks
.agents/skills/code-change-verification/scripts/run.sh/reviewbefore submitting this PR