Repository navigation
fix(js-sdk): snapshot queued Buffer input bytes - #2152
Elon-Jiang wants to merge 1 commit into
Conversation
Codex Review Summary: ✅ CompletedThis 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. |
🦋 Changeset detectedLatest commit: e5fc29b 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 |
There was a problem hiding this comment.
TASTE.md review (checked T-1/T-2 parity, T-17 input types, T-19 data typing, T-26 handles, T-59/T-62 errors): 0 violations. The internal new Uint8Array(data) copy leaves the public surface unchanged, and Python's send is typed Union[str, bytes] (immutable), so no sync/async mirror is needed.
Summary
Queued command/PTY input already snapshots
Uint8Arraydata, but Node.jsBuffer.slice()returns a view. Reusing a Buffer aftersend()therefore changes bytes that have not yet been transmitted.Copy with
new Uint8Array(data)instead of calling the input'sslice()method. Keep ordering, strings, keepalives and close/error handling unchanged. Add a patch changeset.Validation
c4bab34and passes with the one-line fix.pnpm run format,pnpm run lint,pnpm run typecheck(including SDK builds), andgit diff --check: passed. Four lint warnings are in untouched files.The regressions use public
Sandbox.connect('offline-sandbox', {debug:true}), command/PTYstreamInput,sendandclose, with the actual SDK and Connect JSON request encoding. A gated fetch-boundary fixture consumes encoded request bytes and supplies the envd acknowledgement. No live cloud sandbox or guest process was used. Coverage includes ordinary/sliced/binary Buffers, plain Uint8Array and string controls for both input kinds.Python sync/async APIs accept immutable
str/bytes; they have no Node Buffer slice counterpart. No Python change or new guide/API workflow is needed to restore this existing snapshot behavior.Related: streamInput was introduced in #1997 for SDK-393. Current open PR files, behavioral/symbol searches and complete path history were checked for overlap.
AI assistance: OpenAI Codex prepared the patch and ran validation.