Skip to content

The agent that grows with you

test(cli): stop leaking a real MCP discovery thread from the TUI launcher test

teknium1a702791371a5
diff --git a/tests/hermes_cli/test_tui_launcher_skips_plugin_discovery.py b/tests/hermes_cli/test_tui_launcher_skips_plugin_discovery.py
index e029cbce85c..935c10811dc 100644
--- a/tests/hermes_cli/test_tui_launcher_skips_plugin_discovery.py
+++ b/tests/hermes_cli/test_tui_launcher_skips_plugin_discovery.py
@@ -14,6 +14,7 @@ import sys
import types
from hermes_cli import main as main_mod
+from hermes_cli import mcp_startup
def _install_discover_spy(monkeypatch):
@@ -32,6 +33,16 @@ def _install_discover_spy(monkeypatch):
start_background_plugin_discovery=_discover,
),
)
+ # The plain-chat path also arms MCP discovery. Its config probe imports
+ # ``hermes_cli.plugins`` (replaced by the stub above), fails, and falls
+ # back to "assume configured", which spawned a REAL ``cli-mcp-discovery``
+ # daemon thread that was still importing ``tools.mcp_tool`` when pytest
+ # exited. A daemon thread inside a C-extension import at interpreter
+ # finalization dies via pthread_exit → glibc "FATAL: exception not
+ # rethrown" → SIGABRT. Plugin discovery is the only subject here.
+ monkeypatch.setattr(
+ mcp_startup, "start_background_mcp_discovery", lambda **_kw: None
+ )
return calls