Repository navigation
fix(weixin): clear content dedup key after text-batch dispatch - #36758
liuhao1024 wants to merge 1 commit into
Conversation
|
Unsubscribe
…On Mon, Jun 1, 2026 at 7:43 AM liuhao1024 ***@***.***> wrote:
What does this PR do?
Clears the content fingerprint dedup key from MessageDeduplicator after
the Weixin text-batch is dispatched, so the same text sent again after the
previous turn completes is accepted instead of silently dropped.
Related Issue
Fixes #36750 <#36750>
Type of Change
- 🐛 Bug fix (non-breaking change that fixes an issue)
Changes Made
- gateway/platforms/helpers.py: Added MessageDeduplicator.remove(key)
method to evict a single key from the TTL cache, enabling lifecycle-aware
dedup patterns.
- gateway/platforms/weixin.py: Store the content dedup key on the
event (_dedup_content_key) and remove it from the dedup cache in
_flush_text_batch's finally block after dispatch. In-flight dedup
(same text arriving while the first is still queued) is unaffected.
- tests/gateway/test_weixin.py: Added
test_same_text_accepted_after_previous_processing_completes regression
test — sends the same text twice with a flush in between and asserts both
reach handle_message.
How to Test
1. Run python3 -m pytest
tests/gateway/test_weixin.py::TestWeixinContentDedup -v — all 3 tests
should pass.
2. Run python3 -m pytest tests/gateway/test_weixin.py -x -q — all 59
tests should pass.
3. Manual: with a Weixin/WeChat gateway configured, send "怎么样了", wait
for the response, then send "怎么样了" again — the second message should be
processed normally instead of being silently dropped.
Checklist Code
- I've read the Contributing Guide
<https://github.com/NousResearch/hermes-agent/blob/main/CONTRIBUTING.md>
- My commit messages follow Conventional Commits
<https://www.conventionalcommits.org/> (fix(scope):, feat(scope):,
etc.)
- I searched for existing PRs
<https://github.com/NousResearch/hermes-agent/pulls> to make sure this
isn't a duplicate
- My PR contains *only* changes related to this fix/feature (no
unrelated commits)
- I've run pytest tests/ -q and all tests pass
- I've added tests for my changes (required for bug fixes, strongly
encouraged for features)
- I've tested on my platform: macOS
Documentation & Housekeeping
- I've updated relevant documentation (README, docs/, docstrings) — or
N/A
- I've updated cli-config.yaml.example if I added/changed config keys
— or N/A
- I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture
or workflows — or N/A
- I've considered cross-platform impact (Windows, macOS) per the compatibility
guide
<https://github.com/NousResearch/hermes-agent/blob/main/CONTRIBUTING.md#cross-platform-compatibility>
— or N/A
- I've updated tool descriptions/schemas if I changed tool behavior —
or N/A
Code Intelligence
- Analyzed: MessageDeduplicator.remove() (new method),
_flush_text_batch (callers: 1, flows: text-batch dispatch)
- Blast radius: LOW — change is scoped to Weixin adapter's content
dedup lifecycle; MessageDeduplicator is a shared helper but remove()
is additive (no existing callers affected)
- Related patterns: TextBatchAggregator uses similar lifecycle
pattern; other adapters using MessageDeduplicator (discord, slack,
feishu) only use is_duplicate() and clear() — unaffected by remove()
addition
------------------------------
You can view, comment on, or merge this pull request online at:
#36758
Commit Summary
- 09f10b2
<09f10b2>
fix(weixin): clear content dedup key after text-batch dispatch
File Changes
(3 files <https://github.com/NousResearch/hermes-agent/pull/36758/files>)
- *M* gateway/platforms/helpers.py
<https://github.com/NousResearch/hermes-agent/pull/36758/files#diff-9bc9092fb9cd097f37468bc0efb13096f2911947c4cef4c89c6d8dc7de8e5f2d>
(10)
- *M* gateway/platforms/weixin.py
<https://github.com/NousResearch/hermes-agent/pull/36758/files#diff-8673c40fab2250bd243aa8f19ffb72148784056a0759693740f4771447877df3>
(14)
- *M* tests/gateway/test_weixin.py
<https://github.com/NousResearch/hermes-agent/pull/36758/files#diff-98a9c16cc6fd47cd7300cbd1c2043d8cfbfb10937f82d78e707a73369a79c0b2>
(36)
Patch Links:
- https://github.com/NousResearch/hermes-agent/pull/36758.patch
- https://github.com/NousResearch/hermes-agent/pull/36758.diff
—
Reply to this email directly, view it on GitHub
<#36758?email_source=notifications&email_token=BVAK7EOGSK4O5X23SWQTTB345VT7PA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTOOBQGY2TGMRQHCTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVRTG633UMVZF6Y3MNFRWW>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BVAK7EL7E2M4HRDEL2NGJOD45VT7PAVCNFSM6AAAAACZVOFVUCVHI2DSMVQWIX3LMV43ASLTON2WKOZUGU3DENZXG42DKNQ>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/BVAK7ELV5JCT4AN2CCIJWNL45VT7PA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTOOBQGY2TGMRQHCTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVJTG633UMVZF62LPOM>
and Android
<https://github.com/notifications/mobile/android/BVAK7EMNFIWBV472DDQDROT45VT7PA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTOOBQGY2TGMRQHCTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>.
Download it today!
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
mxnstrexgl
left a comment
There was a problem hiding this comment.
🤖 Automated PR Review
Security Scan
- ✓ No hardcoded secrets, injection sinks, unsafe deserialization, or dependency red flags found by this automated scan.
Code Quality
- ✓ No blocking code-quality issues found by this automated scan.
Summary
Status: APPROVE — security findings: 0, quality suggestions: 0.
Automated review; raw diff content intentionally omitted.
|
Thanks for isolating the Weixin content-dedup lifecycle issue; the current-main premise is real at Problems
Suggested changes
Automated hermes-sweeper review. |
09f10b2 to
f5ed909
Compare
Rework of the NousResearch#36758 fix onto current main's shared batching, per review: - The content fingerprint is now a per-event key set: chunks merged into a pending batch contribute their keys to the surviving event, so a flushed batch releases every accepted fingerprint, not just the first chunk's. - Release runs in _dispatch_text_batch's finally — the boundary is now honest: the batch has been handed to the pipeline (handle_message returning only marks background start, not turn completion). An upstream retry racing this boundary still hits the message_id dedup. - Reuses MessageDeduplicator.discard() already on main. - Adds the merged-batch regression requested by review.
|
Rebased onto current main and reworked per the review, since the batching machinery moved into the shared base adapter (
Tests: |
What does this PR do?
Clears the content fingerprint dedup key from
MessageDeduplicatorafter the Weixin text-batch is dispatched, so the same text sent again after the previous turn completes is accepted instead of silently dropped.Related Issue
Fixes #36750
Type of Change
Changes Made
gateway/platforms/helpers.py: AddedMessageDeduplicator.remove(key)method to evict a single key from the TTL cache, enabling lifecycle-aware dedup patterns.gateway/platforms/weixin.py: Store the content dedup key on the event (_dedup_content_key) and remove it from the dedup cache in_flush_text_batch'sfinallyblock after dispatch. In-flight dedup (same text arriving while the first is still queued) is unaffected.tests/gateway/test_weixin.py: Addedtest_same_text_accepted_after_previous_processing_completesregression test — sends the same text twice with a flush in between and asserts both reachhandle_message.How to Test
python3 -m pytest tests/gateway/test_weixin.py::TestWeixinContentDedup -v— all 3 tests should pass.python3 -m pytest tests/gateway/test_weixin.py -x -q— all 59 tests should pass.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
MessageDeduplicator.remove()(new method),_flush_text_batch(callers: 1, flows: text-batch dispatch)MessageDeduplicatoris a shared helper butremove()is additive (no existing callers affected)TextBatchAggregatoruses similar lifecycle pattern; other adapters usingMessageDeduplicator(discord, slack, feishu) only useis_duplicate()andclear()— unaffected byremove()addition