Skip to content

fix(quality): prevent double response_end when MARCH flag_marker fires in --json mode#3234

Merged
bug-ops merged 1 commit intomainfrom
3231-march-flag-marker-json
Apr 19, 2026
Merged

fix(quality): prevent double response_end when MARCH flag_marker fires in --json mode#3234
bug-ops merged 1 commit intomainfrom
3231-march-flag-marker-json

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

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

Summary

  • 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 both 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

Test plan

  • New regression test flag_marker_appended_via_send_chunk_has_single_end in zeph-channels verifies chunk+marker+single-end ordering
  • Existing tests flush_chunks_emits_end_after_chunk, send_resets_pending_and_subsequent_flush_is_noop remain green
  • 8412 workspace tests pass

Closes #3231

@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation channels zeph-channels crate (Telegram) rust Rust code changes core zeph-core crate size/S Small PR (11-50 lines) and removed bug Something isn't working labels Apr 18, 2026
@bug-ops bug-ops force-pushed the 3231-march-flag-marker-json branch from 7c0f00b to 2bae690 Compare April 18, 2026 23:53
@github-actions github-actions Bot added the bug Something isn't working label Apr 18, 2026
@bug-ops bug-ops enabled auto-merge (squash) April 18, 2026 23:54
…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
@bug-ops bug-ops force-pushed the 3231-march-flag-marker-json branch from 2bae690 to 16025f0 Compare April 18, 2026 23:59
@bug-ops bug-ops merged commit bd83910 into main Apr 19, 2026
32 checks passed
@bug-ops bug-ops deleted the 3231-march-flag-marker-json branch April 19, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working channels zeph-channels crate (Telegram) core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/S Small PR (11-50 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(quality): MARCH flag_marker emits extra response_chunk/response_end after response_end in --json mode

1 participant