Skip to content

fix(tui-gateway): expose cli.exec stdout and stderr as separate fields - #107995

Open
Jabberwocky1989 wants to merge 1 commit into
NousResearch:mainfrom
Jabberwocky1989:fix/cli-exec-structured-streams
Open

Jabberwocky1989 wants to merge 1 commit into
NousResearch:mainfrom
Jabberwocky1989:fix/cli-exec-structured-streams

Conversation

@Jabberwocky1989

Copy link
Copy Markdown

What does this PR do?

cli.exec returns a single output string: stdout and stderr joined with a newline. A machine
consumer 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
output that cannot be parsed, even though the command exited 0.

This adds stdout and stderr as separate fields. output is unchanged and remains
byte-identical at its default bound, so existing callers are unaffected.

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • tui_gateway/methods_tools.py: new pure helper _cli_exec_output(r, limit=48_000) returning
    output (unchanged semantics), stdout, and stderr; the existing non-blocked cli.exec
    branch builds its payload from it.
  • tests/tui_gateway/test_cli_exec_streams.py: focused tests for split streams, empty/None
    streams, per-field bounds incl. default-limit output identity, and the exact key set.

The blocked branch is untouched and still returns blocked, hint, code, output.

How to Test

  1. scripts/run_tests.sh tests/tui_gateway/test_cli_exec_streams.py → 4 passed.
  2. Drive the registered handler (server._methods["cli.exec"]) with a real subprocess:
    argv ["--help"] → code 0, non-empty stdout; an unknown subcommand → non-zero code,
    non-empty stderr; argv [] → the unchanged blocked payload.

Exposure and interaction with open work

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Sep 11, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants