Repository navigation
fix(weixin): preserve intentional repeated slash commands - #129536
Closed
Wenfengcheng wants to merge 2 commits into
Closed
Wenfengcheng wants to merge 2 commits into
Wenfengcheng wants to merge 2 commits into
Conversation
…edup The weixin adapter's secondary content-fingerprint dedup (added in NousResearch#16182 to catch iLink redeliveries that share text but use fresh message_ids) treats every repeated text from the same sender within the 5-minute TTL as a duplicate. That silently drops intentional re-issues of slash commands such as `/approve` (one per pending approval), `/restart-sglang`, and `/help` — the user sees the message arrive in gateway logs but never in the message-handler pipeline. Skip the content dedup when the text is a slash command. `message_id` dedup still catches genuine network-layer retries, and the original NousResearch#16182 protection still applies to free-form text (the existing regression test in this class continues to pass). Detection tolerates leading whitespace so clients that don't trim identically all hit the same path.
|
Verified: all 11 tests in test_weixin_command_dedup.py pass on Windows with Python 3.14.7. Repeated slash commands (/approve, /deny, /retry, etc.) with or without media bypass the content-fingerprint deduplication cache as expected, while message_id dedup continues to prevent genuine transport retries and plain text deduplication remains unaffected. LGTM — ready for merge. |
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.
Problem
Distinct Weixin messages repeating
/approve,/deny,/retry, or a custom slash command are dropped for five minutes by content-fingerprint deduplication before reaching gateway command handling.Fixes #29779.
Root cause
WeixinAdapter._process_messageapplies the ordinary-text fingerprint cache to control messages too. The separate message-ID cache already rejects transport retransmissions. Leading-whitespace commands also need command classification to avoid entering the text debounce queue.Change
Salvages @briandevans's closed #29787 with original commit authorship preserved, ported to current main and strengthened with deterministic ingress tests. #36707 and #81124 are also author-closed, unmerged. Actual diffs of #36758 (ordinary text-batch fingerprint release), #97581 (missing message-ID media), and #129176 (quoted-text attribution) cover different contracts; none exempts repeated commands.
Verification
Base:
5c08ad68f7ec488057880752f8071cee154a6e60.Native Windows, isolated HOME/USERPROFILE/HERMES_HOME/APPDATA/LOCALAPPDATA, existing Python 3.11.15; no production credentials or network transport used.
bash scripts/run_tests.sh tests/gateway/test_weixin_command_dedup.py -j 2 --file-retries 0b06ff5480511290bcf10487432d426c063a6fef5: 76 passed acrosstest_weixin.py,test_weixin_command_dedup.py,test_weixin_typing.py,test_weixin_secret_scope.py,test_message_deduplicator.py, andtest_approve_deny_commands.pyusing the repository runner. An initial sparse-checkout run failed becausehermes_platformand locale assets were absent; after materializing those existing repository paths, the complete selection passes./approveand/deny, with and without media, including whitespace and message-ID replay. Custom commands use a captured ingress handoff; no claim of live WeChat service coverage.Non-goals / continuation
No approval authorization/session-key changes, no ordinary-text TTL redesign, no no-ID synthetic identity, no quoted-message parsing changes. The reported repeated-command contract is delivered. Continuation completed on this PR with commit
b06ff5480511(real busy-guard and media-command coverage). Remaining work is the unavailable Claude review; adjacent ordinary-text lifecycle changes stay with #36758, rather than expanding this PR into that owned contract.