fix(agent/reconnectingpty): read reconnecting-PTY init with io.ReadFull#26538
Open
yuriy-at-persona wants to merge 1 commit into
Open
fix(agent/reconnectingpty): read reconnecting-PTY init with io.ReadFull#26538yuriy-at-persona wants to merge 1 commit into
yuriy-at-persona wants to merge 1 commit into
Conversation
handleConn read the length-prefixed AgentReconnectingPTYInit with single conn.Read calls. A single Read on a network connection can return fewer bytes than requested, so when the init spans multiple segments the body is read short and left NUL-padded, json.Unmarshal fails with "failed to unmarshal init", and the agent returns without starting the PTY. The session then connects but delivers no output, intermittently. Read both the length prefix and the body with io.ReadFull, matching the length-prefixed framing read in agent/boundarylogproxy/codec. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
cdrci2
added a commit
to coder/cla
that referenced
this pull request
Jun 19, 2026
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.
handleConnreads the length-prefixedAgentReconnectingPTYInitwith a singleconn.Readfor the 2-byte length and another for the body. A singleReadon a network connection can return fewer bytes than requested, so when the init spans multiple segments (more likely with a largerCommand) the body is read short and left NUL-padded,json.Unmarshalfails withfailed to unmarshal init, and the agent returns without starting the reconnecting PTY. The session then connects but delivers no output, intermittently.Read both the length prefix and the body with
io.ReadFull, matching the length-prefixed framing read inagent/boundarylogproxy/codec.Note: the length prefix is a
uint16, so an init larger than 64 KiB would still wrap; that is a separate pre-existing issue and is not addressed here.