it0/packages/services
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
..
agent-service fix(wecom): 4 bugs — watchdog follower, atomic getdel, Redis bindcodes, enter_session dedup 2026-03-10 06:46:17 -07:00
audit-service fix(auth): allow platform_admin to access all web-admin endpoints 2026-03-07 05:54:05 -08:00
auth-service fix(auth): add name to JWT payload, fix phone-user session restore 2026-03-09 08:23:26 -07:00
billing-service fix: store tenant slug (not UUID) in current_tenant; remove plan trial periods 2026-03-07 09:01:21 -08:00
comm-service fix: release QueryRunner connections to prevent pool exhaustion 2026-02-23 15:55:06 -08:00
inventory-service feat(openclaw): Phase 1 — server pool + agent instance deployment infrastructure 2026-03-07 11:11:21 -08:00
monitor-service fix: release QueryRunner connections to prevent pool exhaustion 2026-02-23 15:55:06 -08:00
notification-service fix(push): fix TypeScript Map type inference error in OfflinePushService 2026-03-10 04:50:11 -07:00
ops-service fix(ops-service): add new TenantInfo quota fields to inline TenantContextService.run calls 2026-03-04 00:04:36 -08:00
presence-service fix(presence-service): use linux-musl-openssl-3.0.x Prisma binary target for Alpine 2026-03-07 18:19:13 -08:00
referral-service feat(referral): add user-level personal circle + points system 2026-03-08 00:18:17 -08:00
version-service feat(auth): add platform_super_admin role for two-level platform access control 2026-03-07 01:17:27 -08:00
voice-agent feat(voice): randomly pick thinking sound from all 7 built-in clips per session 2026-03-09 06:56:31 -07:00
voice-service feat: add engine type selection (Agent SDK / Claude API) for voice calls 2026-03-02 02:11:51 -08:00