Skip to content

Preserve stdout in CLI failure errors - #6

Open
abhinavgautam01 wants to merge 1 commit into
Maxed-OSS:mainfrom
abhinavgautam01:fix/wrap-cli-stdout-on-failure
Open

Preserve stdout in CLI failure errors#6
abhinavgautam01 wants to merge 1 commit into
Maxed-OSS:mainfrom
abhinavgautam01:fix/wrap-cli-stdout-on-failure

Conversation

@abhinavgautam01

Copy link
Copy Markdown

Fixes #2

Summary

Fixes _wrap_cli so fallback command_failed responses preserve useful stdout context when a backing CLI exits with an error.

Previously, _wrap_cli parsed stderr for structured error envelopes, but if stderr was not valid JSON it returned a generic command_failed response and discarded stdout entirely. Some CLIs print hints, diagnostics or relevant failure details to stdout, so dropping it made failures harder for MCP clients and agents to debug.

Changes

  • Include bounded stdout in fallback command_failed error details when present
  • Keep existing structured stderr error-envelope behavior unchanged
  • Add a regression test covering stdout preservation on CLI failure

Validation

  • PYTHONPATH=src pytest -q
  • python3 -m compileall -q src tests
  • git diff --check
  • CI denylist guard scan
  • CI secret-pattern scan

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_wrap_cli Drops Useful Stdout Details on Command Failure

1 participant