mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
test: stabilize quick-command redaction test against xdist ordering
agent.redact._REDACT_ENABLED is snapshotted at import time from HERMES_REDACT_SECRETS env. Under xdist a prior test in the same worker can flip it, so test_exec_command_output_is_redacted was order-dependent. Pin it via monkeypatch like test_terminal_output_transform_still_runs_strip_and_redact does.
This commit is contained in:
parent
f6736ced81
commit
28b4fe6007
1 changed files with 6 additions and 1 deletions
|
|
@ -179,10 +179,15 @@ class TestGatewayQuickCommands:
|
|||
"Quick command leaked OPENROUTER_API_KEY — exec runs without env sanitization"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_exec_command_output_is_redacted(self):
|
||||
async def test_exec_command_output_is_redacted(self, monkeypatch):
|
||||
"""Quick command output must redact sensitive patterns before returning."""
|
||||
from gateway.run import GatewayRunner
|
||||
|
||||
# Ensure redaction is active regardless of host HERMES_REDACT_SECRETS state
|
||||
# or test ordering (the module snapshots env at import time, so other
|
||||
# tests in the same xdist worker can flip the flag).
|
||||
monkeypatch.setattr("agent.redact._REDACT_ENABLED", True)
|
||||
|
||||
runner = GatewayRunner.__new__(GatewayRunner)
|
||||
runner.config = {"quick_commands": {"token": {"type": "exec", "command": "echo sk-ant-api03-supersecretkey1234567890"}}}
|
||||
runner._running_agents = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue