Skip to content

fix(cron): include yuanbao in _HOME_TARGET_ENV_VARS - #24987

Open
AhmetArif0 wants to merge 2 commits into
NousResearch:mainfrom
AhmetArif0:fix/cron-yuanbao-home-target
Open

fix(cron): include yuanbao in _HOME_TARGET_ENV_VARS#24987
AhmetArif0 wants to merge 2 commits into
NousResearch:mainfrom
AhmetArif0:fix/cron-yuanbao-home-target

Conversation

@AhmetArif0

Copy link
Copy Markdown
Contributor

Summary

  • yuanbao is listed in _KNOWN_DELIVERY_PLATFORMS but was absent from _HOME_TARGET_ENV_VARS
  • _get_home_target_chat_id("yuanbao") always returned "", making Yuanbao cron home-channel delivery silently fail
  • YUANBAO_HOME_CHANNEL is already read by gateway/config.py, gateway/platforms/yuanbao.py, and hermes_cli/config.py — the env var is fully wired, it just needed one entry here

Same omission pattern fixed for WhatsApp in d8c4460.

Root cause

_HOME_TARGET_ENV_VARS and _KNOWN_DELIVERY_PLATFORMS drifted out of sync when Yuanbao cron delivery was added. WhatsApp had the identical gap and was patched in the same file today; Yuanbao was missed.

Test plan

  • Set YUANBAO_HOME_CHANNEL=<group_code> and schedule a cron job with deliver: home on a Yuanbao-connected gateway — message should arrive in the configured group
  • Existing cron delivery tests pass: pytest tests/gateway/ -k cron
  • _get_home_target_chat_id("yuanbao") returns the env var value when YUANBAO_HOME_CHANNEL is set

…reset hook contexts

_handle_message_with_agent() emits session:start and _handle_reset_command()
emits session:end and session:reset, but none of them included chat_id in the
hook context. Hook authors who subscribe to session lifecycle events cannot
identify which conversation the session belongs to, making routing (e.g.
sending a welcome message on session:start or cleanup on session:end) impossible.

Fix: mirror the "chat_id": source.chat_id or "" field added to agent:start
by NousResearch#24710 into the three sibling session hooks. source is in scope at all
three emit sites and chat_id is a required str field on SessionSource.
yuanbao is listed in _KNOWN_DELIVERY_PLATFORMS but was absent from
_HOME_TARGET_ENV_VARS, so _get_home_target_chat_id("yuanbao") always
returned "" and cron jobs targeting Yuanbao's home channel were silently
undeliverable.

YUANBAO_HOME_CHANNEL is already read by gateway/config.py,
gateway/platforms/yuanbao.py, and hermes_cli/config.py — the env var
exists and is fully wired; it just needed registering here.

Same omission pattern fixed for WhatsApp in d8c4460.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cron Cron scheduler and job management comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists labels May 13, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracing the Yuanbao delivery gap. Current main confirms the cron premise: yuanbao is accepted in cron/scheduler.py:204, but has no _HOME_TARGET_ENV_VARS entry at cron/scheduler.py:213; the resolver therefore returns an empty target at cron/scheduler.py:997-1001 and drops the delivery at cron/scheduler.py:1168-1172.

Problems

  • The PR has no regression test for the cron fix. Its only test additions are session-hook tests, while the relevant scheduler registry coverage is in tests/cron/test_scheduler.py:4084.
  • The bundled session-hook commit is no longer at the current reset locations: session:end and session:reset now emit in gateway/slash_commands.py:239 and gateway/slash_commands.py:246, rather than the gateway/run.py locations in this PR.

Suggested changes

  • Add a scheduler test that sets YUANBAO_HOME_CHANNEL and verifies deliver: yuanbao resolves to that target.
  • Keep the Yuanbao cron fix focused; split the hook-context work into a separate update against the current emit sites.

Automated hermes-sweeper review.

Comment thread cron/scheduler.py
"bluebubbles": "BLUEBUBBLES_HOME_CHANNEL",
"qqbot": "QQBOT_HOME_CHANNEL",
"whatsapp": "WHATSAPP_HOME_CHANNEL",
"yuanbao": "YUANBAO_HOME_CHANNEL",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a scheduler regression test alongside this mapping, e.g. set YUANBAO_HOME_CHANNEL and assert _resolve_delivery_targets({"deliver": "yuanbao", "origin": None}) resolves the configured target. The PR's current test changes cover unrelated session hooks.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 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 comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants