fix(monitor): keep polling while handling inbound messages#92
Open
wowyuarm wants to merge 1 commit into
Open
Conversation
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
processOneMessage(...)inside the long-poll message loop.getUpdatespoll can continue while an agent reply is still running.MAX_IN_FLIGHT_MESSAGES = 32) and log per-message processing failures.Why
OpenClaw already has message queue behavior such as
messages.queue.mode = "steer", but it only works after the follow-up message reaches OpenClaw.Before this change, the Weixin monitor awaited the full
processOneMessage(...)path. That path can include agent generation and outbound reply delivery, so a follow-up Weixin message could stay behind the plugin's long-poll loop until the previous reply fully finished. In that case OpenClaw never sees the follow-up in time, so queue steering cannot take effect.This change lets the monitor keep polling and hand later messages to OpenClaw while an earlier reply is still in progress.
Related symptoms discussed in existing issues include inbound aggregation/order/loss reports (#83, #65, #66), but I did not find an existing issue or PR for this exact blocking point.
Tests
npm run typechecknpm run buildnpx vitest run src/monitor/monitor.test.ts src/api/config-cache.test.tsNote:
npm testcurrently fails onsrc/auth/pairing.test.ts > registerUserInFrameworkStore > uses withFileLock for concurrency safety. I reproduced the same failure on a cleanorigin/mainworktree, so it appears unrelated to this change.