fix(test): mock _YOLO_MODE_FROZEN in test_yolo_overrides_cron_deny - #32014
Closed
talwayh1 wants to merge 1 commit into
Closed
fix(test): mock _YOLO_MODE_FROZEN in test_yolo_overrides_cron_deny#32014talwayh1 wants to merge 1 commit into
talwayh1 wants to merge 1 commit into
Conversation
_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).
This was referenced May 25, 2026
Contributor
|
Thanks for the focused test-isolation fix. This is already implemented on current
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fix
test_yolo_overrides_cron_deny— the test was broken by the_YOLO_MODE_FROZENsecurity hardening (module-level freeze at import time).Root Cause
_YOLO_MODE_FROZENis frozen attools/approval.pymodule import time and ignoresmonkeypatch.setenv('HERMES_YOLO_MODE', '1'). The test expected the yolo bypass (line 948) to fire before the cron deny path, but the frozen value remainedFalsefrom import time, causingcheck_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.pypass:Related