fix(quality): remove redundant flush_chunks before MARCH self-check#3264
Merged
fix(quality): remove redundant flush_chunks before MARCH self-check#3264
Conversation
native.rs emitted response_end before returning to mod.rs, which then ran the quality hook and called the canonical flush_chunks at mod.rs:1433. When self-check flagged a response, this produced two response_end events. Remove the premature call; the canonical flush at mod.rs:1433 covers all exit paths for both flagged and non-flagged responses. Fixes #3259
e287425 to
321087d
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
self.channel.flush_chunks().await?fromnative.rs:802(ChatResponse::Text branch)flush_chunks()atmod.rs:1433already covers all exit paths after self-checkself_check = trueand the response is flagged, the premature call produced tworesponse_endevents in--jsonmodeRoot Cause
PR #3244 moved the canonical
flush_chunks()to after the quality hook inmod.rs:1433, but did not remove the earlier call innative.rs:802. Whenflagged > 0, the execution path was:native.rs:802→flush_chunks()→ emitsresponse_end①quality_hook.rs:101→send_chunk(" [verify]")→ pending_chunks=truemod.rs:1433→flush_chunks()→ emitsresponse_end②Test Plan
send_then_marker_chunk_then_flush_emits_single_end(json_cli.rs:417) — PASSflag_marker_appended_via_send_chunk_has_single_end(json_cli.rs:437) — PASSNote: pre-existing P3 gap — no zeph-core unit test for
quality_hook flagged > 0path. Tracked separately.Closes #3259