Skip to content

fix(quality): remove redundant flush_chunks before MARCH self-check#3264

Merged
bug-ops merged 1 commit intomainfrom
3259-double-response-end-json-march
Apr 19, 2026
Merged

fix(quality): remove redundant flush_chunks before MARCH self-check#3264
bug-ops merged 1 commit intomainfrom
3259-double-response-end-json-march

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Apr 19, 2026

Summary

  • Removes self.channel.flush_chunks().await? from native.rs:802 (ChatResponse::Text branch)
  • The canonical flush_chunks() at mod.rs:1433 already covers all exit paths after self-check
  • When self_check = true and the response is flagged, the premature call produced two response_end events in --json mode

Root Cause

PR #3244 moved the canonical flush_chunks() to after the quality hook in mod.rs:1433, but did not remove the earlier call in native.rs:802. When flagged > 0, the execution path was:

  1. native.rs:802flush_chunks() → emits response_end
  2. quality_hook.rs:101send_chunk(" [verify]") → pending_chunks=true
  3. mod.rs:1433flush_chunks() → emits response_end

Test Plan

  • send_then_marker_chunk_then_flush_emits_single_end (json_cli.rs:417) — PASS
  • flag_marker_appended_via_send_chunk_has_single_end (json_cli.rs:437) — PASS
  • Full workspace: 8506 tests passed
  • clippy: clean
  • fmt: clean

Note: pre-existing P3 gap — no zeph-core unit test for quality_hook flagged > 0 path. Tracked separately.

Closes #3259

@github-actions github-actions Bot added rust Rust code changes core zeph-core crate bug Something isn't working size/XS Extra small PR (1-10 lines) labels Apr 19, 2026
@bug-ops bug-ops enabled auto-merge (squash) April 19, 2026 19:54
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
@bug-ops bug-ops force-pushed the 3259-double-response-end-json-march branch from e287425 to 321087d Compare April 19, 2026 19:56
@bug-ops bug-ops merged commit 27042d0 into main Apr 19, 2026
32 checks passed
@bug-ops bug-ops deleted the 3259-double-response-end-json-march branch April 19, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate rust Rust code changes size/XS Extra small PR (1-10 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(quality): double response_end in --json mode when MARCH self-check flags response

1 participant