Skip to content

The agent that grows with you

fix(cli): route dependency hints through pm

ethernetfc4086c4c54d
diff --git a/hermes_cli/auth.py b/hermes_cli/auth.py
index 2b351e11163..a6430e1ae31 100644
--- a/hermes_cli/auth.py
+++ b/hermes_cli/auth.py
@@ -2045,9 +2045,9 @@ def _get_azure_foundry_auth_status() -> Dict[str, Any]:
"azure-identity is installed; live credential validation "
"is skipped here. Run `hermes doctor` to verify token acquisition."
) if installed else (
- "azure-identity not installed. Install with: "
- "pip install azure-identity (or rely on Hermes' "
- "lazy-install at first use)."))
+ "azure-identity not installed. From the Hermes environment, run: "
+ "python -c \"from pm import sync_venv; sync_venv(['azure-identity'], explicit=True)\". "
+ "Then restart Hermes."))
except Exception as exc:
info["logged_in"] = False
info["error"] = f"azure-identity check failed: {exc}"
diff --git a/hermes_cli/auth_commands.py b/hermes_cli/auth_commands.py
index 78c33037078..d23970ebb5b 100644
--- a/hermes_cli/auth_commands.py
+++ b/hermes_cli/auth_commands.py
@@ -653,7 +653,10 @@ def _print_azure_entra_status() -> None:
print(f" Endpoint: {base_url or '(not configured)'}")
print(f" Scope: {scope}")
if not has_azure_identity_installed():
- print(" Status: ⚠ azure-identity not installed (pip install azure-identity)")
+ print(" Status: ⚠ azure-identity not installed")
+ print(" From the Hermes environment, run: "
+ "python -c \"from pm import sync_venv; sync_venv(['azure-identity'], explicit=True)\"")
+ print(" Then restart Hermes.")
else:
info = describe_active_credential(config=EntraIdentityConfig(scope=scope), timeout_seconds=10.0)
env_sources = info.get("env_sources") or []
diff --git a/hermes_cli/cli_voice_mixin.py b/hermes_cli/cli_voice_mixin.py
index 9b02fe6685c..7cfd2664d07 100644
--- a/hermes_cli/cli_voice_mixin.py
+++ b/hermes_cli/cli_voice_mixin.py
@@ -10,7 +10,6 @@ from __future__ import annotations
import json
import os
import re
-import sys
import tempfile
import threading
import time
@@ -72,24 +71,22 @@ class CLIVoiceMixin:
if "Termux:API Android app is not installed" in reqs.get("details", ""):
raise RuntimeError(
"Termux:API command package detected, but the Android app is missing.\n"
- "Install/update the Termux:API Android app, then retry /voice on.\n"
- "Fallback: pkg install python-numpy portaudio && python -m pip install sounddevice"
+ "Install/update the Termux:API Android app, then retry /voice on."
)
raise RuntimeError(
- "Voice mode requires either Termux:API microphone access or Python audio libraries.\n"
- "Option 1: pkg install termux-api and install the Termux:API Android app\n"
- "Option 2: pkg install python-numpy portaudio && python -m pip install sounddevice"
+ "Voice mode needs microphone access.\n"
+ "Run pkg install termux-api and install the Termux:API Android app, "
+ "then retry /voice on."
)
raise RuntimeError(
"Voice mode requires sounddevice and numpy.\n"
- f"Install with: {sys.executable} -m pip install sounddevice numpy")
+ "From the Hermes environment, run: "
+ "python -c \"from pm import sync_venv; sync_venv(['audio-io'], explicit=True)\". "
+ "Then restart Hermes.")
if not reqs.get("stt_available", reqs.get("stt_key_set")):
raise RuntimeError(
"Voice mode requires an STT provider for transcription.\n"
- "Option 1: uv pip install faster-whisper "
- "(free, local; `pip install faster-whisper` also works if pip is on PATH)\n"
- "Option 2: Set GROQ_API_KEY (free tier)\n"
- "Option 3: Set VOICE_TOOLS_OPENAI_KEY (paid)")
+ "Run hermes tools and configure Speech-to-Text, then restart Hermes.")
# Prevent double-start from concurrent threads (atomic check-and-set)
with self._voice_lock:
@@ -505,11 +502,13 @@ class CLIVoiceMixin:
_cprint(f" {_DIM}{line}{_RST}")
if reqs["missing_packages"]:
if _is_termux_environment():
- _cprint(f"\n {_BOLD}Option 1: pkg install termux-api{_RST}")
+ _cprint(f"\n {_BOLD}Run: pkg install termux-api{_RST}")
_cprint(f" {_DIM}Then install/update the Termux:API Android app for microphone capture{_RST}")
- _cprint(f" {_BOLD}Option 2: pkg install python-numpy portaudio && python -m pip install sounddevice{_RST}")
else:
- _cprint(f"\n {_BOLD}Install: {sys.executable} -m pip install {' '.join(reqs['missing_packages'])}{_RST}")
+ _cprint(f"\n {_BOLD}From the Hermes environment, run: "
+ "python -c \"from pm import sync_venv; sync_venv(['audio-io'], explicit=True)\""
+ f"{_RST}")
+ _cprint(f" {_DIM}Then restart Hermes.{_RST}")
return
with self._voice_lock:
diff --git a/hermes_cli/doctor_connectivity.py b/hermes_cli/doctor_connectivity.py
index f5628c6b5cd..32b9b3fd20c 100644
--- a/hermes_cli/doctor_connectivity.py
+++ b/hermes_cli/doctor_connectivity.py
@@ -9,7 +9,6 @@ from __future__ import annotations
import concurrent.futures
import functools
import os
-import sys
from typing import NamedTuple
from hermes_cli.colors import Colors, color
@@ -232,8 +231,10 @@ def _probe_bedrock() -> ProbeResult:
n = len(client.list_foundation_models().get("modelSummaries", []))
return _row(name, "ok", f"({auth_var}, {region}, {n} models)", label=label)
except ImportError:
- pip = f"{sys.executable} -m pip install boto3"
- return _row(name, "warn", f"(boto3 not installed — {pip})", [f"Install boto3 for Bedrock: {pip}"], label=label)
+ hint = ("From the Hermes environment, run: "
+ "python -c \"from pm import sync_venv; sync_venv(['bedrock'], explicit=True)\". "
+ "Then restart Hermes.")
+ return _row(name, "warn", "(boto3 not installed)", [hint], label=label)
except Exception as e:
err_name = type(e).__name__
return _row(name, "warn", f"({err_name}: {e})", [f"AWS Bedrock: {err_name} — check IAM permissions for bedrock:ListFoundationModels"], label=label)
@@ -264,7 +265,9 @@ def _probe_azure_entra() -> ProbeResult:
except Exception as exc:
return _row(name, "warn", f"(adapter import failed: {exc})", [f"Azure Foundry adapter import failed: {exc}"], label=label)
if not has_azure_identity_installed():
- return _row(name, "warn", "(azure-identity not installed)", [f"Install azure-identity: {sys.executable} -m pip install azure-identity"], label=label)
+ return _row(name, "warn", "(azure-identity not installed)", ["From the Hermes environment, run: "
+ "python -c \"from pm import sync_venv; sync_venv(['azure-identity'], explicit=True)\". "
+ "Then restart Hermes."], label=label)
entra_cfg = model_cfg.get("entra") or {}
scope = (str(entra_cfg.get("scope") or "").strip() if isinstance(entra_cfg, dict) else "") or SCOPE_AI_AZURE_DEFAULT
info = describe_active_credential(config=EntraIdentityConfig(scope=scope), timeout_seconds=10.0)
diff --git a/hermes_cli/doctor_state.py b/hermes_cli/doctor_state.py
index 586efabaf9c..c36101dada4 100644
--- a/hermes_cli/doctor_state.py
+++ b/hermes_cli/doctor_state.py
@@ -470,10 +470,10 @@ def _memory_provider_mem0(issues: list) -> None:
# provider -> (checker, ImportError row, ImportError issue, label for "check failed")
_MEMORY_PROVIDER_CHECKS = {
- "honcho": (_memory_provider_honcho, ("honcho-ai not installed", "pip install honcho-ai"),
- "Honcho is set as memory provider but honcho-ai is not installed", "Honcho"),
- "mem0": (_memory_provider_mem0, ("Mem0 plugin not loadable", "pip install mem0ai"),
- "Mem0 is set as memory provider but mem0ai is not installed", "Mem0"),
+ "honcho": (_memory_provider_honcho, ("honcho-ai not installed", "run hermes memory setup"),
+ "Honcho dependencies missing — run hermes memory setup, then restart Hermes", "Honcho"),
+ "mem0": (_memory_provider_mem0, ("Mem0 plugin not loadable", "run hermes memory setup"),
+ "Mem0 dependencies missing — run hermes memory setup, then restart Hermes", "Mem0"),
}
diff --git a/hermes_cli/doctor_tools.py b/hermes_cli/doctor_tools.py
index cd34c7e33ac..a3cbae8e1b2 100644
--- a/hermes_cli/doctor_tools.py
+++ b/hermes_cli/doctor_tools.py
@@ -103,7 +103,7 @@ def _termux_browser_setup_steps(node_installed: bool) -> list[str]:
_TERMUX_INSTALL_ALL_FALLBACK_NOTES = (
- "Termux install profile: use .[termux-all] for broad compatibility (installer default on Termux).",
+ "Termux uses the Hermes APT package: pkg install hermes-agent.",
"Matrix E2EE extra is excluded on Termux (python-olm currently fails to build).",
"Local faster-whisper extra is excluded on Termux (ctranslate2/av build path unavailable).",
"STT fallback: use Groq Whisper (set GROQ_API_KEY) or OpenAI Whisper (set VOICE_TOOLS_OPENAI_KEY).",
@@ -247,7 +247,7 @@ def _check_daytona_backend(issues: list[str]) -> None:
from daytona import Daytona # noqa: F401 — SDK presence check
check_ok("daytona SDK", "(installed)")
except ImportError:
- _fail_and_issue("daytona SDK not installed", "(pip install daytona)", "Install daytona SDK: pip install daytona", issues)
+ _fail_and_issue("daytona SDK not installed", "(run hermes setup terminal)", "Run hermes setup terminal and select Daytona, then restart Hermes", issues)
def _check_vercel_backend(issues: list[str]) -> None:
@@ -260,8 +260,8 @@ def _check_vercel_backend(issues: list[str]) -> None:
("Vercel disk setting", "(uses platform default)"), ("Vercel custom disk unsupported", "(reset terminal.container_disk to 51200)"),
"Vercel Sandbox does not support custom container_disk; use the shared default 51200", issues)
_require(importlib.util.find_spec("vercel") is not None, ("vercel SDK", "(installed)"),
- ("vercel SDK not installed", "(pip install 'hermes-agent[vercel]')"),
- "Install the Vercel optional dependency: pip install 'hermes-agent[vercel]'", issues)
+ ("vercel SDK not installed", "(run hermes setup terminal)"),
+ "Run hermes setup terminal and select Vercel Sandbox, then restart Hermes", issues)
auth_status = describe_vercel_auth()
if auth_status.ok:
check_ok("Vercel auth", f"({auth_status.label})")
diff --git a/hermes_cli/main_agent_cmds.py b/hermes_cli/main_agent_cmds.py
index 1b5264703b4..16c48887aa5 100644
--- a/hermes_cli/main_agent_cmds.py
+++ b/hermes_cli/main_agent_cmds.py
@@ -83,7 +83,9 @@ def cmd_acp(args):
acp_main([flag for attr, flag in _ACP_FLAGS if getattr(args, attr, False)])
except ImportError:
print("ACP dependencies not installed.", file=sys.stderr)
- print("Install them with: pip install -e '.[acp]'", file=sys.stderr)
+ print("From the Hermes environment, run: "
+ "python -c \"from pm import sync_venv; sync_venv(['acp'], explicit=True)\"", file=sys.stderr)
+ print("Then restart Hermes.", file=sys.stderr)
sys.exit(1)
diff --git a/hermes_cli/model_setup_flows_azure.py b/hermes_cli/model_setup_flows_azure.py
index 84df04787c2..9af67ce3efa 100644
--- a/hermes_cli/model_setup_flows_azure.py
+++ b/hermes_cli/model_setup_flows_azure.py
@@ -54,8 +54,10 @@ def _azure_entra_preflight(current_entra: dict):
print()
if not has_azure_identity_installed():
_say("◐ The 'azure-identity' package is not installed yet.",
- " Hermes will install it now (the preflight below triggers the lazy-install). "
- "To skip lazy installs, run: pip install azure-identity")
+ " The preflight requests it through PM if lazy installs are enabled.",
+ " To install explicitly, run from the Hermes environment:",
+ " python -c \"from pm import sync_venv; sync_venv(['azure-identity'], explicit=True)\"",
+ " Then restart Hermes.")
# Only the optional scope override is persisted; identity selection (tenant,
# user-assigned MI, workload identity, SP) stays in AZURE_* SDK env vars.
diff --git a/hermes_cli/model_setup_flows_bedrock.py b/hermes_cli/model_setup_flows_bedrock.py
index 4f5bd311240..a38cbad950c 100644
--- a/hermes_cli/model_setup_flows_bedrock.py
+++ b/hermes_cli/model_setup_flows_bedrock.py
@@ -154,7 +154,7 @@ def _model_flow_bedrock(config, current_model=""):
try:
from agent.bedrock_adapter import has_aws_credentials, resolve_aws_auth_env_var, resolve_bedrock_region, discover_bedrock_models
except ImportError:
- _say(" ✗ boto3 is not installed. Install it with:", " pip install boto3", "")
+ _say(" ✗ Could not load the Bedrock adapter.", " Run hermes pm repair, then restart Hermes.", "")
return
if not has_aws_credentials():
diff --git a/hermes_cli/plugin_dev.py b/hermes_cli/plugin_dev.py
index 3718c7b6314..b982212579e 100644
--- a/hermes_cli/plugin_dev.py
+++ b/hermes_cli/plugin_dev.py
@@ -267,8 +267,8 @@ def _check_manifest_v2(report: "DoctorReport", manifest: Any) -> None:
if missing:
report.warning(
"declared python_dependencies not installed: " + ", ".join(missing)
- + " — Hermes never auto-installs plugin dependencies; install manually: pip install "
- + " ".join(f"'{m}'" for m in missing))
+ + " — install and enable the plugin with hermes plugins. "
+ "For an enabled plugin, run hermes pm repair, then restart Hermes.")
schema = getattr(manifest, "config_schema", {}) or {}
if schema:
diff --git a/hermes_cli/plugins_loader.py b/hermes_cli/plugins_loader.py
index 788aeb744c5..54de8818f62 100644
--- a/hermes_cli/plugins_loader.py
+++ b/hermes_cli/plugins_loader.py
@@ -217,13 +217,9 @@ class PluginLoaderMixin:
)
def _warn_python_dependencies(self, manifest: PluginManifest) -> None:
- """Warn about missing declared pip dependencies with an install hint — NEVER auto-install.
+ """Report missing dependencies without installing during discovery.
- See #64165.
- python_dependencies is a declaration seam ONLY: Hermes validates and prints the requirements with an
- install hint but NEVER auto-installs them. The isolation design (constraints installs vs. vendored
- dirs vs. conflict-detection-and-refusal) is an explicitly deferred follow-up — see the round-2
- review on #64165 and #15220.
+ Plugin admission and PM repair own dependency changes.
"""
deps = manifest.python_dependencies
if not deps:
@@ -233,9 +229,9 @@ class PluginLoaderMixin:
if missing:
logger.warning(
"Plugin %s declares Python dependencies that are not "
- "installed: %s. Hermes does not install plugin dependencies "
- "automatically; install them yourself, e.g.: pip install %s",
- key, ", ".join(missing), " ".join(f"'{m}'" for m in missing),
+ "installed: %s. For an enabled plugin, run hermes pm repair, "
+ "then restart Hermes. Discovery does not install dependencies.",
+ key, ", ".join(missing),
)
else:
logger.debug("Plugin %s python_dependencies satisfied: %s", key, ", ".join(deps))
diff --git a/hermes_cli/pty_bridge.py b/hermes_cli/pty_bridge.py
index 90d6a61a6c3..f5527faaaaa 100644
--- a/hermes_cli/pty_bridge.py
+++ b/hermes_cli/pty_bridge.py
@@ -89,7 +89,7 @@ class PtyBridge:
raise PtyUnavailableError("Pseudo-terminals are unavailable on this platform. "
"Hermes Agent supports Windows only via WSL.")
raise PtyUnavailableError("The `ptyprocess` package is missing. " # only other way _PTY_AVAILABLE is False
- "Install with: pip install ptyprocess (or pip install -e '.[pty]').")
+ "Run hermes pm repair, then restart Hermes.")
# env=None: callers own env policy (process_registry already sanitizes), so inherit via the
# factory with exact preservation. Backfill TERM when missing/blank — CI often lacks it and
# probes like `tput cols` then fail before winsize reads; explicit overrides are kept.
diff --git a/hermes_cli/runtime_provider_backends.py b/hermes_cli/runtime_provider_backends.py
index 4735efe23c5..657cbcf8f72 100644
--- a/hermes_cli/runtime_provider_backends.py
+++ b/hermes_cli/runtime_provider_backends.py
@@ -30,8 +30,8 @@ def _azure_entra_credentials(cfg_entra: Dict[str, Any]) -> Any:
from agent.azure_identity_adapter import SCOPE_AI_AZURE_DEFAULT, EntraIdentityConfig, build_token_provider
except Exception as exc:
raise AuthError(
- "Azure Foundry Entra ID auth requires the 'azure-identity' "
- "package. Install it with: pip install azure-identity "
+ "Could not load the Azure Foundry Entra ID adapter. "
+ "Run hermes pm repair, then restart Hermes. "
f"(import failed: {exc})"
) from exc
scope = str(cfg_entra.get("scope") or "").strip() or SCOPE_AI_AZURE_DEFAULT
diff --git a/hermes_cli/status.py b/hermes_cli/status.py
index 678ab310549..81bcb99b926 100644
--- a/hermes_cli/status.py
+++ b/hermes_cli/status.py
@@ -172,7 +172,7 @@ def _render_terminal(ctx):
auth_status = describe_vercel_auth()
_kv("Runtime:", os.getenv('TERMINAL_VERCEL_RUNTIME') or terminal_cfg.get('vercel_runtime') or 'node24')
_kv_flag("SDK:", importlib.util.find_spec("vercel") is not None, "installed",
- "missing (install: pip install 'hermes-agent[vercel]')")
+ "missing (run hermes setup terminal and select Vercel Sandbox, then restart Hermes)")
_kv("Auth:", f"{check_mark(auth_status.ok)} {auth_status.label}")
for line in auth_status.detail_lines:
_kv("Auth detail:", line)
diff --git a/hermes_cli/telegram_managed_bot.py b/hermes_cli/telegram_managed_bot.py
index fa505c3de79..9aa9bca65f4 100644
--- a/hermes_cli/telegram_managed_bot.py
+++ b/hermes_cli/telegram_managed_bot.py
@@ -76,7 +76,10 @@ def render_qr_terminal(url: str) -> str:
def print_qr_code(url: str, *, include_link: bool = True) -> None:
"""Print a QR code to stdout, with URL fallback if qrcode is missing."""
- print(render_qr_terminal(url) or " (Install 'qrcode' for a scannable QR code: pip install qrcode)")
+ print(render_qr_terminal(url) or (
+ " (QR code unavailable. From the Hermes environment, run: "
+ "python -c \"from pm import sync_venv; sync_venv(['messaging'], explicit=True)\". "
+ "Then restart Hermes.)"))
if include_link:
print(f" Link: {url}")
diff --git a/hermes_cli/web_server.py b/hermes_cli/web_server.py
index e7e7c84a9e1..379cbc56523 100644
--- a/hermes_cli/web_server.py
+++ b/hermes_cli/web_server.py
@@ -55,7 +55,7 @@ except ImportError:
except Exception:
raise SystemExit(
"Web UI requires fastapi and uvicorn.\n"
- f"Install with: {sys.executable} -m pip install 'fastapi' 'uvicorn[standard]'"
+ "Run hermes pm repair, then restart Hermes."
)
WEB_DIST = Path(os.environ["HERMES_WEB_DIST"]) if "HERMES_WEB_DIST" in os.environ else Path(__file__).parent / "web_dist"
diff --git a/hermes_cli/win_pty_bridge.py b/hermes_cli/win_pty_bridge.py
index 5a112383473..260cbef74f3 100644
--- a/hermes_cli/win_pty_bridge.py
+++ b/hermes_cli/win_pty_bridge.py
@@ -59,7 +59,7 @@ class WinPtyBridge:
cols: int = 80, rows: int = 24) -> "WinPtyBridge":
if not _PTY_AVAILABLE:
if PtyProcess is None:
- raise PtyUnavailableError("pywinpty is not installed. Install with: pip install pywinpty")
+ raise PtyUnavailableError("pywinpty is not installed. Run hermes pm repair, then restart Hermes.")
raise PtyUnavailableError("ConPTY is unavailable on this platform.")
# See pty_bridge.py: exact-preservation factory for the env=None fallback.
from tools.environments.local import build_subprocess_env
diff --git a/tests/hermes_cli/test_azure_foundry_entra.py b/tests/hermes_cli/test_azure_foundry_entra.py
index 2205a66cbdd..4bba972cdbe 100644
--- a/tests/hermes_cli/test_azure_foundry_entra.py
+++ b/tests/hermes_cli/test_azure_foundry_entra.py
@@ -200,9 +200,9 @@ class TestResolveAzureFoundryRuntimeApiKey:
class TestAzureFoundryAuthStatus:
- def test_entra_status_does_not_mint_token(self, monkeypatch, tmp_path):
- """Structural check — must return logged_in=True based on
- importable + config, never call get_bearer_token_provider."""
+ @pytest.mark.parametrize("installed", [True, False])
+ def test_entra_status_does_not_mint_token(self, monkeypatch, tmp_path, installed):
+ """Status checks availability and gives an explicit PM command for missing dependencies."""
from hermes_cli import auth as _auth
# Force load_config to return our entra config.
monkeypatch.setattr(
@@ -215,18 +215,26 @@ class TestAzureFoundryAuthStatus:
},
},
)
- # Patch has_azure_identity_installed to True; do NOT patch the
- # token provider — if the code path tried to mint, the SDK
- # missing would raise.
+ # Do not patch the token provider: status must not request credentials.
monkeypatch.setattr(
"agent.azure_identity_adapter.has_azure_identity_installed",
- lambda: True,
+ lambda: installed,
)
info = _auth._get_azure_foundry_auth_status()
- assert info["logged_in"] is True
+ assert info["logged_in"] is installed
assert info["auth_mode"] == "entra_id"
- assert info["azure_identity_installed"] is True
+ assert info["azure_identity_installed"] is installed
assert info["scope"].endswith("/.default")
+ if not installed:
+ import pm
+ from unittest.mock import Mock
+
+ sync = Mock()
+ monkeypatch.setattr(pm, "sync_venv", sync)
+ command = info["hint"].split('python -c "', 1)[1].split('"', 1)[0]
+ exec(command, {})
+ sync.assert_called_once_with(["azure-identity"], explicit=True)
+ assert "restart" in info["hint"].lower()
def test_api_key_status_false_when_missing(self, monkeypatch):
diff --git a/tests/hermes_cli/test_plugin_manifest_v2.py b/tests/hermes_cli/test_plugin_manifest_v2.py
index 4908f736f61..50b28a993bc 100644
--- a/tests/hermes_cli/test_plugin_manifest_v2.py
+++ b/tests/hermes_cli/test_plugin_manifest_v2.py
@@ -3,7 +3,7 @@
Covers: v1 regression (unchanged behavior), v2 field parsing, unknown-field
forward compat, requires_plugins load ordering + cycle handling,
config_schema validation warnings, and the python_dependencies
-declare-only seam (surfaced, never installed).
+discovery check (surfaced without installing).
"""
import logging
@@ -365,8 +365,9 @@ class TestPythonDependenciesSeam:
mgr.discover_and_load()
assert mgr._plugins["pipful"].enabled
assert "definitely-not-a-real-package-64165" in caplog.text
- assert "pip install" in caplog.text
- assert "does not install plugin dependencies automatically" in caplog.text
+ assert "hermes pm repair" in caplog.text
+ assert "pip install" not in caplog.text
+ assert "Discovery does not install dependencies" in caplog.text
assert calls == []
def test_satisfied_pip_dep_is_quiet(self, hermes_home, caplog):
@@ -382,7 +383,7 @@ class TestPythonDependenciesSeam:
mgr = PluginManager()
mgr.discover_and_load()
assert mgr._plugins["pipok"].enabled
- assert "pip install" not in caplog.text
+ assert "hermes pm repair" not in caplog.text
class TestCtxHasPlugin:
diff --git a/tests/hermes_cli/test_pty_bridge.py b/tests/hermes_cli/test_pty_bridge.py
index 8b7c88f53d9..dee89071dd3 100644
--- a/tests/hermes_cli/test_pty_bridge.py
+++ b/tests/hermes_cli/test_pty_bridge.py
@@ -313,6 +313,12 @@ class TestPtyBridgeUnavailable:
"""Platform fallback semantics — PtyUnavailableError is importable and
carries a user-readable message."""
- def test_error_carries_user_message(self):
- err = PtyUnavailableError("platform not supported")
- assert "platform" in str(err)
+ @pytest.mark.platforms("posix")
+ def test_missing_dependency_points_to_pm_repair(self, monkeypatch):
+ from hermes_cli import pty_bridge
+
+ monkeypatch.setattr(pty_bridge, "_PTY_AVAILABLE", False)
+ with pytest.raises(PtyUnavailableError, match="hermes pm repair") as exc:
+ PtyBridge.spawn(["true"])
+ assert "ptyprocess" in str(exc.value)
+ assert "pip install" not in str(exc.value)
diff --git a/tests/hermes_cli/test_telegram_managed_bot.py b/tests/hermes_cli/test_telegram_managed_bot.py
index 5b3e805528e..87c36e74174 100644
--- a/tests/hermes_cli/test_telegram_managed_bot.py
+++ b/tests/hermes_cli/test_telegram_managed_bot.py
@@ -27,9 +27,14 @@ class TestQRCode:
assert isinstance(result, str)
assert len(result) > 10
- def test_render_graceful_without_qrcode(self):
+ def test_render_graceful_without_qrcode(self, capsys):
with patch.dict("sys.modules", {"qrcode": None}):
- render_qr_terminal("https://example.com")
+ assert render_qr_terminal("https://example.com") == ""
+ print_qr_code("https://example.com")
+ output = capsys.readouterr().out
+ assert "https://example.com" in output
+ assert "sync_venv" in output
+ assert "pip install" not in output
def test_print_qr_code_with_url(self, capsys):
print_qr_code("https://t.me/newbot/Bot/test_bot")