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.
This commit is contained in:
Teknium
2026-03-31 10:30:15 -07:00
committed by Teknium
parent 6dcc3330b3
commit fad3f338d1

View File

@@ -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: