Skip to content

fix(approval): ignore leaked HERMES_CRON_SESSION in interactive sessions (#56771) - #644

Open
hashbender wants to merge 1 commit into
mainfrom
mirror/pr-56788
Open

hashbender wants to merge 1 commit into
mainfrom
mirror/pr-56788

Conversation

@hashbender

Copy link
Copy Markdown
Owner

Summary

  • Add _is_cron_approval_context() so HERMES_CRON_SESSION alone does not classify a call as cron when a live interactive session is active.
  • Interactive overrides: HERMES_GATEWAY_SESSION, interactive CLI flag, or a bound HERMES_SESSION_KEY contextvar.
  • Real cron jobs (including delivery-metadata platform bindings without a session key) still honor approvals.cron_mode.

Fixes NousResearch#56771

Why

The cron scheduler sets HERMES_CRON_SESSION process-wide. When that env leaks into a Telegram/gateway session, execute_code was blocked with the cron-deny message even though a user was present to approve.

Test plan

  • pytest tests/tools/test_cron_session_env_leak_56771.py (3/3)
  • pytest tests/tools/test_cron_approval_mode.py tests/tools/test_execute_code_approval_cluster.py (48/48)

Mirror-of: NousResearch#56788
NousResearch#56788

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: execute_code blocked in interactive Telegram gateway session because HERMES_CRON_SESSION env var leaks from cron scheduler into user's shell

1 participant