mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-13 03:52:00 +00:00
fix(approval): cron jobs must not be treated as gateway context
The new _is_gateway_approval_context() widened the gateway classification to any call with HERMES_SESSION_PLATFORM bound via contextvars. But cron/scheduler.py binds that same contextvar for delivery routing on cron jobs that originate from a gateway platform (telegram/discord/etc.), so those jobs were getting routed through submit_pending with no listener — blocking indefinitely instead of honoring approvals.cron_mode. Short-circuit on HERMES_CRON_SESSION before any gateway check. Cron is always governed by cron_mode config, regardless of where the job was scheduled from. Adds regression coverage in TestCronWithGatewayOrigin and records the contributor email mapping for scripts/release.py.
This commit is contained in:
parent
526c0e018a
commit
839cdd1b05
3 changed files with 84 additions and 0 deletions
|
|
@ -100,7 +100,16 @@ def _is_gateway_approval_context() -> bool:
|
|||
Legacy gateway integrations set HERMES_GATEWAY_SESSION in process env.
|
||||
Newer concurrent gateway paths bind HERMES_SESSION_PLATFORM via
|
||||
contextvars so approval mode does not depend on process-global flags.
|
||||
|
||||
Cron jobs are NEVER gateway-approval contexts even when they originate
|
||||
from a gateway platform (cron binds HERMES_SESSION_PLATFORM via
|
||||
contextvars for delivery routing). Cron approvals are governed by
|
||||
``approvals.cron_mode`` config, not interactive resolve — letting cron
|
||||
fall through to the gateway branch would submit a pending approval
|
||||
with no listener and block the job indefinitely.
|
||||
"""
|
||||
if os.getenv("HERMES_CRON_SESSION"):
|
||||
return False
|
||||
if os.getenv("HERMES_GATEWAY_SESSION"):
|
||||
return True
|
||||
return bool(_get_session_platform())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue