Repository navigation
fix(local-env): keep timeout output as text and preserve stderr - #252
Open
Ricardo-M-L wants to merge 1 commit into
Open
Ricardo-M-L wants to merge 1 commit into
Ricardo-M-L wants to merge 1 commit into
Conversation
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.
Problem
With
--enable_local_env, a Bash command that times out returnsTimeoutExpired.stdoutdirectly. Python retains this as bytes even whensubprocess.run(text=True)was requested. The local controller therefore changes the type ofoutputon timeout,json.dumps(result)fails withTypeError, and partial stderr (often the useful failure diagnostic) is lost.For example, a bounded Bash script that prints to both streams and then loops returns a byte-valued stdout and no stderr before this change.
Fix
Decode captured timeout bytes with the subprocess's locale text encoding and
errors="replace"(a timeout may cut a character mid-write), then combine stdout and stderr just as the completed-process path does. Already-text and missing captures are preserved. Status, return code, timeout and error metadata are unchanged; no execution-policy or Python-runner changes.Verification
b'stdout'instead of text containing both streams.tests/discovery: 11 passed using Python 3.12 with the provider tests' lightweight imports (numpy,backoff,anthropic,openai). No API/model calls.black --check gui_agents agent_s4passes (136 files), touched test formatting andgit diff --checkpass.Commands:
The real Bash case is skipped when
/bin/bashis absent; no Windows integration execution is claimed. No model/OCR dependencies were downloaded for these checks.AI assistance: Codex helped implement and repeatedly verify this focused fix. Duplicate search included existing local-execution hardening #209, whose timeout branch still returns the same raw bytes; this patch does not add its Docker/execution-policy features.
Hosted validation status — 2026-11-01
The lint workflow is
action_requiredfor this fork. The local test/format results above do not imply hosted CI passed. Could a maintainer approve the workflow when reviewing this fix?