fix(tests): save/restore HERMES_CRON_SESSION in approval test teardown - #36791
Closed
kyssta-exe wants to merge 2 commits into
Closed
fix(tests): save/restore HERMES_CRON_SESSION in approval test teardown#36791kyssta-exe wants to merge 2 commits into
kyssta-exe wants to merge 2 commits into
Conversation
…recommendation The ┌─────────────────────────────────────────────────────────┐ │ ⚕ Hermes — OpenClaw Migration │ └─────────────────────────────────────────────────────────┘ ✗ OpenClaw directory not found: /root/.openclaw Make sure your OpenClaw installation is at the expected path. You can specify a custom path: hermes claw migrate --source /path/to/.openclaw command prints a recommendation to stop the gateway with 'hermes stop', but that is not a valid top-level command. The correct command is 'hermes gateway stop'. Closes NousResearch#36771
When HERMES_CRON_SESSION=1 leaks from the parent process (e.g. cron scheduler running before the test suite), the approval gateway test setup doesn't unset it. The approval code's _is_gateway_approval_context() checks CRON_SESSION before GATEWAY_SESSION, causing the timeout approval test to take the cron-path instead of the gateway-path. This leaked env var also affected the resume-quiet-stderr test, where _cprint output routing depends on whether a cron context is active. Fix: add HERMES_CRON_SESSION to the saved env vars in the approval test's setup_method, and explicitly pop it so the test gateway context is clean. Closes test failures: - TestApprovalTimeoutIsNotConsent::test_timeout_returns_approved_false_with_no_consent - TestResumeQuietStderr::test_session_not_found_goes_to_stdout_in_full_mode
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.
Problem
When
HERMES_CRON_SESSION=1leaks from the parent process (e.g. cron scheduler running before the test suite), two tests fail:TestApprovalTimeoutIsNotConsent::test_timeout_returns_approved_false_with_no_consent— takes the cron-path instead of gateway-path because_is_gateway_approval_context()checks CRON_SESSION before GATEWAY_SESSIONTestResumeQuietStderr::test_session_not_found_goes_to_stdout_in_full_mode—_cprintoutput routing depends on whether a cron context is activeFix
Added
HERMES_CRON_SESSIONto the saved env vars inTestApprovalTimeoutIsNotConsent.setup_method(), and explicitly.pop()it to ensure a clean gateway test context.Testing
tests/tools/test_approval.py::TestApprovalTimeoutIsNotConsent— 4/4 passingtests/cli/test_resume_quiet_stderr.py— 4/4 passingThis is a test-infrastructure fix that prevents environment-dependent test failures in CI or local runs when cron jobs are active.