fix(cron): register whatsapp_cloud delivery target - #61146
Conversation
Duplicate of #57093 — both add |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating the cron allowlist drift. The scheduler change addresses a real current-main defect: cron/scheduler.py:229 maps whatsapp_cloud to its home channel, while the built-in admission gate at cron/scheduler.py:204-209 omits it and _resolve_single_delivery_target() rejects it at cron/scheduler.py:1168-1170.
Problems
- The same drift remains in webhook agent-mode delivery.
gateway/platforms/webhook.py:73-78omitswhatsapp_cloudfrom_BUILTIN_DELIVER_PLATFORMS;WebhookAdapter.send()then rejects it atgateway/platforms/webhook.py:289-303withUnknown deliver type.
Suggested changes
- Extend the fix and regression coverage to the webhook allowlist and
WebhookAdapter.send()path. Canonical PR #57093 already contains that broader paired fix.
Automated hermes-sweeper review.
| "matrix", "mattermost", "homeassistant", "dingtalk", "feishu", | ||
| "wecom", "wecom_callback", "weixin", "sms", "email", "webhook", "bluebubbles", | ||
| "qqbot", "yuanbao", | ||
| "qqbot", "yuanbao", "whatsapp_cloud", |
There was a problem hiding this comment.
Please pair this with the corresponding whatsapp_cloud addition in gateway/platforms/webhook.py:_BUILTIN_DELIVER_PLATFORMS. Its agent-mode send() gate otherwise still rejects this valid built-in platform as Unknown deliver type.
Problem
whatsapp_cloudis a built-in gateway platform withWHATSAPP_CLOUD_HOME_CHANNEL, but cron delivery validation did not include it in_KNOWN_DELIVERY_PLATFORMS. A baredeliver=whatsapp_cloudjob therefore failed target resolution before reading the configured home channel.Fixes #59988.
Root cause
cron/scheduler.pyhad two platform registries:_HOME_TARGET_ENV_VARSalready listedwhatsapp_cloud, while_KNOWN_DELIVERY_PLATFORMSdid not._resolve_delivery_target()checks_is_known_delivery_platform()before_get_home_target_chat_id(), so the home-channel mapping was unreachable.Fix
Add
whatsapp_cloudto_KNOWN_DELIVERY_PLATFORMSand extend cron tests so both direct delivery resolution and the registry guard cover it.Tests
scripts/run_tests.sh tests/cron/test_scheduler.py -k 'HomeTargetEnvVarRegistry or origin_delivery_without_origin_falls_back_to_supported_home_channels' -q$HOME/.hermes/hermes-agent/venv/bin/python -m ruff check cron/scheduler.py tests/cron/test_scheduler.pygit diff --check