Repository navigation
[v3-3-test] Fix short-read handling in task-sdk IPC framing (#69253) - #71609
Merged
Merged
Conversation
1 task done
ashb
approved these changes
Aug 14, 2026
Stream sockets are not required to return the full requested count from recv(), but the 4-byte length prefix on the supervisor↔subprocess socket was read with a single sock.recv(4). On a short read, the parsed length is garbage, which either raises msgspec.DecodeError in the subprocess or silently deadlocks the supervisor's selector reader (length_needed=0 makes the falsy payload check skip forever, so no frame is ever dispatched to handle_requests). Accumulate the header bytes on both sides, mirroring the payload accumulation that was already correct. Add regression tests using a socket that returns 2 bytes at a time to reliably reproduce the short read. (cherry picked from commit f72e6c9) Co-authored-by: Andrew Chang <[email protected]>
potiuk
marked this pull request as ready for review
August 17, 2026 12:32
potiuk
force-pushed
the
backport-f72e6c9-v3-3-test
branch
from
August 17, 2026 12:32
c66e512 to
33b7e46
Compare
potiuk
approved these changes
Aug 17, 2026
potiuk
left a comment
Member
There was a problem hiding this comment.
Rebased onto the current v3-3-test tip; the backport replays cleanly and the tests and prek hooks it touches pass locally against this branch.
Scope-checked for a maintenance branch: this is a bugfix / documentation / dev-tooling change, with no new user-facing behaviour.
Drafted-by: Claude Code (Opus 5) (no human review before posting)
Contributor
Author
|
Hi maintainer, this PR was merged without a milestone set.
|
vatsrahul1001
pushed a commit
that referenced
this pull request
Sep 7, 2026
…71609) Stream sockets are not required to return the full requested count from recv(), but the 4-byte length prefix on the supervisor↔subprocess socket was read with a single sock.recv(4). On a short read, the parsed length is garbage, which either raises msgspec.DecodeError in the subprocess or silently deadlocks the supervisor's selector reader (length_needed=0 makes the falsy payload check skip forever, so no frame is ever dispatched to handle_requests). Accumulate the header bytes on both sides, mirroring the payload accumulation that was already correct. Add regression tests using a socket that returns 2 bytes at a time to reliably reproduce the short read. (cherry picked from commit f72e6c9) Co-authored-by: Andrew Chang <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stream sockets are not required to return the full requested count from
recv(), but the 4-byte length prefix on the supervisor↔subprocess socket
was read with a single sock.recv(4). On a short read, the parsed length
is garbage, which either raises msgspec.DecodeError in the subprocess or
silently deadlocks the supervisor's selector reader (length_needed=0
makes the falsy payload check skip forever, so no frame is ever
dispatched to handle_requests).
Accumulate the header bytes on both sides, mirroring the payload
accumulation that was already correct. Add regression tests using a
socket that returns 2 bytes at a time to reliably reproduce the short
read.
(cherry picked from commit f72e6c9)
Co-authored-by: Andrew Chang [email protected]