hermes - 💡(How to fix) Fix test: approval_isolation test fails when HERMES_CRON_SESSION=1 in parent env

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

In tools/approval.py line 1090-1104, when HERMES_CRON_SESSION is set and the command is flagged as dangerous, the cron deny mode blocks execution before the non-interactive auto-approve path at line 1105 can fire.

Fix Action

Fix

Add monkeypatch.delenv("HERMES_CRON_SESSION", raising=False) to the test's env cleanup (line 215 of tests/acp/test_approval_isolation.py).

RAW_BUFFERClick to expand / collapse

Bug Description

The test test_interactive_env_var_routes_to_callback in tests/acp/test_approval_isolation.py fails intermittently when HERMES_CRON_SESSION=1 is set in the parent process environment.

Steps to Reproduce

  1. Run the test in an environment where HERMES_CRON_SESSION=1 is set (e.g., a cron session or a session spawned by the cron scheduler)
  2. The test deletes HERMES_INTERACTIVE, HERMES_GATEWAY_SESSION, HERMES_EXEC_ASK, and HERMES_YOLO_MODE but NOT HERMES_CRON_SESSION
  3. The command rm -rf /tmp/test-exec-ask is flagged as dangerous ("delete in root path")
  4. The cron deny mode kicks in and blocks the command
  5. Test expects approved=True but gets approved=False

Expected Behavior

The test should fully isolate its environment by cleaning up HERMES_CRON_SESSION alongside the other env vars it already cleans.

Actual Behavior

The test passes in a clean environment but fails when HERMES_CRON_SESSION leaks from the parent process.

Root Cause

In tools/approval.py line 1090-1104, when HERMES_CRON_SESSION is set and the command is flagged as dangerous, the cron deny mode blocks execution before the non-interactive auto-approve path at line 1105 can fire.

Fix

Add monkeypatch.delenv("HERMES_CRON_SESSION", raising=False) to the test's env cleanup (line 215 of tests/acp/test_approval_isolation.py).

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix test: approval_isolation test fails when HERMES_CRON_SESSION=1 in parent env