Skip to content

Add stdout to command execution results#32

Merged
vijit-lark merged 1 commit intomainfrom
vd-add-stdout-to-command-result
Apr 19, 2026
Merged

Add stdout to command execution results#32
vijit-lark merged 1 commit intomainfrom
vd-add-stdout-to-command-result

Conversation

@vijit-lark
Copy link
Copy Markdown
Contributor

@vijit-lark vijit-lark commented Apr 19, 2026

Summary

  • Capture buffered stdout from CommandHandler.execute() and include it in CommandResult so the full command output is available in the final result, not just via the real-time streaming callbacks.
  • Thread the new stdout field through the wire protocol (CommandExecutionResultItem) and the Python client (CommandResultItem).
  • Bump both runtimeuse and runtimeuse-client to 0.12.0.

Test plan

  • TypeScript unit tests pass (npm test — 143 tests)
  • Python unit tests pass (pytest test/test_client.py — 44 tests)
  • E2E tests pass (pytest test -m e2e — 36 tests)
  • E2B sandbox tests (require E2B_API_KEY)

Made with Cursor


Note

Medium Risk
Changes the command execution wire protocol and result types to include buffered stdout, which may affect clients expecting the old schema and increases returned payload size. Logic is straightforward but touches runtime execution and cross-language compatibility (TS server + Python client).

Overview
Command-only execution results now include buffered stdout. CommandHandler.execute() captures the final stdout (with secret redaction) and returns it alongside exitCode, and InvocationRunner.runCommandsOnly threads this through the command_execution_result_message payload.

The wire type CommandExecutionResultItem and the Python client model CommandResultItem add an optional stdout field, with tests updated/added to assert stdout presence on success and absence on failures. Package versions are bumped to 0.12.0 in both runtimeuse and runtimeuse-client.

Reviewed by Cursor Bugbot for commit ccdcc96. Bugbot is set up for automated code reviews on this repo. Configure here.

Include the buffered stdout from executed commands in the
CommandResult / CommandExecutionResultItem so callers can access the
full output alongside exitCode, not just the real-time stream.

Bump both packages to 0.12.0.

Made-with: Cursor
@vijit-lark vijit-lark merged commit 9bcb5e0 into main Apr 19, 2026
6 checks passed
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ccdcc96. Configure here.

signal: this.abortController.signal,
},
(error, stdout, stderr) => {
capturedStdout = stdout;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error path resolves without stdout, losing captured output

Medium Severity

When a command fails (non-zero exit code), exec's callback fires with an error and the Promise resolves at line 61 with { exitCode: code, error } — omitting stdout. Since Node.js execFile internally registers its close handler before the external one, the error resolve fires first, and the subsequent close handler's resolve (which does include stdout) becomes a no-op. This means any command that produces output before failing (e.g. a build tool that prints logs then exits non-zero) will have its stdout silently discarded from CommandResult, despite capturedStdout being correctly set on the line above.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ccdcc96. Configure here.

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.

1 participant