Skip to content

fix(gateway): pass merge_text=True in queue mode to prevent silent message drops (#28503)#28606

Open
Bartok9 wants to merge 1 commit into
NousResearch:mainfrom
Bartok9:fix/28503-busy-queue-drops-messages
Open

fix(gateway): pass merge_text=True in queue mode to prevent silent message drops (#28503)#28606
Bartok9 wants to merge 1 commit into
NousResearch:mainfrom
Bartok9:fix/28503-busy-queue-drops-messages

Conversation

@Bartok9

@Bartok9 Bartok9 commented May 19, 2026

Copy link
Copy Markdown
Contributor

Problem

When busy_input_mode: queue is configured, users who send multiple messages rapidly while the agent is processing only see their last message acted on. All previous messages are silently discarded.

Root cause: _queue_or_replace_pending_event called merge_pending_message_event without merge_text=True, so the plain-text path fell through to a single-slot assignment:

pending_messages[session_key] = event   # ← overwrites every time

Sending messages A, B, C while the agent is busy → only C survives.

Fix

Pass merge_text=True from _queue_or_replace_pending_event so sequential TEXT messages accumulate (newline-separated) into the pending slot instead of overwriting it.

Photo/media burst merging is unaffected — those branches in merge_pending_message_event return early before the merge_text check is reached.

Tests

Two new regression tests in tests/gateway/test_busy_session_ack.py:

  • test_queue_mode_accumulates_multiple_text_followups — verifies that A, B, C are all present in the combined pending event after three rapid queue-mode follow-ups.
  • test_queue_mode_single_message_unchanged — verifies first-message behaviour is unmodified (no regression).

All 17 existing busy-session tests continue to pass.

Closes #28503

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists labels May 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing fix for #28503 alongside #28551. Both address the same merge_text=True root cause. #28551 takes a FIFO approach; this PR uses text accumulation via merge_text=True.

@Bartok9

Bartok9 commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

Closing to stay within contributor PR limit. Will resubmit with fresh rebase if the issue remains open in main.

@Bartok9 Bartok9 closed this May 27, 2026
@Bartok9 Bartok9 reopened this May 27, 2026
@Bartok9 Bartok9 force-pushed the fix/28503-busy-queue-drops-messages branch from ba5814e to d584f06 Compare May 27, 2026 20:40
@Bartok9 Bartok9 force-pushed the fix/28503-busy-queue-drops-messages branch from d584f06 to f2667af Compare May 29, 2026 05:23
…ops (NousResearch#28503)

busy_input_mode: queue relied on _queue_or_replace_pending_event, which
called merge_pending_message_event without merge_text=True.  For plain
TEXT follow-ups this fell through to the single-slot assignment:

    pending_messages[session_key] = event   # overwrites

So sending messages A, B, C while the agent was busy would result in
only C being processed; A and B were silently dropped.

Fix: pass merge_text=True from _queue_or_replace_pending_event so
sequential text messages are accumulated (newline-separated) rather
than overwritten.  Photo/media burst merging is unaffected because
those branches in merge_pending_message_event return early before the
merge_text check.

Adds two regression tests:
- test_queue_mode_accumulates_multiple_text_followups: verifies A+B+C
  are all preserved in the combined pending slot.
- test_queue_mode_single_message_unchanged: verifies first-message
  behaviour is unmodified (no regression).

Closes NousResearch#28503
@Bartok9 Bartok9 force-pushed the fix/28503-busy-queue-drops-messages branch from f2667af to 13ba7ab Compare June 8, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery 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.

Bug: busy_input_mode: queue silently drops messages — single-slot overwrite instead of FIFO

2 participants