Repository navigation
chore(sdk): remove dead empty-chunk guards from command handles - #1962
Conversation
Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
🦋 Changeset detectedLatest commit: 2b39a87 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
There was a problem hiding this comment.
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.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Package ArtifactsBuilt from e0ad9a3. Download artifacts from this workflow run. JS SDK ( 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.tgzCLI ( npm install ./e2b-cli-2.21.2-devin-1791477862-remove-empty-chunk-guards.0.tgzCode Interpreter JS SDK ( npm install ./e2b-code-interpreter-2.8.3-devin-1791477862-remove-empty-chunk-guards.0.tgzDesktop JS SDK ( npm install ./e2b-desktop-2.4.1-devin-1791477862-remove-empty-chunk-guards.0.tgzPython SDK ( 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.whlCode Interpreter Python SDK ( pip install ./e2b_code_interpreter-2.10.3+devin.1791477862.remove.empty.chunk.guards-py3-none-any.whlDesktop Python SDK ( pip install ./e2b_desktop-2.6.1+devin.1791477862.remove.empty.chunk.guards-py3-none-any.whl |
There was a problem hiding this comment.
Devin Review found 1 potential issue.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
There was a problem hiding this comment.
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 chunkguards on stdout/stderr/pty Oneof matches; stdout/stderr still filter empty decoded output viaif 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.
Summary
envd never sends an empty
stdout/stderr/ptydata event. Every output reader in envd (go/oss/envd/internal/services/process/handler/handler.goandreadopt.gopump) only sends whenif 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.case Oneof(field="stdout"|"stderr"|"pty", value=chunk) if chunk:becomescase Oneof(...). Theif out:check after decoding stays, because the incremental UTF-8 decoder can hold back a partial sequence and return"".// TODO: Handle empty events like in python SDKfromcommandHandle.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