fix(quality): prevent double response_end when MARCH flag_marker fires in --json mode#3234
Merged
fix(quality): prevent double response_end when MARCH flag_marker fires in --json mode#3234
Conversation
7c0f00b to
2bae690
Compare
…s in --json mode quality_hook.rs called channel.send(&marker) after process_response() had already flushed response_end. JsonCliChannel::send() unconditionally emits ResponseChunk + ResponseEnd, producing a second pair and breaking the JSON protocol contract. Fix: change the two channel.send() call sites in quality_hook.rs to send_chunk(), then call flush_chunks() in agent/mod.rs after run_self_check_for_turn() returns. The marker is now part of the primary stream with a single response_end. Closes #3231
2bae690 to
16025f0
Compare
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
quality_hook.rscalledchannel.send(&marker)afterprocess_response()had already flushedresponse_endJsonCliChannel::send()unconditionally emitsResponseChunk + ResponseEnd, producing a second pair and breaking the--jsonprotocol contractchannel.send()call sites inquality_hook.rstosend_chunk(), then callflush_chunks()inagent/mod.rsafterrun_self_check_for_turn()returnsTest plan
flag_marker_appended_via_send_chunk_has_single_endinzeph-channelsverifies chunk+marker+single-end orderingflush_chunks_emits_end_after_chunk,send_resets_pending_and_subsequent_flush_is_noopremain greenCloses #3231