Skip to content

fix(agent): add force_display to _emit_interim_assistant_message - #78100

Open
yingliang-zhang wants to merge 1 commit into
NousResearch:mainfrom
yingliang-zhang:fix/force-display-interim-message
Open

fix(agent): add force_display to _emit_interim_assistant_message#78100
yingliang-zhang wants to merge 1 commit into
NousResearch:mainfrom
yingliang-zhang:fix/force-display-interim-message

Conversation

@yingliang-zhang

Copy link
Copy Markdown
Contributor

Problem

When verify-on-stop or pre_verify triggers, the agent produces a complete response that is emitted via _emit_interim_assistant_message. However, two issues can cause the response to be lost:

  1. Dedup gate false-negative: _interim_text_was_delivered() may return True if similar text was previously recorded as delivered, suppressing the callback entirely. Under stress (repeated verification candidates, compaction), the Desktop streaming buffer may have been flushed between the first delivery and the dedup check.

  2. Streaming buffer overwrite on messaging gateways: _interim_content_was_streamed() returns True when the text was already streamed via stream_delta_callback. On messaging gateways (Telegram/Discord/Slack), already_streamed=True routes to on_segment_break() (paragraph separator, no text payload) instead of on_commentary() (standalone permanent bubble). The streamed text lives in a transient buffer and gets overwritten by subsequent verification messages.

This was previously identified in #62676 (Layer 3), which was closed without merge.

Fix

Add force_display: bool = False parameter to _emit_interim_assistant_message:

  • When True: bypass _interim_text_was_delivered dedup gate + force already_streamed=False
  • Wire force_display=True at the verify_on_stop and pre_verify call sites where the response must survive as a permanent UI element

Test plan

  • pytest tests/agent/test_verification_stop.py tests/agent/test_verification_stop_caching.py tests/run_agent/test_verification_continuation_budget.py tests/tui_gateway/test_interim_assistant_callback.py — 25 passed
  • py_compile — OK

Related

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint labels Aug 4, 2026
Add force_display: bool = False parameter to _emit_interim_assistant_message.
When True:
- Bypass _interim_text_was_delivered dedup gate (under stress with repeated
  verification candidates, near-identical interim texts were suppressed as
  'already delivered', but the streaming buffer may have been flushed
  between first delivery and the dedup check)
- Force already_streamed=False so messaging gateway calls on_commentary()
  (standalone permanent bubble) instead of on_segment_break() (paragraph
  separator that gets overwritten by subsequent messages)

Wire force_display=True at verify_on_stop and pre_verify call sites in
conversation_loop.py where the response MUST survive as a permanent UI
element.

Supersedes the closed NousResearch#62676 which introduced the same parameter but was
not merged.
@yingliang-zhang
yingliang-zhang force-pushed the fix/force-display-interim-message branch from 5501433 to 35ffc6b Compare August 16, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants