Skip to content

fix(cron): include whatsapp in _HOME_TARGET_ENV_VARS - #22998

Closed
dhruv-saxena wants to merge 1 commit into
NousResearch:mainfrom
dhruv-saxena:fix/cron-whatsapp-home-channel
Closed

dhruv-saxena wants to merge 1 commit into
NousResearch:mainfrom
dhruv-saxena:fix/cron-whatsapp-home-channel

Conversation

@dhruv-saxena

Copy link
Copy Markdown
Contributor

Summary

Cron jobs configured with deliver: whatsapp were silently dropped — the agent ran, output was saved, jobs.json marked success, but no WhatsApp message was sent and no error was logged.

Root cause: cron/scheduler.py defines _HOME_TARGET_ENV_VARS, the dict the cron resolver uses to look up each platform's home-channel env var. Every messaging platform was in there except whatsapp (matrix, telegram, discord, slack, signal, mattermost, sms, email, dingtalk, feishu, wecom, weixin, bluebubbles, qqbot — but no whatsapp). So _resolve_delivery_targets({"deliver": "whatsapp"}) returned [], and the caller treats "no targets" as a no-op.

The gateway adapter and the send_message tool path both already honored WHATSAPP_HOME_CHANNEL correctly — direct sends worked fine. Only the cron path missed.

Change

One-line addition to _HOME_TARGET_ENV_VARS:

"whatsapp": "WHATSAPP_HOME_CHANNEL",

Verification

Before the fix:

from cron.scheduler import _resolve_delivery_targets
job = {"id": "x", "name": "x", "deliver": "whatsapp"}
_resolve_delivery_targets(job)  # []

After:

_resolve_delivery_targets(job)  # [{'platform': 'whatsapp', 'chat_id': '...', 'thread_id': None}]

End-to-end: scheduled three successive deliver: whatsapp cron pings (1 minute each) — all landed in the WhatsApp self-chat after this patch was applied to a running gateway. Before the patch, none arrived.

Fixes #22997

Cron jobs using `deliver: whatsapp` were silently dropped because the
resolver's home-channel env var dict in cron/scheduler.py listed every
messaging platform except whatsapp. _resolve_delivery_targets() returned
[] and no message was sent — but jobs.json marked the run successful and
no log line surfaced the failure.

The gateway adapter and the send_message tool path both honored
WHATSAPP_HOME_CHANNEL correctly; only the cron path missed.

Adds 'whatsapp' -> 'WHATSAPP_HOME_CHANNEL' to _HOME_TARGET_ENV_VARS.
Verified end-to-end with multiple cron pings landing in WhatsApp
self-chat after the fix.

Fixes NousResearch#22997
@alt-glitch alt-glitch added type/bug Something isn't working comp/cron Cron scheduler and job management platform/whatsapp WhatsApp Business adapter P2 Medium — degraded but workaround exists labels May 10, 2026
@Bartok9

Bartok9 commented May 10, 2026

Copy link
Copy Markdown
Contributor

Same root cause and same one-line fix as #23067 (which I just closed in favor of this one — filed 2 hours earlier).

The fix is correct. The only addition worth considering: the _KNOWN_DELIVERY_PLATFORMS set at the top of scheduler.py (if one exists) should also include whatsapp to stay in sync, but that's a minor nit if it's used elsewhere for platform validation.

@teknium1

Copy link
Copy Markdown
Collaborator

Merged via PR #24659 (cherry-picked onto current main with your authorship preserved). Thanks for the contribution!

@teknium1 teknium1 closed this May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management P2 Medium — degraded but workaround exists platform/whatsapp WhatsApp Business adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cron silently drops deliver: whatsapp — _HOME_TARGET_ENV_VARS missing whatsapp entry

4 participants