# NousResearch/hermes-agent · Cron origin misidentified as live gateway sender

## Open now

- Nothing open on GitHub.

These items address a bug where cron delivery origin was incorrectly seeding or being treated as a live gateway sender identity, affecting tool access-control and session context variables.

## TL;DR

- 3 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 1 PR(s) closed without merging.
- A fix was merged to main in PR #22382. Verify it addresses your case.
- **Recommended:** read PR #22382 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `resolved` · deciding PR(s): `pr-22382`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.67`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #22351: Cron delivery origin should not seed live gateway sender identity for tool access-control

## Prior & competing PRs

- **#22382: fix(cron): do not seed HERMES_SESSION_* contextvars from cron origin (salvage of #22356)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `cron/scheduler.py`, `scripts/release.py`
  - fix hunks:
  - `cron/scheduler.py`

    ```diff
    @@ -1204,10 +1204,31 @@ def run_job(job: dict) -> tuple[bool, str, str, Optional[str]]:
         # don't clobber each other's targets (os.environ is process-global).
         from gateway.session_context import set_session_vars, clear_session_vars, _VAR_MAP
     
    +    # Cron execution is an internal scheduler context, not a live inbound
    +    # gateway message. Do not seed HERMES_SESSION_* contextvars from the
    +    # stored ``origin`` (which is delivery routing metadata, not a sender
    +    # identity). Several tool consumers branch on these vars during job
    +    # execution and would otherwise behave as if a real user from the
    +    # origin chat was driving the agent:
    +    #   - tools/terminal_tool.py: background-process notification routing
    +    #     (notify_on_complete / watch_patterns) reads HERMES_SESSION_PLATFORM
    +    #     and HERMES_SESSION_CHAT_ID to populate watcher_platform / chat_id,
    +    #     which would route completion notifications to the origin chat
    +    #     instead of via HERMES_CRON_AUTO_DELIVER_* below.
    +    #   - tools/tts_tool.py: picks Opus vs MP3 based on
    +    #     HERMES_SESSION_PLATFORM == "telegram".
    +    #   - tools/skills_tool.py + agent/prompt_builder.py: per-platform
    +    #     skill-disable lists and the system-prompt cache key both consume
    +    #     HERMES_SESSION_PLATFORM.
    +    #   - tools/send_message_tool.py: mirror source labelling and the
    +    #     send_message gate read HERMES_SESSION_PLATFORM.
    +    # Cron output delivery itself reads job["origin"] directly via
    +    # _resolve_origin(job) and the HERMES_CRON_AUTO_DELIVER_* vars set
    +    # below, so clearing HERMES_SESSION_* here does not affect delivery.
         _ctx_tokens = set_session_vars(
    -        platform=origin["platform"] if origin else "",
    -        chat_id=str(origin["chat_id"]) if origin else "",
    -        chat_name=origin.get("chat_name", "") if origin else "",
    +        platform="",
    +        chat_id="",
    +        chat_name="",
         )
         _cron_delivery_vars = (
             "HERMES_CRON_AUTO_DELIVER_PLATFORM",
    ```
  - `scripts/release.py`

    ```diff
    @@ -909,6 +909,7 @@
         "[redacted:email]": "firefly",  # PR #18123 salvage of #16660 (ContextVars)
         "[redacted:email]": "WuTianyi123",  # PR #20275 salvage of #13723 (feishu markdown)
         "[redacted:email]": "hanzckernel",  # PR #20311 (api-server approval events)
    +    "[redacted:email]": "oferlaor",  # PR #22356 salvage (cron origin sender identity)
         # pander: empty email, salvaged via PR #19665 from #16126 by @ms-alan
     }
     
    ```
- **#22356: fix(cron): do not treat delivery origin as live gateway sender identity**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `dbafa083b`, `#22382`, `#22351`

## Fix status

- Merged to main in PR #22382 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-05-09`.
