Skip to content

The agent that grows with you

fix(memory): warn every profile whose memory provider is unavailable; say "Install declined" for a first install

teknium1c687e367c9fa
diff --git a/agent/agent_init.py b/agent/agent_init.py
index 3713b214554..2f93c0b45fc 100644
--- a/agent/agent_init.py
+++ b/agent/agent_init.py
@@ -49,20 +49,28 @@ logger = logging.getLogger("run_agent")
# Deduped: the gateway builds a fresh AIAgent per message, so it would warn every turn.
-_warned_unavailable_providers: set[str] = set()
+_warned_unavailable_providers: set[tuple[str, str]] = set()
+
+
+def _unavailable_warning_key(name: str) -> tuple[str, str]:
+ """Once per profile home and provider: one multiplexed gateway/Desktop backend serves several
+ profiles, and each one running without its memory must be told."""
+ from hermes_constants import get_hermes_home, hermes_home_key
+ return hermes_home_key(get_hermes_home()), name
def _warn_memory_provider_unavailable(name: str, reason: str = "", say=None) -> None:
- """Warn once per provider that a configured memory provider is unavailable.
+ """Warn once per home and 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. *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:
+ key = _unavailable_warning_key(name)
+ if key in _warned_unavailable_providers:
return
- _warned_unavailable_providers.add(name)
+ _warned_unavailable_providers.add(key)
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 "
@@ -1373,7 +1381,7 @@ def _init_memory(agent, _agent_cfg, skip_memory, platform, memory_manager=None):
_mp = _load_mem(_mem_provider_name)
if _mp and _mp.is_available():
agent._memory_manager.add_provider(_mp)
- elif _mp is not None and _mem_provider_name not in _warned_unavailable_providers:
+ elif _mp is not None and _unavailable_warning_key(_mem_provider_name) not in _warned_unavailable_providers:
# unavailable_reason() reads config/probes importlib — skip it once warned.
_unavailable_reason = ""
with suppress(Exception):
diff --git a/hermes_cli/plugins_transaction.py b/hermes_cli/plugins_transaction.py
index b8cb04d8243..8be6f4ff44b 100644
--- a/hermes_cli/plugins_transaction.py
+++ b/hermes_cli/plugins_transaction.py
@@ -33,8 +33,9 @@ def publish_plugin(staged: Path, target: Path, old_metadata: dict, new_metadata:
consented, reason = plugins_cmd._install_plugin_python_deps(
plugins_cmd._read_manifest_for_install(staged), staged, plugins_cmd._console())
if not consented:
- raise plugins_cmd.PluginOperationError(
- f"Reinstall declined: {reason}. The installed plugin and active environment are unchanged.")
+ outcome = ("Reinstall declined: {}. The installed plugin and active environment are unchanged."
+ if target.exists() else "Install declined: {}. Nothing was installed.")
+ raise plugins_cmd.PluginOperationError(outcome.format(reason))
sync_venv(explicit=True, plugins=StagedUpdate({
"staged": str(staged.resolve()), "target": str(target.absolute()),