From e86b6e55abd6d581e9057fd2e7f4e4f2cbe1fb78 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Tue, 15 Sep 2026 12:42:50 -0700 Subject: [PATCH] test(approval): neutralize a host --yolo env in the cancelled-attribution tests _YOLO_MODE_FROZEN is read from HERMES_YOLO_MODE at import; a host shell running yolo auto-approved the gate under test so the prompt was never enqueued. --- tests/tools/test_approval_cancelled_attribution.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/tools/test_approval_cancelled_attribution.py b/tests/tools/test_approval_cancelled_attribution.py index 6d45a0e9f0..608bdc5b80 100644 --- a/tests/tools/test_approval_cancelled_attribution.py +++ b/tests/tools/test_approval_cancelled_attribution.py @@ -4,7 +4,6 @@ Teardown paths (a parent's ``delegate_task`` finishing, ``unregister_gateway_not end, a ``/stop``) end the wait fail-closed, but the tool result carries ``outcome="cancelled"`` and the cause instead of "denied by user" (#112026, #22992). """ -import os import threading import pytest @@ -25,6 +24,9 @@ def gateway_session(monkeypatch): monkeypatch.delenv(k, raising=False) monkeypatch.setenv("HERMES_GATEWAY_SESSION", "1") monkeypatch.setenv("HERMES_SESSION_KEY", SESSION_KEY) + # ``--yolo`` is frozen at import from HERMES_YOLO_MODE; a host shell running yolo must not + # auto-approve the gate under test. + monkeypatch.setattr(mod, "_YOLO_MODE_FROZEN", False) monkeypatch.setattr(approval_context, "_get_approval_config", lambda: {"mode": "manual", "timeout": 60}) hooks = [] original = approval_context._fire_approval_hook @@ -48,7 +50,7 @@ def _run_gate_until_pending(): thread = threading.Thread(target=worker) thread.start() - assert notified.wait(timeout=5), "approval was never enqueued" + assert notified.wait(timeout=10), "approval was never enqueued" return thread, holder