fix(shell): don't let non-UTF-8 command output kill the playbook - #259
Merged
whotwagner merged 1 commit intoSep 7, 2026
Merged
Conversation
ShellExecutor decoded command output with a strict UTF-8 decode. Command output is arbitrary bytes, so any command emitting a non-UTF-8 byte raised UnicodeDecodeError. Nothing catches it between _exec_cmd and main(), so the exception terminates the entire playbook rather than failing the one step. Both read paths are affected: popen_noninteractive on its combined stdout+stderr, and popen_interactive on its non-blocking read. Use errors='replace' so undecodable bytes become U+FFFD and execution continues. Output is used for logging, error_if/error_if_not matching and save-to-file; none of those require a lossless round-trip, and a replacement character is strictly more useful than losing the run. Adds three regression tests, one per read path plus an end-to-end shell execution. All three fail on the strict decode and pass with the fix. Encountered with a PHP filter-chain response containing 0xc9, which ended a 40-step playbook at step 6. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FTrxUy2RcoHv723hVynSo8
whotwagner
approved these changes
Sep 5, 2026
whotwagner
requested changes
Sep 5, 2026
whotwagner
left a comment
Contributor
There was a problem hiding this comment.
Would you mind to make this pull request for the development branch?
Author
|
Hey there! Just changed the branch to development! I have a few more features that I'm working on coming in soon haha |
Contributor
nice. i am looking forward |
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.
ShellExecutor decoded command output with a strict UTF-8 decode. Command output is arbitrary bytes, so any command emitting a non-UTF-8 byte raised UnicodeDecodeError. Nothing catches it between _exec_cmd and main(), so the exception terminates the entire playbook rather than failing the one step.
Both read paths are affected: popen_noninteractive on its combined stdout+stderr, and popen_interactive on its non-blocking read.
Use errors='replace' so undecodable bytes become U+FFFD and execution continues. Output is used for logging, error_if/error_if_not matching and save-to-file; none of those require a lossless round-trip, and a replacement character is strictly more useful than losing the run.
Adds three regression tests, one per read path plus an end-to-end shell execution. All three fail on the strict decode and pass with the fix.
Encountered with a PHP filter-chain response containing 0xc9, which ended a 40-step playbook at step 6.
Task
Description
How Has This Been Tested?
Checklist