fix(whatsapp_cloud): honor documented WHATSAPP_CLOUD_ALLOWED_USERS / ALLOW_ALL_USERS - #58448
Closed
sahil-shubham wants to merge 1 commit into
Closed
Conversation
…ALLOW_ALL_USERS The Cloud setup wizard and docs tell operators to set WHATSAPP_CLOUD_ALLOWED_USERS (and WHATSAPP_CLOUD_ALLOW_ALL_USERS), but the adapter DM intake gate only read WHATSAPP_CLOUD_ALLOW_FROM + WHATSAPP_CLOUD_DM_POLICY (default open, opted-in only via GATEWAY_/WHATSAPP_ALLOW_ALL_USERS). So an allowlist set via the documented var silently dropped every inbound (_should_process_message -> None -> HTTP 200, no dispatch, no log line). - _allow_from also reads WHATSAPP_CLOUD_ALLOWED_USERS - dm_policy defaults to allowlist when an allowlist is present (else open) - _open_dm_opted_in() also honors WHATSAPP_CLOUD_ALLOW_ALL_USERS Explicit DM_POLICY / ALLOW_FROM still win -> backward compatible.
teknium1
added a commit
that referenced
this pull request
Jul 5, 2026
…env vars Follow-up for salvaged #58448 which shipped without tests.
teknium1
added a commit
that referenced
this pull request
Jul 5, 2026
…env vars Follow-up for salvaged #58448 which shipped without tests.
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
…env vars Follow-up for salvaged NousResearch#58448 which shipped without tests.
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
…env vars Follow-up for salvaged NousResearch#58448 which shipped without tests.
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…env vars Follow-up for salvaged NousResearch#58448 which shipped without tests.
19 tasks
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
…env vars Follow-up for salvaged NousResearch#58448 which shipped without tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The WhatsApp Cloud setup wizard (
hermes whatsapp-cloud) and the Cloud API docs tell operators to setWHATSAPP_CLOUD_ALLOWED_USERS(and optionallyWHATSAPP_CLOUD_ALLOW_ALL_USERS).But the adapter's DM intake gate —
_should_process_message→_is_dm_intake_allowedinwhatsapp_common.py— only readsWHATSAPP_CLOUD_ALLOW_FROM+WHATSAPP_CLOUD_DM_POLICY(defaultopen, opted-in only viaGATEWAY_ALLOW_ALL_USERS/WHATSAPP_ALLOW_ALL_USERS).So an allowlist configured exactly as documented silently drops every inbound message:
_build_message_event_from_cloud→_should_process_messagereturnsFalse→ returnsNone→ webhook respondsHTTP 200, nothing is dispatched, and no log line is emitted.This is very hard to diagnose: the webhook verification,
X-Hub-Signature-256, app subscription, and WABAsubscribed_appsall look correct, and/healthshowsaccepted: 0withrejected_signature: 0. It reads exactly like "Meta isn't delivering," when in fact Meta is delivering and the message is dropped at the adapter gate.Fix
gateway/platforms/whatsapp_cloud.py:_allow_fromnow also readsWHATSAPP_CLOUD_ALLOWED_USERS(in addition toWHATSAPP_CLOUD_ALLOW_FROM).dm_policynow defaults toallowlistwhen an allowlist is configured (elseopen), so a documented allowlist is actually enforced instead of silently dropping._open_dm_opted_in()is overridden to also honorWHATSAPP_CLOUD_ALLOW_ALL_USERS.Explicit
WHATSAPP_CLOUD_DM_POLICY/WHATSAPP_CLOUD_ALLOW_FROMstill take precedence, so this is fully backward compatible.Testing
Verified on a live Cloud API test number:
WHATSAPP_CLOUD_ALLOWED_USERS=<listed>, noDM_POLICY/ALLOW_FROM): listed sender is processed, a non-listed sender is dropped,acceptedincrements only for the listed one. (Before this patch: both dropped,accepted: 0.)WHATSAPP_CLOUD_ALLOW_ALL_USERS=trueopens intake via the new_open_dm_opted_in()override.WHATSAPP_CLOUD_DM_POLICY=allowlist+WHATSAPP_CLOUD_ALLOW_FROMstill works unchanged.Note
Either the docs/wizard should point at
WHATSAPP_CLOUD_ALLOW_FROM/WHATSAPP_CLOUD_DM_POLICY, or (this PR) the adapter should honor the documented vars. Honoring the documented vars seems least-surprising for operators. Happy to also add a debug log when a DM is dropped by the intake gate if that's preferred — the silent drop was the hardest part to diagnose.