Fix JSON-RPC pipe reads >64KB by handling short reads#31
Merged
SteveSandersonMS merged 4 commits intomainfrom Jan 19, 2026
Merged
Fix JSON-RPC pipe reads >64KB by handling short reads#31SteveSandersonMS merged 4 commits intomainfrom
SteveSandersonMS merged 4 commits intomainfrom
Conversation
- Add _read_exact() method to handle short reads from pipes - Update _read_message() to use _read_exact() for reliable large payload handling - Add comprehensive unit tests for short read scenarios and large payloads Co-authored-by: SteveSandersonMS <1101362+SteveSandersonMS@users.noreply.github.com>
Co-authored-by: SteveSandersonMS <1101362+SteveSandersonMS@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix JSON-RPC read issue for large payloads
Fix JSON-RPC pipe reads >64KB by handling short reads
Jan 16, 2026
Contributor
|
@copilot Re-run python formatter |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug in the JSON-RPC client where reading large responses (>64KB) failed due to Python's read() not guaranteeing to return all requested bytes from pipes. The fix implements a loop-based reading approach that accumulates chunks until all expected bytes are received.
Changes:
- Added
_read_exact()method to handle partial/short reads from pipes - Updated
_read_message()to use_read_exact()instead of directread() - Added comprehensive unit tests covering various payload sizes and edge cases
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/copilot/jsonrpc.py | Added _read_exact() method that loops until all requested bytes are read, updated _read_message() to use it |
| python/test_jsonrpc.py | New test file with mock classes (MockProcess, ShortReadStream) and comprehensive test coverage for the fix including 64KB boundary cases, large payloads, EOF handling, and sequential messages |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: SteveSandersonMS <1101362+SteveSandersonMS@users.noreply.github.com>
Contributor
Author
SteveSandersonMS
approved these changes
Jan 19, 2026
devm33
approved these changes
Jan 19, 2026
This was referenced Jan 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.
Plan to fix JSON-RPC large payload issue
_read_exact()helper method injsonrpc.py_read_message()to use_read_exact()for reading contentOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.