[codex] fix compressed response payload boundaries#153
Open
djrobx wants to merge 1 commit into
Open
Conversation
|
This was referenced Jul 4, 2026
Author
|
This is a Codex generated PR to address I happened to encounter the -5 condition that some others have run into. Codex first gave a "fallback" code change that dropped down to a streaming Zlib when -5 was found that worked, but I pressed it to find a cleaner solution. Then it found MsgSize in the header, which I think is the proper fix. But, feel free to reject and re-implement as you see fit. :) |
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.



What changed
Uses the
MsgSizesupplied by an OmniLogic multi-part lead message to trim reassembled response data precisely. It also removes therstrip(b"\x00")call before zlib decompression.Why
The previous heuristic could remove a legitimate trailing zero from a compressed stream's zlib trailer and make
zlib.decompress()raiseError -5 while decompressing data: incomplete or truncated stream. The controller already reports the exact message boundary, so there is no need to guess by removing zero bytes.zlib.decompress()tolerates trailing protocol padding after a complete stream while continuing to reject a genuinely truncated stream.Validation
MsgSizeexactly matched the reassembled compressed response length.0x00, followed by protocol padding.pytest -q tests(full suite)