Skip to content

fix: skip blank/whitespace lines in receive loop#87

Open
aorumbayev wants to merge 1 commit intoagentclientprotocol:mainfrom
aorumbayev:fix/skip-blank-lines-in-receive-loop
Open

fix: skip blank/whitespace lines in receive loop#87
aorumbayev wants to merge 1 commit intoagentclientprotocol:mainfrom
aorumbayev:fix/skip-blank-lines-in-receive-loop

Conversation

@aorumbayev
Copy link
Copy Markdown

@aorumbayev aorumbayev commented Apr 10, 2026

Summary

Blank/whitespace-only lines (\n, \r\n, \n) in the stream are valid no-ops in newline-delimited JSON framing but currently reach json.loads() and trigger a full logging.exception() traceback at ERROR level. This is noisy in production — especially on WSL where Windows-native agent subprocesses commonly emit \r\n blanks.

Strip each line and skip when empty before parsing. Adds a regression test.

@aorumbayev aorumbayev force-pushed the fix/skip-blank-lines-in-receive-loop branch from 8614b96 to 8de3d9c Compare April 10, 2026 07:16
_receive_loop only checked for EOF (b""), but blank lines like b"\n"
or b"\r\n" are truthy and reached json.loads(), causing JSONDecodeError.
Strip each line and skip when empty before parsing.
@aorumbayev aorumbayev force-pushed the fix/skip-blank-lines-in-receive-loop branch from 8de3d9c to 26e3fc8 Compare April 10, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant