Skip to content

feat(python-sdk): mirror async result accessors on the sync CommandHandle - #1891

Open
Atishyy27 wants to merge 2 commits into
e2b-dev:mainfrom
Atishyy27:fix-sync-commandhandle-accessors
Open

Atishyy27 wants to merge 2 commits into
e2b-dev:mainfrom
Atishyy27:fix-sync-commandhandle-accessors

Conversation

@Atishyy27

Copy link
Copy Markdown

Summary

AsyncCommandHandle and the JS CommandHandle expose stdout, stderr, error and exit_code as public accessors. The sync CommandHandle exposes only pid, even though it already stores all four values internally (_stdout_chunks, _stderr_chunks, _result). AGENTS.md asks for JS + sync + async parity, so this mirrors the async twin's four properties on the sync handle.

To be clear on scope: the values are already reachable from wait()'s return value and from CommandExitException on the non-zero path, so this is a consistency and ergonomics change for people moving between the sync and async handles, not a correctness fix.

Change

Add stdout, stderr, error and exit_code to the sync CommandHandle, identical to AsyncCommandHandle including the "None while the command is still running" contract. Existing methods are unchanged.

Testing

Added test_sync_command_handle_exposes_result_accessors in tests/test_command_handle.py, hermetic (in-memory events, no sandbox or API key). Run with uv run pytest tests/test_command_handle.py.

AI-WATERMARK

yes

  • Tools: Claude Code
  • Model(s): Claude
  • Scope: the four accessor properties (mirrored from the async twin) and the unit test
  • Human verification: checked against sandbox_async/commands/command_handle.py and js-sdk/src/sandbox/commands/commandHandle.ts

…ndle

AsyncCommandHandle and the JS CommandHandle expose stdout, stderr, error and
exit_code; the sync CommandHandle exposed only pid despite already storing all
four values. Add the four properties, identical to the async twin, for
sync/async/JS parity (AGENTS.md). The values are already reachable via wait()
and CommandExitException, so this is a consistency change, not a correctness fix.
Adds a hermetic unit test.
@cla-bot

cla-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @Atishyy27 on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check'

@changeset-bot

changeset-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d53f8df

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@e2b/python-sdk Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Atishyy27

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label Sep 22, 2026
@cla-bot

cla-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant