From fad3f338d1a9e68f923f35566beaa45548796041 Mon Sep 17 00:00:00 2001 From: Teknium Date: Tue, 31 Mar 2026 10:30:15 -0700 Subject: [PATCH] fix: patch _REDACT_ENABLED in test fixture for module-level snapshot The _REDACT_ENABLED constant is snapshotted at import time, so monkeypatch.delenv() alone doesn't re-enable redaction during tests when HERMES_REDACT_SECRETS=false is set in the host environment. --- tests/agent/test_redact.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/agent/test_redact.py b/tests/agent/test_redact.py index 27098ee6d..6b7cfa586 100644 --- a/tests/agent/test_redact.py +++ b/tests/agent/test_redact.py @@ -12,6 +12,8 @@ from agent.redact import redact_sensitive_text, RedactingFormatter def _ensure_redaction_enabled(monkeypatch): """Ensure HERMES_REDACT_SECRETS is not disabled by prior test imports.""" monkeypatch.delenv("HERMES_REDACT_SECRETS", raising=False) + # Also patch the module-level snapshot so it reflects the cleared env var + monkeypatch.setattr("agent.redact._REDACT_ENABLED", True) class TestKnownPrefixes: