fix(web): enforce sendPolicy on WhatsApp auto-reply delivery path#21893
fix(web): enforce sendPolicy on WhatsApp auto-reply delivery path#21893hydro13 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
|
Noticed a possible connection here. PR #21827 by @rsuk-mb seems to address the same problem. PR#21827 adds resolveSendPolicy enforcement to the WhatsApp on-message.ts handler, directly fixing the issue that sendPolicy rules are bypassed for WhatsApp auto-replies as reported in #21824. Both approaches have merit — might be worth coordinating. Related issue(s): #21824 If any of these links don't look right, let me know and I'll correct them. |
|
Hey @hydro13 — we opened #21827 for the same issue before spotting this PR. After comparing the two, your approach of placing the check inside One minor suggestion: the Happy to close #21827 in favour of this one. |
4f3405c to
2ed7f94
Compare
Skip store path, envelope, disk IO, group history, and echo detection for sessions where send policy denies. No logic change — same gate, earlier position. Addresses review suggestion from @rsuk-mb on openclaw#21893. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Skip store path, envelope, disk IO, group history, and echo detection for sessions where send policy denies. No logic change — same gate, earlier position. Addresses review suggestion from @rsuk-mb on openclaw#21893. Co-Authored-By: Claude Opus 4.6 <[email protected]>
2ed7f94 to
9ca2ddf
Compare
|
Good catch @rsuk-mb — just pushed the early-exit. The Happy to close #21827 in favour of whichever the maintainers prefer. |
Skip store path, envelope, disk IO, group history, and echo detection for sessions where send policy denies. No logic change — same gate, earlier position. Addresses review suggestion from @rsuk-mb on openclaw#21893. Co-Authored-By: Claude Opus 4.6 <[email protected]>
9ca2ddf to
3429879
Compare
|
Thanks @rsuk-mb — good catch on the ordering, and glad the approach looks solid. Just to confirm: the check is already at the very top of If you can close #21827 in favour of this one, that'd be great. Appreciate the thorough comparison. |
Skip store path, envelope, disk IO, group history, and echo detection for sessions where send policy denies. No logic change — same gate, earlier position. Addresses review suggestion from @rsuk-mb on openclaw#21893. Co-Authored-By: Claude Opus 4.6 <[email protected]>
3429879 to
aa121b7
Compare
…-pick) Cherry-pick of 49b1212 from fix/enforce-sendpolicy-whatsapp-autoreply. Temporary local patch until upstream openclaw#21893 merges. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
This pull request has been automatically marked as stale due to inactivity. |
aa121b7 to
bfcde24
Compare
|
Rebased on current main. |
|
Rebased on current main. Still relevant and ready for review. |
|
Closing — fix landed in main via bfcde24 ( |
Summary
Fixes #21824
resolveSendPolicy()was being called in all outbound paths (commands, gateway chat, gateway agent) but was missing from the WhatsApp WebSocket inbound handler (process-message.ts). This meantsendPolicyconfig rules were silently bypassed for WhatsApp auto-replies.Changes
src/web/auto-reply/monitor/process-message.tsresolveSendPolicyfrom../../../sessions/send-policy.js'whatsapp'(this file is WhatsApp-specific)falseearly when policy is'deny', consistent with other pathssrc/web/auto-reply/monitor/process-message.test.ts(new)falseand skips dispatch when sendPolicy denies the channelwhatsapp+chatType: groupKnown Limitation
Per-session
sendPolicyentry overrides (set directly on individual session entries in the store) are not checked in this path —process-message.tsdoes not load session entries. Config-level rules (channel, chatType, keyPrefix matching) work correctly. Per-session overrides can be added in a follow-up if needed.Verification
Greptile Summary
Adds missing
sendPolicyenforcement to the WhatsApp auto-reply path (process-message.ts). The check is positioned after echo detection but before the ack reaction and reply dispatch, matching the gating pattern used in other outbound paths (commands, gateway chat, gateway agent). Hardcodes channel to'whatsapp'since this handler is WhatsApp-specific. Test coverage validates all four policy scenarios: deny, allow (different channel rule), allow (no policy), and deny withchatTypematching.Confidence Score: 5/5
Last reviewed commit: 4f3405c