Skip to content

fix(remote-control): prevent duplicate WeChat message processing#469

Merged
sorrycc merged 1 commit intomasterfrom
fix/wechat-duplicate-messages
Apr 9, 2026
Merged

fix(remote-control): prevent duplicate WeChat message processing#469
sorrycc merged 1 commit intomasterfrom
fix/wechat-duplicate-messages

Conversation

@sorrycc
Copy link
Copy Markdown
Member

@sorrycc sorrycc commented Apr 9, 2026

Summary

  • Root cause: subscribeToAdapter() added event listeners without removing old ones. When stopAdapter() was skipped (adapter not running), listeners accumulated — causing every inbound message/callback to fire twice.
  • Layer 1: Folded subscribeToAdapter() into startAdapter() with removeAllListeners() guard. Deleted the separate method and removed all 4 call sites.
  • Layer 2: Added isDuplicateInbound() dedup helper (2s TTL) guarding both onMessage() and onCallback() as defense-in-depth.

Test plan

  • bun ready passes (format + typecheck + lint + tests)
  • Connect WeChat, send messages — confirm single delivery in Neo session
  • Check logs for absence of duplicate inbound message: lines
  • Verify /chat, /help, /repos commands execute only once per invocation

Listener accumulation in RemoteControlService caused every inbound
WeChat message/callback to be processed twice — doubling session
messages, LLM turns, and replies.

Root cause: subscribeToAdapter() was called from 4 code paths without
removing old listeners when stopAdapter() was skipped (adapter not
running). Fixed by folding listener setup into startAdapter() with
removeAllListeners() guard, and adding a service-level dedup as
defense-in-depth.
@sorrycc sorrycc merged commit e44a253 into master Apr 9, 2026
6 checks passed
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

Build Ready

Platform Architecture Download Size
macOS Apple Silicon Download 147.40 MB
macOS Intel Download 155.07 MB
Windows x64 Download 171.05 MB

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.

1 participant