fix: isolate WhatsApp direct sessions by account#76730
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep open: the patch appears to address the WhatsApp direct-message session leak, but it still needs contributor real behavior proof, a clean merge result, and maintainer acceptance of compatibility-sensitive session/API changes. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. So I’m closing this here because the remaining work is already tracked in the canonical issue. Review detailsBest possible solution: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. Do we have a high-confidence way to reproduce the issue? Yes, source inspection gives a high-confidence path: current main passes WhatsApp direct peers to resolveAgentRoute, and unset session.dmScope still defaults to the shared main scope. I did not establish a live WhatsApp reproduction in this read-only review. Is this the best way to solve the issue? Yes as the likely fix shape, but not merge-ready. Account-aware per-contact isolation reuses the existing per-account-channel-peer helper and is narrower than changing the global DM default, but proof, branch refresh, and maintainer acceptance are still needed. Security review: Security review cleared: The diff reduces a WhatsApp session-context leak and does not add dependencies, workflows, secrets handling, broad permissions, or downloaded code execution. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 010b61746379. |
1668e29 to
6523eb7
Compare
|
Closing this stale branch per the latest review. The account-scoped WhatsApp session-isolation problem remains valid, but this branch no longer shares current history and the routing/channel ownership has materially changed. Any remaining gap should be rebuilt from current |
Summary
Fixes the WhatsApp direct-message context leak reported in #76263. With the default shared DM scope, inbound WhatsApp DMs could collapse into the agent main session, so distinct contacts shared one session file and model context.
Root Cause
WhatsApp inbound routing passed a direct peer to the generic route resolver, but generic routing defaults
session.dmScopetomain. That default is useful for personal single-user continuity, but unsafe for WhatsApp shared inbox and SaaS deployments where many senders contact the same account.What Changed
dmScopeOverridetoresolveAgentRoute()so channel plugins can request stricter DM isolation without changing the global config contract.agent:<agentId>:whatsapp:<accountId>:direct:<peerId>.Why Account-Aware
The earlier bundled PR used
per-channel-peer, which isolated different contacts on one WhatsApp account but collapsed the same sender across multiple WhatsApp accounts. This PR usesper-account-channel-peerfor WhatsApp DMs so both dimensions are isolated.Scope
WhatsApp inbound DM session routing and last-route metadata only. No outbound newsletter behavior, group session keys, allowlists, auth, provider/model behavior, or non-WhatsApp channel defaults are changed.
Test Plan
pnpm exec oxfmt --write --threads=1 src/routing/resolve-route.ts src/routing/resolve-route.test.ts extensions/whatsapp/src/auto-reply/monitor/on-message.ts extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.ts extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts extensions/whatsapp/src/auto-reply.web-auto-reply.last-route.test.ts docs/channels/whatsapp.md CHANGELOG.mdpnpm test src/routing/resolve-route.test.ts extensions/whatsapp/src/auto-reply.web-auto-reply.last-route.test.ts extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts -- --reporter=verbosepnpm changed:lanes --json6523eb7618b463c249b3b557aa124ffbe6379a06Linked Issue / Replacement
Fixes #76263.
Replaces the WhatsApp-only portion of closed bundled PR #76326.