it0/packages
hailin 61b2778ff0 fix(wecom): 4 bugs — watchdog follower, atomic getdel, Redis bindcodes, enter_session dedup
Bug 1 — Watchdog doesn't track followers:
  lastPollAt = Date.now() moved before leader check. All poll()
  invocations update the timestamp, so if a follower's loop dies
  the watchdog fires after WATCHDOG_THRESHOLD_MS and restarts it.

Bug 2 — Non-atomic GetDel for cross-instance recovery:
  Replaced GET + DEL with atomic GETDEL (Redis 6.2+, ioredis v5).
  Two instances can no longer both recover the same callback reply.

Bug 3 — Binding codes stored in per-process memory:
  generateBindingCode() now async; stores in Redis:
    wecom:bindcode:{CODE}        → instanceId  (TTL 15min)
    wecom:bindcode:inst:{instId} → CODE        (reverse lookup)
  resolveBindCode() uses GETDEL atomically, then deletes reverse key.
  Falls back to in-memory Map when Redis is unavailable.
  Old code for same instance is revoked on regenerate.
  handleMessage updated: resolveBindCode() replaces Map.get();
  6-char hex pattern with no match now returns expired-code hint.
  Controller wecomGenerateBindCode now awaits generateBindingCode().

Bug 4 — enter_session events not deduplicated:
  handleEnterSession now receives msgId from the event.
  redisDedup(msgId) called before sending welcome message — prevents
  duplicate welcomes on WeCom retransmission or cursor reset.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 06:46:17 -07:00
..
gateway feat(push): add offline push notification system (FCM + HMS + Mi + OPPO + vivo) 2026-03-10 02:42:34 -07:00
openclaw-bridge feat(instance-chat): full multimodal attachment support via OpenClaw bridge 2026-03-09 21:18:14 -07:00
services fix(wecom): 4 bugs — watchdog follower, atomic getdel, Redis bindcodes, enter_session dedup 2026-03-10 06:46:17 -07:00
shared feat(push): add offline push notification system (FCM + HMS + Mi + OPPO + vivo) 2026-03-10 02:42:34 -07:00