Skip to content

fix(test): mock _YOLO_MODE_FROZEN in test_yolo_overrides_cron_deny - #32014

Closed
talwayh1 wants to merge 1 commit into
NousResearch:mainfrom
talwayh1:ci-fix/yolo-frozen-cron-test
Closed

fix(test): mock _YOLO_MODE_FROZEN in test_yolo_overrides_cron_deny#32014
talwayh1 wants to merge 1 commit into
NousResearch:mainfrom
talwayh1:ci-fix/yolo-frozen-cron-test

Conversation

@talwayh1

Copy link
Copy Markdown

What

Fix test_yolo_overrides_cron_deny — the test was broken by the _YOLO_MODE_FROZEN security hardening (module-level freeze at import time).

Root Cause

_YOLO_MODE_FROZEN is frozen at tools/approval.py module import time and ignores monkeypatch.setenv('HERMES_YOLO_MODE', '1'). The test expected the yolo bypass (line 948) to fire before the cron deny path, but the frozen value remained False from import time, causing check_dangerous_command() to fall through to the cron deny block.

Fix

monkeypatch.setattr(approval_module, '_YOLO_MODE_FROZEN', True) so the yolo check evaluates correctly.

Verification

All 24 tests in tests/tools/test_cron_approval_mode.py pass:

24 passed in 0.75s

Related

_YOLO_MODE_FROZEN is frozen at tools/approval.py module import time and
ignores monkeypatch.setenv('HERMES_YOLO_MODE', '1').  The test expected
the yolo bypass to fire before the cron deny path, but the frozen value
was still False from import time, causing check_dangerous_command() to
fall through to the cron deny block.

Fix: monkeypatch.setattr(approval_module, '_YOLO_MODE_FROZEN', True)
so the yolo check at line 948 evaluates correctly.

Fixes CI failure in PR NousResearch#31959 (test (5) slice).
@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P3 Low — cosmetic, nice to have comp/tools Tool registry, model_tools, toolsets type/security Security vulnerability or hardening labels May 25, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused test-isolation fix. This is already implemented on current main.

  • Automated hermes-sweeper review verified the same direct _YOLO_MODE_FROZEN patch in tests/tools/test_cron_approval_mode.py:344.
  • The equivalent fix merged as PR test(approval): patch _YOLO_MODE_FROZEN directly in test_yolo_overrides_cron_deny #32019, commit 79799c80f576f111b92cedfcfbdbecee950cdff8, which is an ancestor of current main.
  • tools/approval.py:32-35 still intentionally freezes the process-scoped YOLO value at import time; the current test correctly patches that frozen value rather than weakening the security invariant.

@teknium1 teknium1 closed this Jul 13, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have sweeper:implemented-on-main Sweeper: behavior already present on current main type/security Security vulnerability or hardening type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants