fix: accept empty-data final exec_chunk to complete the waiter - #109
Merged
Conversation
The final chunk (more=false) carries empty data by design — its payload
is the exit_code/status/duration_ms/truncated metadata, not output
bytes. _handle_exec_chunk rejected empty data before reading `more`,
so the completion metadata was dropped and the waiter stranded until
the per-call timeout (surfacing as "exec_chunk ... missing or invalid
data" in the server log, then a node disconnect on exec).
Only intermediate chunks (more=true) now require non-empty data;
base64.b64decode("") yields b"" so an empty-data final chunk decodes
cleanly and appends nothing.
Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
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.
Summary
Fixes the server-side half of the exec disconnect on
workmac.The node streams
exec_chunkmessages; the final chunk (more=false) carries emptydataby design — its payload is theexit_code/status/duration_ms/truncatedmetadata, not output bytes. But_handle_exec_chunkrejected emptydatabefore reading themoreflag, so every exec's completion metadata was dropped.Result (confirmed from
audit.log+ server logs):exec_chunk ... missing or invalid datawarning on every execclose 1006 (abnormal closure): unexpected EOF)Change
wsserver/server.py— readmorefirst, then only require non-emptydatafor intermediate chunks (more=true). An empty-data final chunk now decodes tob""and completes the waiter with its metadata.Test plan
tests/test_exec_chunk.py:pytest -q→ 49 passedruff check→ cleanRelated
blaspat/hermes-node#121(demuxer tailmore=true) and#122(NoResponse ordering). This PR completes the pair — without it the final chunk's metadata is dropped.