Skip to content

chore(sdk): remove dead empty-chunk guards from command handles - #1962

Merged
mishushakov merged 1 commit into
mainfrom
devin/1791477862-remove-empty-chunk-guards
Oct 8, 2026
Merged

mishushakov merged 1 commit into
mainfrom
devin/1791477862-remove-empty-chunk-guards

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

envd never sends an empty stdout/stderr/pty data event. Every output reader in envd (go/oss/envd/internal/services/process/handler/handler.go and readopt.go pump) only sends when if n > 0. So the SDKs' empty-chunk handling is dead code. This PR removes it instead of adding the same guard to JS, which is what #1959 does.

  • Python (sync and async): case Oneof(field="stdout"|"stderr"|"pty", value=chunk) if chunk: becomes case Oneof(...). The if out: check after decoding stays, because the incremental UTF-8 decoder can hold back a partial sequence and return "".
  • JS: drop // TODO: Handle empty events like in python SDK from commandHandle.ts.

This doesn't change behavior. Checked against a live sandbox (envd 0.6.10) using a JS SDK build without any guard: about 31 MB of PTY output across 20,013 chunks, plus fast-exiting and killed PTYs and a disconnect then reconnect mid-output. No empty chunk arrived.

Supersedes #1959.

Link to Devin session: https://app.devin.ai/sessions/87bf545f4b8a47ecb0f8083f9cae2e9a
Open in Devin Desktop: https://app.devin.ai/desktop/session/87bf545f4b8a47ecb0f8083f9cae2e9a?variant=devin
Requested by: @mishushakov

Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@cla-bot cla-bot Bot added the cla-signed label Oct 8, 2026
@changeset-bot

changeset-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2b39a87

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

This PR includes changesets to release 2 packages
Name Type
e2b Patch
@e2b/python-sdk Patch

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TASTE.md review: 0 violations. Checked T-1/T-2 (JS ↔ sync/async Python parity, which this PR restores: none of the three handles guards raw chunks, all three skip empty decoded stdout/stderr) and T-29 (incremental UTF-8 decoding, raw PTY bytes). No public API surface changed.

Written by Devin

@mishushakov
mishushakov marked this pull request as ready for review October 8, 2026 16:46
@mishushakov
mishushakov self-requested a review as a code owner October 8, 2026 16:46
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from e0ad9a3. Download artifacts from this workflow run.

JS SDK (e2b@2.54.1-devin-1791477862-remove-empty-chunk-guards.0, with @e2b/dockerfile-utils@0.1.1-devin-1791477862-remove-empty-chunk-guards.0):

npm install ./e2b-dockerfile-utils-0.1.1-devin-1791477862-remove-empty-chunk-guards.0.tgz ./e2b-2.54.1-devin-1791477862-remove-empty-chunk-guards.0.tgz

CLI (@e2b/cli@2.21.2-devin-1791477862-remove-empty-chunk-guards.0):

npm install ./e2b-cli-2.21.2-devin-1791477862-remove-empty-chunk-guards.0.tgz

Code Interpreter JS SDK (@e2b/code-interpreter@2.8.3-devin-1791477862-remove-empty-chunk-guards.0):

npm install ./e2b-code-interpreter-2.8.3-devin-1791477862-remove-empty-chunk-guards.0.tgz

Desktop JS SDK (@e2b/desktop@2.4.1-devin-1791477862-remove-empty-chunk-guards.0):

npm install ./e2b-desktop-2.4.1-devin-1791477862-remove-empty-chunk-guards.0.tgz

Python SDK (e2b==2.54.0+devin.1791477862.remove.empty.chunk.guards, with e2b-dockerfile-utils==0.1.0+devin.1791477862.remove.empty.chunk.guards):

pip install ./e2b_dockerfile_utils-0.1.0+devin.1791477862.remove.empty.chunk.guards-py3-none-any.whl ./e2b-2.54.0+devin.1791477862.remove.empty.chunk.guards-py3-none-any.whl

Code Interpreter Python SDK (e2b-code-interpreter==2.10.3+devin.1791477862.remove.empty.chunk.guards):

pip install ./e2b_code_interpreter-2.10.3+devin.1791477862.remove.empty.chunk.guards-py3-none-any.whl

Desktop Python SDK (e2b-desktop==2.6.1+devin.1791477862.remove.empty.chunk.guards):

pip install ./e2b_desktop-2.6.1+devin.1791477862.remove.empty.chunk.guards-py3-none-any.whl

@mishushakov
mishushakov enabled auto-merge (squash) October 8, 2026 16:47

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread packages/python-sdk/e2b/sandbox_sync/commands/command_handle.py
@mishushakov
mishushakov disabled auto-merge October 8, 2026 16:52

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I reviewed this PR and didn't find any bugs. Because it touches command output streaming across both the Python and JS SDKs, a human look would still be worthwhile.

What was reviewed:

  • Python sync/async CommandHandle generators: removed if chunk guards on stdout/stderr/pty Oneof matches; stdout/stderr still filter empty decoded output via if out.
  • pty branch no longer has an explicit emptiness check — checked against JS's existing commandHandle.ts, which already yields pty chunks unconditionally, so this makes Python consistent with pre-existing JS behavior rather than introducing new behavior.
  • Changeset added for 'e2b' and '@ e2b/python-sdk' matches the repo convention requiring one for SDK public-surface changes.
Extended reasoning...

The change removes redundant if chunk truthiness guards from the Python sync/async CommandHandle generators' output pattern matches, deletes a now-stale TODO comment in the JS SDK, and adds a required changeset for 'e2b' and '@ e2b/python-sdk'. It touches command output streaming (stdout/stderr/pty) but not auth, crypto, or permissions. The Python pty branch no longer has any emptiness check, but the JS commandHandle.ts already yields pty chunks unconditionally today, so the change aligns Python with existing JS behavior rather than diverging from it. No automated tests were added; the PR description cites manual verification against a live sandbox (~20k chunks) observing no empty chunks.

@mishushakov
mishushakov enabled auto-merge (squash) October 8, 2026 17:19
@mishushakov
mishushakov merged commit 0894595 into main Oct 8, 2026
75 of 85 checks passed
@mishushakov
mishushakov deleted the devin/1791477862-remove-empty-chunk-guards branch October 8, 2026 17:25
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