fix(cron): include yuanbao in _HOME_TARGET_ENV_VARS - #24987
Open
AhmetArif0 wants to merge 2 commits into
Open
Conversation
…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.
8 tasks
Open
8 tasks
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
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:endandsession:resetnow emit ingateway/slash_commands.py:239andgateway/slash_commands.py:246, rather than thegateway/run.pylocations in this PR.
Suggested changes
- Add a scheduler test that sets
YUANBAO_HOME_CHANNELand verifiesdeliver: yuanbaoresolves 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.
| "bluebubbles": "BLUEBUBBLES_HOME_CHANNEL", | ||
| "qqbot": "QQBOT_HOME_CHANNEL", | ||
| "whatsapp": "WHATSAPP_HOME_CHANNEL", | ||
| "yuanbao": "YUANBAO_HOME_CHANNEL", |
Contributor
There was a problem hiding this comment.
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.
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.
Summary
yuanbaois listed in_KNOWN_DELIVERY_PLATFORMSbut was absent from_HOME_TARGET_ENV_VARS_get_home_target_chat_id("yuanbao")always returned"", making Yuanbao cron home-channel delivery silently failYUANBAO_HOME_CHANNELis already read bygateway/config.py,gateway/platforms/yuanbao.py, andhermes_cli/config.py— the env var is fully wired, it just needed one entry hereSame omission pattern fixed for WhatsApp in d8c4460.
Root cause
_HOME_TARGET_ENV_VARSand_KNOWN_DELIVERY_PLATFORMSdrifted 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
YUANBAO_HOME_CHANNEL=<group_code>and schedule a cron job withdeliver: homeon a Yuanbao-connected gateway — message should arrive in the configured grouppytest tests/gateway/ -k cron_get_home_target_chat_id("yuanbao")returns the env var value whenYUANBAO_HOME_CHANNELis set