Skip to content

The agent that grows with you

test: assert the fake kernel streams let the reader threads exit

teknium1d0b71c921d71
diff --git a/tests/tools/test_local_env_blocklist.py b/tests/tools/test_local_env_blocklist.py
index fc61e790d02..2f544c0a1be 100644
--- a/tests/tools/test_local_env_blocklist.py
+++ b/tests/tools/test_local_env_blocklist.py
@@ -11,6 +11,7 @@ See: https://github.com/NousResearch/hermes-agent/issues/1264
import os
import subprocess
import sys
+import threading
from pathlib import Path
from unittest.mock import MagicMock, patch
@@ -1102,6 +1103,15 @@ class TestPythonpathSelectiveStrip:
else:
assert norm_root not in norm_parts, \
"repo root must stay absent for an external-env child"
+ # The fake streams must hit EOF: the kernel's reader threads consume
+ # ``read1()``, and an unconfigured MagicMock there is a truthy value
+ # forever — the stderr reader spins after the test returns, growing
+ # the pytest process by hundreds of MB per second (#115912).
+ for thread in threading.enumerate():
+ if "_reader" in thread.name:
+ thread.join(timeout=2)
+ assert not thread.is_alive(), \
+ f"{thread.name} is still spinning on the fake kernel stream"
def test_repo_root_direct_child_preserved(self):