Skip to content

The agent that grows with you

fix(memory): show every memory-provider migration outcome, ask once per update

teknium1a5144c71e90e
diff --git a/agent/agent_init.py b/agent/agent_init.py
index c08727d99df..3713b214554 100644
--- a/agent/agent_init.py
+++ b/agent/agent_init.py
@@ -52,25 +52,27 @@ logger = logging.getLogger("run_agent")
_warned_unavailable_providers: set[str] = set()
-def _warn_memory_provider_unavailable(name: str, reason: str = "") -> None:
+def _warn_memory_provider_unavailable(name: str, reason: str = "", say=None) -> None:
"""Warn once per provider that a configured memory provider is unavailable.
``is_available()`` is a side-effect-free hot-path check and can't log itself; without this
the provider is silently dropped. ``reason`` (the provider's ``unavailable_reason()`` hint)
- can only reach the user here, so it is appended when present.
+ can only reach the user here, so it is appended when present. *say* is the agent's
+ user-facing sink: a log line alone leaves the user running without memory unaware.
"""
if name in _warned_unavailable_providers:
return
_warned_unavailable_providers.add(name)
- logger.warning(
- "Memory provider %r is selected but reports unavailable — external memory "
+ message = (
+ f"⚠ Memory provider {name!r} is selected but reports unavailable — external memory "
"is disabled for this session (built-in memory still works). Check the "
"provider's credentials/config with 'hermes memory status'. Note: "
"systemd/gateway services do not inherit ~/.hermes/.env automatically; set "
- "any required variables in the service environment.%s",
- name,
- f" {reason}" if reason else "",
+ f"any required variables in the service environment.{f' {reason}' if reason else ''}"
)
+ logger.warning(message)
+ if say is not None:
+ say(message)
def _provider_default_routes(provider: str) -> set[str]:
@@ -1367,7 +1369,7 @@ def _init_memory(agent, _agent_cfg, skip_memory, platform, memory_manager=None):
if _mp is None:
# The provider left core for the catalog (or was never installed): fetch it once.
from hermes_cli.memory_provider_migration import recover_at_startup
- if recover_at_startup(_mem_provider_name, say=agent._emit_warning):
+ if recover_at_startup(_mem_provider_name, say=agent._emit_startup_warning):
_mp = _load_mem(_mem_provider_name)
if _mp and _mp.is_available():
agent._memory_manager.add_provider(_mp)
@@ -1376,7 +1378,8 @@ def _init_memory(agent, _agent_cfg, skip_memory, platform, memory_manager=None):
_unavailable_reason = ""
with suppress(Exception):
_unavailable_reason = _mp.unavailable_reason()
- _warn_memory_provider_unavailable(_mem_provider_name, _unavailable_reason)
+ _warn_memory_provider_unavailable(
+ _mem_provider_name, _unavailable_reason, say=agent._emit_startup_warning)
if agent._memory_manager.providers:
agent._memory_manager.initialize_all(**_memory_provider_init_kwargs(agent, platform))
_ra().logger.info("Memory provider '%s' activated", _mem_provider_name)
diff --git a/agent/status_output.py b/agent/status_output.py
index 91c12c8ef99..c56678d5c84 100644
--- a/agent/status_output.py
+++ b/agent/status_output.py
@@ -105,6 +105,35 @@ class StatusOutputMixin:
"""Emit a user-visible warning for degraded side paths where the turn continues but the user must know."""
self._emit_status_kind("warn", message, origin="_emit_warning")
+ def _emit_startup_warning(self, message: str) -> None:
+ """A warning raised during ``__init__`` that the user must see (e.g. a memory provider that
+ could not be recovered). The CLI prints it. Other drivers get a sticky warn ``AgentNotice``:
+ Desktop renders notices but no warn-kind ``status.update``, and the messaging gateway wires
+ its callbacks per turn, after init, so a notice raised before then waits for
+ :meth:`_replay_startup_warnings` on the first turn."""
+ message = message.strip()
+ if (getattr(self, "platform", None) or "cli") == "cli":
+ self._emit_warning(message)
+ return
+ import zlib
+
+ from agent.credits_tracker import AgentNotice
+
+ key = f"startup-warning.{zlib.crc32(message.encode()):08x}"
+ level = "success" if message.startswith("✓") else "warn" # a recovered provider is good news
+ notice = AgentNotice(text=message, level=level, kind="sticky", key=key, id=key)
+ if getattr(self, "notice_callback", None):
+ self._emit_notice(notice)
+ else:
+ self._pending_startup_notices = [*getattr(self, "_pending_startup_notices", ()), notice]
+
+ def _replay_startup_warnings(self) -> None:
+ pending = getattr(self, "_pending_startup_notices", None)
+ if pending and getattr(self, "notice_callback", None):
+ self._pending_startup_notices = []
+ for notice in pending:
+ self._emit_notice(notice)
+
def _warn_context_overflow_blocked(self, reason: str, preflight_tokens: int, threshold_tokens: int) -> None:
"""Warn (deduped on the block *kind* — ``cooldown`` / ``ineffective`` — not the countdown string;
cleared by ``_clear_context_overflow_warn``) when context is over the threshold but compression is blocked."""
diff --git a/agent/turn_context.py b/agent/turn_context.py
index cd902474841..639e99ed424 100644
--- a/agent/turn_context.py
+++ b/agent/turn_context.py
@@ -638,6 +638,8 @@ def _reset_per_turn_agent_state(agent: Any) -> None:
if agent._compression_warning:
agent._replay_compression_warning()
agent._compression_warning = None # send once
+ if getattr(agent, "_pending_startup_notices", None): # gateway: init ran before its callbacks
+ agent._replay_startup_warnings()
agent.iteration_budget = IterationBudget(agent.max_iterations)
# Wall-clock run budget: stamped only when configured (one wrap-up notice per run).
diff --git a/hermes_cli/memory_provider_migration.py b/hermes_cli/memory_provider_migration.py
index 2d082ac29eb..7701e318daa 100644
--- a/hermes_cli/memory_provider_migration.py
+++ b/hermes_cli/memory_provider_migration.py
@@ -1,7 +1,7 @@
"""Move a user from a memory provider that left core onto its catalog plugin.
A bundled ``plugins/memory/<name>`` that becomes a standalone catalog plugin keeps the same provider
-name, config section (``memory.<name>``), data directory and tool names, so the migration is only
+name, the settings it already read, its data directory and tool names, so the migration is only
"the code now lives under ``HERMES_HOME/plugins/<name>``". Two hooks call :func:`migrate_home`:
* ``hermes update`` — for every profile home that shares the venv (primary; runs where the venv was
@@ -10,8 +10,9 @@ name, config section (``memory.<name>``), data directory and tool names, so the
users update through the app and never run ``hermes update`` by hand).
Both install the catalog entry at its reviewed pin through the normal plugin install path (kill
-list, dependency constraints, enable), never a custom source. Offline or absent from the catalog:
-the user gets the exact one-liner instead of silently running without memory.
+list, dependency constraints, enable), never a custom source. Every outcome — installed, refused,
+failed, absent from the catalog — reaches the user (terminal, Desktop, chat platform), never only
+``agent.log``: a provider that silently stays missing is lost memory.
"""
from __future__ import annotations
@@ -58,13 +59,9 @@ def catalog_source(name: str) -> Optional[str]:
return entry.name if entry is not None else None
-def migrate_home(home: Path, *, install: Callable[[str], dict], say: Callable[[str], None] = print) -> Optional[str]:
- """Install the configured provider's catalog plugin into *home* when the provider is gone.
-
- Returns the installed plugin name, or None when nothing needed doing or the install could not
- happen (already reported through *say*). Never raises: memory being down must not take the
- update or the agent down with it.
- """
+def _pending_provider(home: Path, *, say: Callable[[str], None]) -> Optional[str]:
+ """The provider *home* needs from the catalog, or None (nothing to do, or a catalog miss already
+ reported through *say*). Read-only."""
name = configured_provider(home)
from agent.memory_provider import is_core_memory_provider
if is_core_memory_provider(name) or provider_present(name, home):
@@ -73,17 +70,46 @@ def migrate_home(home: Path, *, install: Callable[[str], dict], say: Callable[[s
say(f" ⚠ Memory provider '{name}' is configured but not installed and not in the plugin catalog. "
f"Install it with `hermes plugins install <source>` or change memory.provider.")
return None
+ return name
+
+
+def _install_command(name: str, home: Path) -> str:
+ """The exact command that installs *name* into *home* (``-p`` when it is not the active home)."""
+ from hermes_constants import get_hermes_home, hermes_home_key, profile_name_for_home
+ profile = profile_name_for_home(home)
+ if profile is None or hermes_home_key(home) == hermes_home_key(get_hermes_home()):
+ return f"hermes plugins install {name}"
+ return f"hermes -p {profile} plugins install {name}"
+
+
+def _install_pending(home: Path, name: str, *, install: Callable[[str], dict],
+ say: Callable[[str], None]) -> bool:
try:
result = install(name)
except Exception as exc: # network, uv, kill list — report, do not raise
result = {"ok": False, "error": str(exc)}
if result.get("ok"):
say(f" ✓ Memory provider '{name}' moved out of core — installed its plugin from the catalog "
- f"(nothing was removed or modified; the plugin reads its own config — see `hermes memory status`).")
- return name
+ f"(memory.provider and your stored memories are unchanged; check its settings with "
+ f"`hermes memory status`).")
+ return True
+ error = str(result.get("error") or "unknown error").rstrip(". ")
say(f" ⚠ Memory provider '{name}' moved out of core and could not be installed automatically: "
- f"{result.get('error') or 'unknown error'}. Run `hermes plugins install {name}`.")
- return None
+ f"{error}. Run `{_install_command(name, home)}`.")
+ return False
+
+
+def migrate_home(home: Path, *, install: Callable[[str], dict], say: Callable[[str], None] = print) -> Optional[str]:
+ """Install the configured provider's catalog plugin into *home* when the provider is gone.
+
+ Returns the installed plugin name, or None when nothing needed doing or the install could not
+ happen (already reported through *say*). Never raises: memory being down must not take the
+ update or the agent down with it.
+ """
+ name = _pending_provider(home, say=say)
+ if name is None:
+ return None
+ return name if _install_pending(home, name, install=install, say=say) else None
def _unattended_consent() -> bool:
@@ -111,21 +137,58 @@ def _install_into(home: Path) -> Callable[[str], dict]:
return _install
+def _home_label(home: Path) -> str:
+ from hermes_constants import profile_name_for_home
+ profile = profile_name_for_home(home)
+ return f"profile '{profile}'" if profile else str(home)
+
+
def migrate_all_homes(*, say: Callable[[str], None] = print) -> list[str]:
- """``hermes update`` hook: every profile home sharing this venv. Returns installed plugin names."""
+ """``hermes update`` hook: every profile home sharing this venv. Returns installed plugin names.
+
+ Each line names the profile it is about. Homes missing the same provider share one environment,
+ so they share one set of dependency answers (#125794): the first install asks, the rest reuse
+ its answers, and when it fails the remaining homes are named in one line instead of failing (or
+ re-prompting) one by one. Ctrl-C ends the migration with a message, not a traceback into the
+ updater.
+ """
+ from hermes_cli.plugins_cmd_install import shared_dependency_answers
from pm.plugins_state import dependency_homes
- installed: list[str] = []
- for home in dependency_homes():
- def say_for_home(message: str, home: Path = home) -> None:
- say(f" [{home}] {message.lstrip()}")
+ def labelled(home: Path) -> Callable[[str], None]:
+ return lambda message: say(f" [{_home_label(home)}] {message.lstrip()}")
+
+ pending: dict[str, list[Path]] = {}
+ for home in dependency_homes():
try:
- name = migrate_home(home, install=_install_into(home), say=say_for_home)
+ name = _pending_provider(home, say=labelled(home))
except Exception as exc:
logger.debug("memory provider migration skipped for %s: %s", home, exc)
continue
if name:
- installed.append(name)
+ pending.setdefault(name, []).append(home)
+
+ installed: list[str] = []
+ try:
+ for name, homes in pending.items():
+ if len(homes) > 1:
+ say(f" Memory provider '{name}' is configured in {len(homes)} profiles "
+ f"({', '.join(_home_label(h) for h in homes)}); your answers to its dependency "
+ f"questions apply to all of them.")
+ with shared_dependency_answers():
+ for index, home in enumerate(homes):
+ if _install_pending(home, name, install=_install_into(home), say=labelled(home)):
+ installed.append(name)
+ continue
+ rest = homes[index + 1:]
+ if rest:
+ say(f" ⚠ Memory provider '{name}' was not installed for "
+ f"{', '.join(_home_label(h) for h in rest)} either. Run "
+ + ", ".join(f"`{_install_command(name, h)}`" for h in rest) + ".")
+ break
+ except KeyboardInterrupt:
+ say(" ⚠ Memory provider migration cancelled. Profiles already migrated keep their plugin; "
+ "run `hermes plugins install <name>` (with `-p <profile>`) for the rest.")
return installed
@@ -150,7 +213,8 @@ def recover_at_startup(name: str, *, say: Optional[Callable[[str], None]] = None
from pm.install import lazy_installs_allowed
if not lazy_installs_allowed():
- report(f"Memory provider '{name}' is not installed; security.allow_lazy_installs is off — "
+ report(f"⚠ Memory provider '{name}' is not installed, so external memory is off for this session. "
+ f"security.allow_lazy_installs is off, so Hermes did not fetch it: "
f"run `hermes plugins install {name}`.")
return False
return migrate_home(home, install=_install_into(home), say=report) == name
diff --git a/hermes_cli/plugins_cmd_install.py b/hermes_cli/plugins_cmd_install.py
index 0d8fffce40b..88ad0d74559 100644
--- a/hermes_cli/plugins_cmd_install.py
+++ b/hermes_cli/plugins_cmd_install.py
@@ -11,6 +11,8 @@ import logging
import os
import sys
import tempfile
+from contextlib import contextmanager
+from contextvars import ContextVar
from pathlib import Path
from typing import Any, Callable, Optional
@@ -18,6 +20,34 @@ from hermes_cli.cli_output import line_input
logger = logging.getLogger(__name__)
+# Answers to the dependency questions, reused while one plugin is installed into several profile
+# homes that share one environment (memory-provider migration on ``hermes update``, #125794).
+_shared_answers: ContextVar[Optional[dict]] = ContextVar("plugin_dependency_answers", default=None)
+
+
+@contextmanager
+def shared_dependency_answers():
+ """Inside this block each dependency question is asked once; repeats reuse the first answer."""
+ token = _shared_answers.set({})
+ try:
+ yield
+ finally:
+ _shared_answers.reset(token)
+
+
+def _ask_yes_no(key: tuple, prompt: str, console) -> bool:
+ answers = _shared_answers.get()
+ if answers is not None and key in answers:
+ console.print(f" [dim]Reusing your answer for the first profile: {'yes' if answers[key] else 'no'}[/dim]")
+ return answers[key]
+ try:
+ accepted = input(prompt).strip().lower() in {"y", "yes"}
+ except (EOFError, KeyboardInterrupt):
+ accepted = False
+ if answers is not None:
+ answers[key] = accepted
+ return accepted
+
def _pc():
"""The facade, read at call time: tests patch ``plugins_cmd.<name>`` and sibling calls must see it."""
@@ -60,16 +90,9 @@ def _install_plugin_python_deps(
node_reason = None
if has_package_json:
console.print(f"\n[bold]{manifest.get('name', 'this plugin')}[/bold] declares Node dependencies (package.json).")
- if sys.stdin.isatty() and sys.stdout.isatty():
- try:
- node_answer = input(
- " Install them into the plugin's own node_modules now? [y/N]: "
- ).strip().lower()
- except (EOFError, KeyboardInterrupt):
- node_answer = ""
- else:
- node_answer = ""
- if node_answer in {"y", "yes"}:
+ node_ok = sys.stdin.isatty() and sys.stdout.isatty() and _ask_yes_no(
+ ("node", manifest.get("name")), " Install them into the plugin's own node_modules now? [y/N]: ", console)
+ if node_ok:
from pm.workspace import install_node_sidecar
node_reason = install_node_sidecar(target, explicit=True)
@@ -114,13 +137,7 @@ def _consent_python_deps(
"Run `hermes plugins enable` when ready to prepare them.[/dim]\n"
)
return False, "dependency install skipped (non-interactive)"
- try:
- answer = input(
- " Prepare these with Hermes through PM now? [y/N]: "
- ).strip().lower()
- except (EOFError, KeyboardInterrupt):
- answer = ""
- if answer not in {"y", "yes"}:
+ if not _ask_yes_no(("python", plugin_name, deps), " Prepare these with Hermes through PM now? [y/N]: ", console):
console.print(
"[dim]Skipped — run `hermes plugins enable` when ready "
"to prepare them.[/dim]\n"
diff --git a/tests/agent/test_memory_migration_notifications.py b/tests/agent/test_memory_migration_notifications.py
index 0896f893c1f..67564af9479 100644
--- a/tests/agent/test_memory_migration_notifications.py
+++ b/tests/agent/test_memory_migration_notifications.py
@@ -1,85 +1,47 @@
-"""Startup migration outcomes reach the existing gated warning sink."""
-import pytest
-
+"""A configured memory provider that cannot be recovered at agent start is shown to the user,
+never only logged (#119769): the CLI prints it; other drivers get a warn notice, which a
+messaging-gateway agent (callbacks wired per turn) replays on its first turn."""
from agent.agent_init import _init_memory
from agent.status_output import StatusOutputMixin
from hermes_cli import memory_provider_migration as mig
class StartupAgent(StatusOutputMixin):
- enabled_toolsets = []
- disabled_toolsets = []
- platform = "cli"
+ enabled_toolsets = disabled_toolsets = tools = []
+ valid_tool_names = set()
log_prefix = ""
quiet_mode = False
- status_callback = None
- tools = []
- valid_tool_names = set()
+ status_callback = notice_callback = tool_progress_callback = None
+
+ def __init__(self, platform):
+ self.platform = platform
+ self.printed = []
def _vprint(self, message, **kwargs):
- print(message)
+ self.printed.append(message)
-def startup_home(tmp_path, monkeypatch):
+def _start(tmp_path, monkeypatch, platform):
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
monkeypatch.setattr(mig, "_attempted", set())
- (tmp_path / "config.yaml").write_text(
- "security:\n allow_lazy_installs: false\nmemory:\n provider: scout_missing_provider\n",
- encoding="utf-8",
- )
- return tmp_path
-
-
[email protected]("show", [True, False])
-def test_startup_refusal_reaches_gated_cli_sink(startup_home, capsys, monkeypatch, show):
- agent = StartupAgent()
- monkeypatch.setattr(agent, "_warning_presentation_enabled", lambda: show)
- _init_memory(agent, {"memory": {"provider": "scout_missing_provider"}}, False, "cli")
- output = capsys.readouterr().out
- assert ("hermes plugins install scout_missing_provider" in output) is show
- assert agent._memory_manager is None
- assert not (startup_home / "plugins").exists()
-
-
[email protected]("outcome", ["success", "unknown", "error", "present"])
-def test_recovery_outcomes_keep_log_and_return_contract(startup_home, monkeypatch, caplog, outcome):
- monkeypatch.setattr("tools.lazy_deps._allow_lazy_installs", lambda: True)
- monkeypatch.setattr(mig, "provider_present", lambda name, home: outcome == "present")
- monkeypatch.setattr(mig, "catalog_source", lambda name: None if outcome == "unknown" else name)
- calls = []
-
- def install(name):
- calls.append(name)
- if outcome == "error":
- raise RuntimeError("offline fixture")
- return {"ok": True}
-
- monkeypatch.setattr(mig, "_install_into", lambda home: install)
- said = []
- result = mig.recover_at_startup("scout_missing_provider", say=said.append)
- assert result is (outcome == "success")
- assert len(said) == (0 if outcome == "present" else 1)
- assert calls == (["scout_missing_provider"] if outcome in {"success", "error"} else [])
- if said:
- assert said[0] in caplog.text
- assert mig.recover_at_startup("scout_missing_provider", say=said.append) is False
- assert len(said) == (0 if outcome == "present" else 1)
-
-
-def test_broken_presentation_does_not_undo_success(startup_home, monkeypatch, caplog):
- monkeypatch.setattr("tools.lazy_deps._allow_lazy_installs", lambda: True)
- monkeypatch.setattr(mig, "provider_present", lambda name, home: False)
- monkeypatch.setattr(mig, "catalog_source", lambda name: name)
- monkeypatch.setattr(mig, "_install_into", lambda home: lambda name: {"ok": True})
-
- def broken(message):
- raise RuntimeError("presentation unavailable")
-
- assert mig.recover_at_startup("scout_missing_provider", say=broken) is True
- assert "installed its plugin" in caplog.text
-
-
-def test_default_caller_retains_logging(startup_home, caplog):
- assert mig.recover_at_startup("scout_missing_provider") is False
- assert "security.allow_lazy_installs is off" in caplog.text
+ monkeypatch.setattr("pm.install.lazy_installs_allowed", lambda: False)
+ agent = StartupAgent(platform)
+ monkeypatch.setattr(agent, "_warning_presentation_enabled", lambda: True)
+ _init_memory(agent, {"memory": {"provider": "scout_missing_provider"}}, False, platform)
+ assert agent._memory_manager is None and not (tmp_path / "plugins").exists()
+ return agent
+
+
+def test_cli_start_prints_the_refusal(tmp_path, monkeypatch):
+ agent = _start(tmp_path, monkeypatch, "cli")
+ assert any("hermes plugins install scout_missing_provider" in line for line in agent.printed)
+
+
+def test_gateway_start_replays_the_refusal_once_on_first_turn(tmp_path, monkeypatch):
+ agent = _start(tmp_path, monkeypatch, "telegram")
+ notices = []
+ agent.notice_callback = notices.append # the gateway wires this per turn, after __init__
+ agent._replay_startup_warnings()
+ agent._replay_startup_warnings()
+ assert len(notices) == 1 and notices[0].level == "warn"
+ assert "hermes plugins install scout_missing_provider" in notices[0].text
diff --git a/tests/hermes_cli/test_memory_migration_home_labels.py b/tests/hermes_cli/test_memory_migration_home_labels.py
deleted file mode 100644
index e753f5e7d6d..00000000000
--- a/tests/hermes_cli/test_memory_migration_home_labels.py
+++ /dev/null
@@ -1,68 +0,0 @@
-"""Update-time recovery messages identify the home they describe."""
-
-import pytest
-
-from hermes_cli import memory_provider_migration as mig
-from hermes_cli import plugin_python_deps as deps
-
-
[email protected]("outcome", ["success", "failure", "exception", "missing_catalog"])
-def test_update_outcomes_identify_each_home(tmp_path, monkeypatch, outcome):
- homes = [tmp_path / "alpha", tmp_path / "beta"]
- provider = "scout_missing_provider"
- for home in homes:
- home.mkdir()
- (home / "config.yaml").write_text(
- f"memory:\n provider: {provider}\n", encoding="utf-8"
- )
- monkeypatch.setenv("HERMES_HOME", str(homes[0]))
- monkeypatch.setattr(deps, "dependency_homes", lambda: homes)
- monkeypatch.setattr(mig, "catalog_source", lambda name: None if outcome == "missing_catalog" else name)
- calls = []
-
- def installer(home):
- def install(name):
- calls.append((home, name))
- if outcome == "exception":
- raise OSError("offline")
- return {"ok": outcome == "success", "error": "offline"}
- return install
-
- monkeypatch.setattr(mig, "_install_into", installer)
- said = []
- assert mig.migrate_all_homes(say=said.append) == ([provider, provider] if outcome == "success" else [])
- assert len(said) == len(homes)
- for home, message in zip(homes, said):
- assert str(home) in message
- assert provider in message
- assert str(homes[1] if home == homes[0] else homes[0]) not in message
- assert calls == ([] if outcome == "missing_catalog" else [(h, provider) for h in homes])
-
-
-def test_update_noop_remains_silent(tmp_path, monkeypatch, capsys):
- (tmp_path / "config.yaml").write_text("memory:\n provider: none\n", encoding="utf-8")
- monkeypatch.setattr(deps, "dependency_homes", lambda: [tmp_path])
- assert mig.migrate_all_homes() == []
- assert capsys.readouterr().out == ""
-
-
-def test_update_callbacks_bind_home_and_preserve_error_isolation(tmp_path, monkeypatch, capsys):
- homes = [tmp_path / "bad", tmp_path / "good"]
- monkeypatch.setattr(deps, "dependency_homes", lambda: homes)
- callbacks = []
-
- def migrate(home, *, install, say):
- callbacks.append(say)
- if home == homes[0]:
- raise OSError("unreadable config")
- say("installed")
- return "provider"
-
- monkeypatch.setattr(mig, "migrate_home", migrate)
- assert mig.migrate_all_homes() == ["provider"]
- assert str(homes[1]) in capsys.readouterr().out
- # Even a retained callback must refer to its own iteration, not the final home.
- callbacks[0]("late diagnostic")
- output = capsys.readouterr().out
- assert str(homes[0]) in output
- assert str(homes[1]) not in output
diff --git a/tests/hermes_cli/test_memory_provider_migration.py b/tests/hermes_cli/test_memory_provider_migration.py
index 1d0c786e335..f69ee33ae97 100644
--- a/tests/hermes_cli/test_memory_provider_migration.py
+++ b/tests/hermes_cli/test_memory_provider_migration.py
@@ -28,10 +28,8 @@ def test_missing_provider_installs_its_catalog_plugin_and_keeps_config(home, mon
assert mig.migrate_home(home, install=fake_install, say=said.append) == "honcho"
assert calls == ["honcho"]
- # The message must not imply config.yaml's memory.<name> keys still apply: the
- # plugin reads its own config, so "unchanged settings" reads as "they work" (#124038).
- assert "nothing was removed or modified" in said[0]
- assert "memory.honcho settings" not in said[0]
+ # Must not imply config.yaml's memory.<name> keys still apply: the plugin reads its own (#124038).
+ assert "memory.honcho" not in said[0] and "hermes memory status" in said[0]
assert "workspace: keep-me" in (home / "config.yaml").read_text()
# present now → nothing to do, nothing said
assert mig.migrate_home(home, install=fake_install, say=said.append) is None
@@ -124,3 +122,50 @@ def test_unattended_migration_install_carries_lazy_install_consent(tmp_path, mon
assert mig._install_into(tmp_path)(name) == {"ok": True}
assert seen["catalog_name"] == name
assert seen.get("assume_deps_consent", False) is consent
+
+
+def test_update_asks_once_and_names_each_profile(tmp_path, monkeypatch):
+ """Profiles sharing one environment face one dependency question for a migrating provider
+ (#125794); every line names its profile, and a decline names the rest once with their commands."""
+ from hermes_cli import plugins_cmd_install
+
+ root = tmp_path / ".hermes"
+ homes = [root, root / "profiles" / "work-a", root / "profiles" / "work-b"]
+ for profile_home in homes:
+ profile_home.mkdir(parents=True, exist_ok=True)
+ (profile_home / "config.yaml").write_text("memory:\n provider: twin\n", encoding="utf-8")
+ monkeypatch.setenv("HERMES_HOME", str(root))
+ monkeypatch.setattr("hermes_constants.get_default_hermes_root", lambda: root)
+ monkeypatch.setattr("pm.plugins_state.dependency_homes", lambda: homes)
+ monkeypatch.setattr(mig, "provider_present", lambda name, home: (home / "plugins" / name).is_dir())
+ monkeypatch.setattr(mig, "catalog_source", lambda name: name)
+ monkeypatch.setattr(plugins_cmd_install.sys.stdin, "isatty", lambda: True)
+ monkeypatch.setattr(plugins_cmd_install.sys.stdout, "isatty", lambda: True)
+
+ class Console:
+ def print(self, *args, **kwargs):
+ pass
+
+ def installer(profile_home):
+ def install(name): # the real consent gate every catalog install passes through
+ consented, reason = plugins_cmd_install._consent_python_deps(name, ("twin-client",), Console())
+ if not consented:
+ return {"ok": False, "error": reason}
+ (profile_home / "plugins" / name).mkdir(parents=True)
+ return {"ok": True}
+ return install
+
+ monkeypatch.setattr(mig, "_install_into", installer)
+ for answer, expected in (("n", []), ("y", ["twin"] * 3)):
+ prompts, said = [], []
+ monkeypatch.setattr("builtins.input", lambda prompt, a=answer: prompts.append(prompt) or a)
+ assert mig.migrate_all_homes(say=said.append) == expected
+ assert len(prompts) == 1
+ if answer == "n":
+ assert "[profile 'default']" in said[1] and "dependency install declined" in said[1]
+ assert "hermes -p work-a plugins install twin" in said[2]
+ assert "hermes -p work-b plugins install twin" in said[2]
+ assert not any((h / "plugins").exists() for h in homes)
+ else:
+ assert [line.split("]")[0] for line in said[1:]] == [
+ " [profile 'default'", " [profile 'work-a'", " [profile 'work-b'"]
diff --git a/website/docs/user-guide/features/memory-providers.md b/website/docs/user-guide/features/memory-providers.md
index 4b1a527148c..de2bfb98c35 100644
--- a/website/docs/user-guide/features/memory-providers.md
+++ b/website/docs/user-guide/features/memory-providers.md
@@ -493,14 +493,14 @@ See the [upstream Hermes integration docs](https://hindsight.vectorize.io/sdks/i
Hindsight used to ship inside the Hermes tree (and as the `hermes-agent[hindsight]` pip extra). If your `config.yaml` already has `memory.provider: hindsight`, there is nothing to do for most users:
-- `hermes update` installs the catalog plugin into every profile home that names the provider. In a terminal it asks before preparing the plugin's Python dependencies. Without a terminal (the Desktop app, a script, a service) nobody can answer, so it prepares them unattended when `security.allow_lazy_installs` is on (the default) and otherwise prints the `hermes plugins install hindsight` one-liner.
-- If the plugin is still missing on the first agent start (`hermes chat`, the gateway, the Desktop app, …), Hermes installs it, dependencies included, and prints `✓ Memory provider 'hindsight' moved out of core — installed its plugin from the catalog (nothing was removed or modified; the plugin reads its own config — see `hermes memory status`).`
-- With `security.allow_lazy_installs: false`, the agent-start path instead logs one line — ``Memory provider 'hindsight' is not installed; security.allow_lazy_installs is off — run `hermes plugins install hindsight`.`` — and you run `hermes plugins install hindsight` yourself.
+- `hermes update` installs the catalog plugin into every profile home that names the provider. Each line names the profile it is about. In a terminal it asks before preparing the plugin's Python dependencies; when several profiles use the provider, the questions are asked once and the answers apply to all of them. Without a terminal (the Desktop app, a script, a service) nobody can answer, so each profile prepares them unattended when its `security.allow_lazy_installs` is on (the default); a profile with it off gets the exact `hermes -p <profile> plugins install hindsight` command instead, and the other profiles still migrate.
+- If the plugin is still missing on the first agent start (`hermes chat`, Desktop, the gateway, …), Hermes installs it, dependencies included, and shows ``✓ Memory provider 'hindsight' moved out of core — installed its plugin from the catalog (memory.provider and your stored memories are unchanged; check its settings with `hermes memory status`).`` Messaging platforms get the line with the first reply.
+- When the agent-start install cannot happen, you see why instead of silently running without external memory: with `security.allow_lazy_installs: false` the warning names the install command for that profile; offline or declined installs show the error and the same command.
What changes on disk: the plugin appears in `~/.hermes/plugins/hindsight/` and `config.yaml` gains `plugins.enabled: [hindsight]`. `memory.provider`, `$HERMES_HOME/hindsight/config.json`, `HINDSIGHT_API_KEY` in `.env` and your memory bank data are untouched. Verify with `hermes memory status` (provider active) and `hermes plugins list` (plugin installed and enabled).
:::warning Where the plugin reads its config
-Hindsight reads **only** `$HERMES_HOME/hindsight/config.json` (per profile home), `~/.hindsight/config.json` (legacy shared), and the `HINDSIGHT_*` variables in `.env` — never `config.yaml`. There is no `memory.hindsight` section in the config schema, and no bundled version of this plugin ever read one: a `memory.hindsight.*` key in `config.yaml` is silently ignored. Edit the plugin's own `config.json` (key table above) or use `hermes memory setup`.
+Hindsight reads `$HERMES_HOME/hindsight/config.json` (per profile home), `~/.hindsight/config.json` (legacy shared), and the `HINDSIGHT_*` variables in `.env`. It does not read a `memory.hindsight` section of `config.yaml`: a `memory.hindsight.*` key there is ignored. Edit the plugin's own `config.json` (key table above) or use `hermes memory setup`.
:::
---
@@ -742,11 +742,13 @@ Each provider's data is isolated per [profile](../profiles.md):
Memory providers are moving out of the Hermes tree into their maintainers' own repositories,
published through the [plugin catalog](./plugins.md) — Hindsight is the first (see
[Migrating from bundled Hindsight](#migrating-from-bundled-hindsight)). Nothing changes for you: the
-provider name, your `memory.<name>` settings, its data directory and its tools stay the same.
+provider name, the settings it reads, its data directory and its tools stay the same.
When a provider you have configured stops shipping with Hermes, `hermes update` installs its
catalog plugin for every profile that names it; if you update through the Desktop app, the
-agent does the same the first time it starts (unless `security.allow_lazy_installs` is
-`false`, in which case it logs the `hermes plugins install <name>` one-liner instead).
+agent does the same the first time it starts. Every outcome is shown to you — in the terminal,
+in Desktop, or with the first reply on a messaging platform. If the install cannot happen
+(`security.allow_lazy_installs: false`, offline, declined), the warning includes the exact
+`hermes plugins install <name>` command.
## Building a Memory Provider