Skip to content

Write complete LSP frames when output streams accept partial data - #38

Open
Aschenbath wants to merge 1 commit into
python-lsp:developfrom
Aschenbath:fix/oss50more-20261125-3592-jsonrpc-short-writes
Open

Aschenbath wants to merge 1 commit into
python-lsp:developfrom
Aschenbath:fix/oss50more-20261125-3592-jsonrpc-short-writes

Conversation

@Aschenbath

Copy link
Copy Markdown

JsonRpcStreamWriter discards the byte count returned by write(). A valid raw binary stream that accepts only part of the buffer therefore emits a truncated LSP frame; flushing does not write the omitted bytes.

Keep writing the remaining bytes while holding the existing writer lock, and treat a zero/None result as an output failure rather than looping indefinitely. Tests round-trip two Unicode messages through streams accepting one or seven bytes per call, and check that non-progressing streams stop without flushing. All four regressions fail against the unchanged source.

Validation: Linux/Python 3.12 with ujson; all 31 tests pass, repository pylint (10.00/10), pycodestyle and pyflakes pass, and sdist/wheel builds pass.

AI disclosure: OpenAI Codex investigated the failure, wrote the patch and tests, and ran the reported validation. No independent human review is claimed.

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