fix(tui-gateway): expose cli.exec stdout and stderr as separate fields - #107995
Open
Jabberwocky1989 wants to merge 1 commit into
Open
Jabberwocky1989 wants to merge 1 commit into
Jabberwocky1989 wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
What does this PR do?
cli.execreturns a singleoutputstring: stdout and stderr joined with a newline. A machineconsumer that parses stdout as structured data therefore breaks as soon as anything writes to
stderr — a command emitting valid JSON on stdout plus a few warning lines on stderr yields an
outputthat cannot be parsed, even though the command exited 0.This adds
stdoutandstderras separate fields.outputis unchanged and remainsbyte-identical at its default bound, so existing callers are unaffected.
Changes Made
tui_gateway/methods_tools.py: new pure helper_cli_exec_output(r, limit=48_000)returningoutput(unchanged semantics),stdout, andstderr; the existing non-blockedcli.execbranch builds its payload from it.
tests/tui_gateway/test_cli_exec_streams.py: focused tests for split streams, empty/Nonestreams, per-field bounds incl. default-limit
outputidentity, and the exact key set.The blocked branch is untouched and still returns
blocked,hint,code,output.How to Test
scripts/run_tests.sh tests/tui_gateway/test_cli_exec_streams.py→ 4 passed.server._methods["cli.exec"]) with a real subprocess:argv ["--help"]→code 0, non-emptystdout; an unknown subcommand → non-zerocode,non-empty
stderr;argv []→ the unchanged blocked payload.Exposure and interaction with open work
can surface up to ~96,000 characters, and
stderrcan carry bytes that the combinedoutputcurrently drops once stdout fills that budget. This is a widening, not merely a re-split.
output and should cover the new fields when it lands.
possible; this change touches neither env nor credential handling.