Repository navigation
fix(gateway): skip duplicate-send diagnostic for interim-only stream consumers (#105341) - #105446
webtecnica wants to merge 1 commit into
Conversation
SummaryFixes #105341: the duplicate-send diagnostic in Findings
VerdictLooks good. Minimal flag with fail-loud defaults and control-plus-regression tests. Safe to merge. |
|
Heads-up for anyone landing here: this fix was salvaged upstream in #111467 by @teknium1 — the PR body credits it as Leaving this one open for now, since that salvage has not merged yet; no need to re-review the diff here in the meantime. |
Closes #105341
Problem
With
streaming.enabled: falseanddisplay.interim_assistant_messages: true, every gateway turn logs apossible duplicate sendwarning — a guaranteed false positive (321/day on the reporter's install). TheGatewayStreamConsumeris still built (interim commentary is relayed through it,gateway/run_turn_runner.py:800), but with text streaming off it is never fed the final reply's deltas._run_agent_mark_streamed_delivery(gateway/run_turn.py:3595+) could not distinguish "consumer built only for interim messages" from "consumer that streamed but lost its delivery confirmation", so it logged the duplicate-risk diagnostic on every turn.Change
GatewayStreamConsumergainsstream_deltas_enabled = True(default; every construction site that can race the final send — incl. the proxy path, which only builds consumers when streaming is on — keeps the diagnostic)._setup_stream_consumer(run_turn_runner.py) setsstream_consumer.stream_deltas_enabled = want_stream_deltas, marking interim-only consumers (streaming off, interim messages on)._run_agent_mark_streamed_deliverynow requiresstream_deltas_enabled— a consumer never fed the final's deltas cannot have raced the normal final send, so the warning is skipped. The wecom ack-timeout case the diagnostic was written for is untouched (that consumer streams).Tests
test_interim_only_consumer_skips_duplicate_warning— interim-only consumer: no warning.test_stream_capable_consumer_still_warns— control: stream-capable consumer keeps the diagnostic.test_consumer_flag_defaults_true_on_real_consumer— real consumer defaults to stream-capable.python -m pytest tests/gateway/test_interim_only_consumer_warning.py tests/gateway/test_stale_finalize_suppression.py tests/gateway/test_duplicate_reply_suppression.py tests/gateway/test_wecom_double_send.py tests/gateway/test_telegram_final_delivery.py tests/gateway/test_silent_partial_delivery_95382.py tests/gateway/test_stream_consumer.py -q→ 123 passed, 1 xfailed.