Repository navigation
feat(cli): stream terminal input over a single StreamInput RPC - #2005
Conversation
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
🦋 Changeset detectedLatest commit: 9314a93 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Package ArtifactsBuilt from 0001f07. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-dockerfile-utils-0.1.2-devin-1792509319-cli-stream-input.0.tgz ./e2b-2.57.1-devin-1792509319-cli-stream-input.0.tgzCLI ( npm install ./e2b-cli-2.22.3-devin-1792509319-cli-stream-input.0.tgzCode Interpreter JS SDK ( npm install ./e2b-code-interpreter-2.9.1-devin-1792509319-cli-stream-input.0.tgzDesktop JS SDK ( npm install ./e2b-desktop-2.5.1-devin-1792509319-cli-stream-input.0.tgzPython SDK ( pip install ./e2b_dockerfile_utils-0.1.1+devin.1792509319.cli.stream.input-py3-none-any.whl ./e2b-2.57.0+devin.1792509319.cli.stream.input-py3-none-any.whlCode Interpreter Python SDK ( pip install ./e2b_code_interpreter-2.11.1+devin.1792509319.cli.stream.input-py3-none-any.whlDesktop Python SDK ( pip install ./e2b_desktop-2.7.0+devin.1792509319.cli.stream.input-py3-none-any.whl |
There was a problem hiding this comment.
TASTE.md review: complies, 0 violations. The diff only changes CLI internals (packages/cli/src/terminal.ts) plus a changeset, and uses the SDK's pty.streamInput handle the way it was designed; I checked it against the parity, API-shape, streaming/handle, timeout (T-44 to T-48) and error rules. The streamInput/close() surface comes from the base PR (#1997), so I didn't judge it here.
d4c35ac to
5732cc7
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5732cc7fe6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
5732cc7 to
382d6bd
Compare
Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
Summary
e2b sandbox connect/createnow send terminal input over one long-livedsandbox.pty.streamInput(pid, { timeoutMs: 0 })stream instead of theBatchedQueuethat polled every 10ms and issued onepty.sendInputrequest per batch.The stream is recoverable: a failed stream (network blip, proxy reset) doesn't drop all later keystrokes; only input already queued on the failed stream is lost, like a single lost
sendInputbatch before.StreamInputexists in every versioned envd (since June 2024), so there's no fallback tosendInput.Also fixes cleanup: the old code called
.destroy()on the return value ofprocess.stdout.on(...)/process.stdin.on(...)(the streams themselves); listeners are now removed with.off().Benchmark
Same sandbox,
stty raw -echo; exec catin a PTY, 3 interleaved rounds per mode, old = exact copy of the previousBatchedQueue+sendInputpath, new =streamInput(JS SDK, HTTP/2, from the Devin VM):~10ms (~15%) lower per-keystroke latency (the 10ms poll + per-request overhead); the new path sits at roughly one network round trip.
Unit tests in
packages/cli/tests/terminal.test.ts(ordering, reopen/resend, single error report, cleanup). Smoke-tested live: built CLI in a real PTY,sbx create, typed a command, output echoed,exitreturned 0 with no errors.Link to Devin session: https://app.devin.ai/sessions/b4127fd7a10a4ff49794bf096af5ef7c
Open in Devin Desktop: https://app.devin.ai/desktop/session/b4127fd7a10a4ff49794bf096af5ef7c?variant=devin
Requested by: @mishushakov