fix: recover from oversized JSON-RPC frames by PsiACE · Pull Request #111 · agentclientprotocol/python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 32
Draft
wants to merge 2 commits into
Conversation
Summary
Related issues
Close #62
Testing
Docs & screenshots
Checklist
- Conventional Commit title (e.g.
feat:,fix:). - Tests cover the change or are not required (explain above).
- Docs/examples updated when behaviour is user-facing.
- Schema regenerations (
make gen-all) are called out if applicable.
| consumed = 1 | ||
| if consumed > 0: | ||
| try: | ||
| await self._wait_for_reader(self._reader.readexactly(consumed)) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we handle TimeoutError?
| except asyncio.IncompleteReadError as exc: | ||
| return exc.partial | ||
| except asyncio.LimitOverrunError as exc: | ||
| await self._discard_oversized_line(exc.consumed) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of dropping the line and emit a warning, how about we read maximum limit bytes and concatenate the result manually?
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