Skip to content

fix(gateway): add queue_message method to prevent message loss on interrupt depth cap#1

Open
SpencerLin922 wants to merge 1 commit into
mainfrom
fix/queue-message-missing
Open

fix(gateway): add queue_message method to prevent message loss on interrupt depth cap#1
SpencerLin922 wants to merge 1 commit into
mainfrom
fix/queue-message-missing

Conversation

@SpencerLin922

Copy link
Copy Markdown
Owner

Summary

When interrupt recursion depth reaches MAX_INTERRUPT_DEPTH (3), pending messages were being popped from _pending_messages but could not be re-queued because the queue_message() method did not exist on BasePlatformAdapter. This caused messages to be silently dropped.

Added queue_message(session_key, message_text) to re-queue a message as a MessageEvent for processing on the next turn.

Bug Details

In run.py line 5573-5574:

The hasattr check was failing (method didn't exist), so pending messages were lost when:

  1. User sends rapid messages while agent is processing
  2. Interrupt recursion depth reaches 3
  3. The code tries to re-queue the message but queue_message() doesn't exist

Fix

Added queue_message() method to BasePlatformAdapter in gateway/platforms/base.py that creates a new MessageEvent and stores it in _pending_messages for processing on the next turn.

Test Plan

  • Existing tests pass
  • Manual verification: send rapid messages and confirm no message loss

Closes NousResearch#816

…errupt depth cap

When interrupt recursion depth reaches MAX_INTERRUPT_DEPTH, pending messages
were being popped from _pending_messages but could not be re-queued because
queue_message() method did not exist on BasePlatformAdapter. This caused
messages to be silently dropped.

Added queue_message(session_key, message_text) to re-queue a message as a
MessageEvent for processing on the next turn.

Fixes the silent message loss described in issue NousResearch#816.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway infinite loop: log handler duplication + unbounded interrupt recursion

1 participant