Skip to content

fix(python-sdk): preserve connect stream events#1396

Draft
cyq1017 wants to merge 1 commit into
e2b-dev:mainfrom
cyq1017:codex/e2b-1352-connect-stdout-spark
Draft

fix(python-sdk): preserve connect stream events#1396
cyq1017 wants to merge 1 commit into
e2b-dev:mainfrom
cyq1017:codex/e2b-1352-connect-stdout-spark

Conversation

@cyq1017

@cyq1017 cyq1017 commented Jun 6, 2026

Copy link
Copy Markdown

Fixes #1352

Problem

commands.connect(pid) can receive stream output before the start event. The Python SDK consumed those non-start events while waiting for start, so early stdout/stderr frames were dropped from the returned command handle.

Changes

  • Buffer non-start connect events before the first start event in sync and async Python Commands.connect.
  • Replay buffered events into the command handle stream after start is established.
  • Add local fake-stream regressions for sync and async connect paths.

Verification

  • uvx poetry run pytest tests/async/sandbox_async/commands/test_cmd_connect_stream.py tests/sync/sandbox_sync/commands/test_cmd_connect_stream.py -q
  • uvx poetry run ruff check e2b/sandbox_async/commands/command.py e2b/sandbox_sync/commands/command.py tests/async/sandbox_async/commands/test_cmd_connect_stream.py tests/sync/sandbox_sync/commands/test_cmd_connect_stream.py
  • uvx poetry run ruff format --check e2b/sandbox_async/commands/command.py e2b/sandbox_sync/commands/command.py tests/async/sandbox_async/commands/test_cmd_connect_stream.py tests/sync/sandbox_sync/commands/test_cmd_connect_stream.py
  • git diff HEAD^..HEAD --check

Note: scoped to Python SDK connect-stream replay; no hosted E2B sandbox was used.

@cla-bot

cla-bot Bot commented Jun 6, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @cyq1017 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 Jun 6, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ed63468

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

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.

commands.connect to a resumed sandbox stops delivering stdout after a large response

2 participants