# NousResearch/hermes-agent · HERMES_CRON_SESSION env var leaking into interactive gateway sessions

## Open now

- 1 issue, 7 PRs open on GitHub.
- #60350: \[Bug\] execute_code blocked in WeCom gateway session — HERMES_CRON_SESSION env var leaks from in-process cron ticker (corroborating #56771)
- PR #29854: fix(cron): restore cron session environment after jobs
- PR #35515: fix(cron): restore cron session env after jobs
- PR #56784: fix(approval): let gateway session indicators override process-wide cron flag
- PR #57124: fix(cron): clean up HERMES_CRON_SESSION env var after each job run (#56771)
- PR #59719: fix(cron): scope approval marker to cron execution context (#58662)
- PR #60077: fix(approval): gate unattended VCS mutations
- PR #60611: fix(cron): clean up HERMES_CRON_SESSION env var after job completes (#60350)

Nearly all members concern the process-wide HERMES_CRON_SESSION marker set by the in-process cron ticker, which is reported to affect approval behavior (e.g., blocking execute_code) in interactive gateway sessions, along with proposed cleanup, restoration, or scoping changes. One member, about gating unattended VCS mutations, appears only loosely related.

## TL;DR

- 23 member(s): 1 open issue(s), 6 closed issue(s), 7 open PR(s), 1 merged PR(s), 8 PR(s) closed without merging.
- A fix was merged to main in PR #77022. Verify it addresses your case.
- **Recommended:** read PR #77022 (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: `partially_resolved` · deciding PR(s): `pr-77022`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_PARTIAL`): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text.
- Members outside that structural core may belong to a different underlying problem.
- Pairwise link density `0.10`: 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.

## Open related issues

- #60350: \[Bug\] execute_code blocked in WeCom gateway session — HERMES_CRON_SESSION env var leaks from in-process cron ticker (corroborating #56771)

## Closed / duplicate issues

- #37968: fix(cron): isolate gateway approvals from environment pollution
- #56771: \[Bug\]: \`execute_code\` blocked in interactive Telegram gateway session because \`HERMES_CRON_SESSION\` env var leaks from cron scheduler into user's shell
- #57736: HERMES_CRON_SESSION set process-globally: interactive gateway sessions inherit cron approval policy after any cron runs
- #58662: \[Bug\]: in-process cron ticker leaks its approval marker into interactive gateway sessions
- #59236: Follow up: avoid process-wide cron marker leaking into later interactive gateway approvals
- #60997: fix: HERMES_CRON_SESSION env var leaks into global process context, blocking execute_code in user sessions

## Prior & competing PRs

- **#56788: fix(approval): ignore leaked HERMES_CRON_SESSION in interactive sessions (#56771)**. closed without merge · fix tier `suggested`
  - maintainer direction: category `uncategorized`; implication `needs_llm`; refs `#56771`, `#56784`, `#56796`
  - _suggested-tier fix detail withheld; re-request with `?tier=all` to include it._
- **#60386: fix(cron): clean up HERMES_CRON_SESSION env var after each job to prevent process-wide leak into gateway sessions**. closed without merge · fix tier `suggested`
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#57124`, `#56771`, `#59242`, `#56796`, `#56784`
  - _suggested-tier fix detail withheld; re-request with `?tier=all` to include it._
- **#77022: fix(cron): scope cron approval context per session**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `acp_adapter/server.py`, `cron/scheduler.py`, `gateway/platforms/api_server.py`, `gateway/run.py`, `gateway/session_context.py`, `tests/cron/conftest.py`, `tests/cron/test_scheduler_cron_session_isolation.py`, `tests/gateway/test_session_env.py`, `tests/tools/test_cron_approval_mode.py`, `tests/tools/test_execute_code_approval_cluster.py`, `tests/tools/test_request_tool_approval.py`, `tools/approval.py`, `tools/environments/base.py`, `tui_gateway/server.py`
- **#29854: fix(cron): restore cron session environment after jobs**. open
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `9c4b5aff69ac045d65c5e3aeb6181cc81376843d`
  - files: `cron/scheduler.py`, `tests/cron/test_cron_approval_context.py`, `tools/approval.py`
- **#35515: fix(cron): restore cron session env after jobs**. open
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#43549`, `#29854`
  - files: `cron/scheduler.py`, `tests/cron/test_scheduler.py`
- **#37969: fix(cron): isolate gateway approvals from environment pollution**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#77022`, `#43370`
- **#43370: Fix cron session context isolation**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#77022`
- **#43549: fix(cron): restore HERMES_CRON_SESSION after jobs**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#77022`
- **#56784: fix(approval): let gateway session indicators override process-wide cron flag**. open
  - maintainer direction: category `uncategorized`; implication `needs_llm`
  - files: `tests/tools/test_approval.py`, `tests/tools/test_cron_approval_mode.py`, `tools/approval.py`
- **#56796: fix(approval): use per-job ContextVar for cron-session flag instead of leaking env var (#56771)**. closed without merge
  - maintainer direction: category `uncategorized`; implication `needs_llm`; refs `#56771`, `#57736`, `#60350`, `#56796`, `#57124`, `#59242`, `#56784`, `#57169`, `#36004`
- **#57124: fix(cron): clean up HERMES_CRON_SESSION env var after each job run (#56771)**. open
  - maintainer direction: category `uncategorized`; implication `needs_llm`
  - files: `cron/scheduler.py`
- **#58663: fix(security): scope the cron-session approval marker to the job context**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `a168b599b8`
- **#59242: fix(cron): clean up HERMES_CRON_SESSION env var after each job run (#59236)**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#57124`
- **#59719: fix(cron): scope approval marker to cron execution context (#58662)**. open
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#58663`, `#58662`, `#57169`
  - files: `cron/scheduler.py`, `gateway/session_context.py`, `tests/cron/test_approval_marker_isolation.py`, `tools/approval.py`
- **#60077: fix(approval): gate unattended VCS mutations**. open
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `c60b2bad5`
  - files: `gateway/kanban_watchers.py`, `gateway/run.py`, `gateway/session_context.py`, `skills/research/research-paper-writing/references/experiment-patterns.md`, `tests/gateway/test_42039_duplicate_user_message.py`, `tests/gateway/test_approve_deny_commands.py`, `tests/gateway/test_first_turn_session_meta_rebaseline.py`, `tests/gateway/test_footer_command_mid_run.py`, `tests/gateway/test_gateway_command_dispatch_minimal.py`, `tests/gateway/test_gateway_silence_tokens.py`, `tests/gateway/test_incomplete_gateway_turns.py`, `tests/gateway/test_priority_path_compression_demotion_56391.py`, `tests/gateway/test_queue_command.py`, `tests/gateway/test_reload_skills_command.py`, `tests/gateway/test_running_agent_session_toggles.py`, `tests/gateway/test_session_context_inheritance.py`, `tests/gateway/test_session_env.py`, `tests/gateway/test_session_hygiene.py`, `tests/gateway/test_slash_access_dispatch.py`, `tests/gateway/test_stacked_skill_platform_disabled.py` (+8 more)
- **#60611: fix(cron): clean up HERMES_CRON_SESSION env var after job completes (#60350)**. open
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#57124`, `#60350`, `#56771`, `#60386`
  - files: `cron/scheduler.py`

## Fix status

- Merged to main in PR #77022 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-08-02`.
- Subsystem: `cron`
- Kind: `bug` (from the open issues' GitHub type labels).
