fix(dingtalk): serialize inbound messages per chat session#17366
Open
spike2204 wants to merge 1 commit into
Open
fix(dingtalk): serialize inbound messages per chat session#17366spike2204 wants to merge 1 commit into
spike2204 wants to merge 1 commit into
Conversation
…ate agent turns When the agent is busy processing a message, a second inbound message for the same chat spawns a parallel turn, producing duplicate or interleaved replies. - Add _enqueue_inbound() / _sweep_session_queues() — promise-chain queue per chat that serializes message processing - Send a random busy-ACK phrase for queued messages so the user knows their message was received - Queue entries auto-expire after 5 minutes (matches openclaw-connector core/message-handler.ts:92) - Sweeper task runs every 60s to clean stale queue entries - Proper cleanup on disconnect (cancel pending tasks) to #
This was referenced Apr 30, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a user sends multiple messages rapidly (or sends text + file in quick succession), the adapter processes them concurrently, causing race conditions in AI Card lifecycle management — cards from message N clobber cards from message N+1.
Changes
_enqueue_inbound()— per-chat asyncio.Queue with configurable max depth (default 32)_sweep_session_queues()— periodic cleanup of idle session queues (>30min)_on_message()calls through the per-chat queue so messages within the same conversation are processed sequentially while different conversations remain concurrentRelated
Part of the DingTalk adapter enhancement series — see #12769 for the umbrella PR.