The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(platforms): the Feishu/WeCom QR fallback tip goes through PM
ethernetae87819213f2
diff --git a/plugins/platforms/feishu/adapter.py b/plugins/platforms/feishu/adapter.pyindex cca5ccef147..f135178e38c 100644--- a/plugins/platforms/feishu/adapter.py+++ b/plugins/platforms/feishu/adapter.py@@ -4235,8 +4235,9 @@ def _qr_register_inner(*, initial_domain: str, timeout_seconds: int) -> Optionalprint(f"\n Scan the QR code above, or open this URL directly:\n {qr_url}")else:print(f" Open this URL in Feishu / Lark on your phone:\n\n {qr_url}\n")- from hermes_cli.managed_uv import pip_install_hint- print(f" Tip: {pip_install_hint('qrcode')} to display a scannable QR code here next time")+ print(" Tip: from the Hermes environment, run: "+ "python -c \"from pm import sync_venv; sync_venv(['messaging'], explicit=True)\" "+ "to display a scannable QR code here next time")print()result = _poll_registration(device_code=begin["device_code"], interval=begin["interval"],diff --git a/plugins/platforms/wecom/adapter.py b/plugins/platforms/wecom/adapter.pyindex 98a1a753f60..a5fdc6b28f4 100644--- a/plugins/platforms/wecom/adapter.py+++ b/plugins/platforms/wecom/adapter.py@@ -674,8 +674,9 @@ def qr_scan_for_bot_info(*, timeout_seconds: int = _QR_POLL_TIMEOUT) -> Optionalprint(f"\n Scan the QR code above, or open this URL directly:\n {page_url}")except Exception:print(f" Open this URL in WeCom on your phone:\n\n {page_url}\n")- from hermes_cli.managed_uv import pip_install_hint- print(f" Tip: {pip_install_hint('qrcode')} to display a scannable QR code here next time")+ print(" Tip: from the Hermes environment, run: "+ "python -c \"from pm import sync_venv; sync_venv(['messaging'], explicit=True)\" "+ "to display a scannable QR code here next time")print("\n Fetching configuration results...", end="", flush=True)deadline = time.monotonic() + timeout_secondsquery_url = f"{_QR_QUERY_URL}?scode={urllib.parse.quote(scode)}"diff --git a/tests/gateway/test_feishu_onboard.py b/tests/gateway/test_feishu_onboard.pyindex c7faf7e6a6a..1624b41a2a6 100644--- a/tests/gateway/test_feishu_onboard.py+++ b/tests/gateway/test_feishu_onboard.py@@ -244,8 +244,8 @@ class TestQrRegister:output = capsys.readouterr().outassert "https://example.com/qr" in output- assert f"uv pip install --python {sys.executable} qrcode" in output- assert "Tip: pip install qrcode" not in output+ assert "sync_venv(['messaging'], explicit=True)" in output+ assert "pip install" not in output# -- Contract: expected errors → None, unexpected errors → propagate --diff --git a/tests/hermes_cli/test_telegram_managed_bot.py b/tests/hermes_cli/test_telegram_managed_bot.pyindex ea5370fc031..b7b10b49f02 100644--- a/tests/hermes_cli/test_telegram_managed_bot.py+++ b/tests/hermes_cli/test_telegram_managed_bot.py@@ -44,15 +44,13 @@ class TestQRCode:def test_print_qr_code_tip_targets_active_interpreter(self, capsys):# Regression for #111695: a bare `pip install` targets the wrong# environment when Hermes runs in an isolated venv (which has no pip- # module at all). The fallback tip must name the interpreter that is- # actually running, via uv.- import sys-+ # module at all). The fallback tip must go through PM, which owns the+ # running environment.with patch.dict("sys.modules", {"qrcode": None}):print_qr_code("https://t.me/newbot/Bot/test_bot")captured = capsys.readouterr()- assert f"uv pip install --python {sys.executable} qrcode" in captured.out- assert " pip install qrcode)" not in captured.out+ assert "sync_venv(['messaging'], explicit=True)" in captured.out+ assert "pip install" not in captured.outclass TestCreatePairing: