The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(left-core): `hermes update` reads the launch home's process env, as agent start does
Teknium4a4d62b6a475
diff --git a/hermes_cli/left_core_migration.py b/hermes_cli/left_core_migration.pyindex 55ed29f6511..287700f2165 100644--- a/hermes_cli/left_core_migration.py+++ b/hermes_cli/left_core_migration.py@@ -934,7 +934,7 @@ def migrate_home(home: Path, *, install: Callable[[str], dict], say: Callable[[s"""Install every left-core plugin *home* uses and lacks. Returns installed plugin names; never raises."""installed = []for feature in _pending(home, say=say, process_env=process_env):- if _install_one(home, feature, install=install, say=say):+ if _install_one(home, feature, install=install, say=say, process_env=process_env):installed.append(feature.plugin)return installed@@ -944,15 +944,19 @@ def migrate_all_homes(*, say: Callable[[str], None] = print) -> list[str]:unattended consent like the memory migration: homes of one group share dependency answers, and afailure names the rest of its group in one line instead of failing them one by one."""from hermes_cli.plugins_cmd_install import shared_dependency_answers+ from hermes_constants import get_routing_process_hermes_home, hermes_home_keyfrom pm.plugins_state import dependency_homesdef labelled(home: Path) -> Callable[[str], None]:return lambda message: say(f" [{_home_label(home)}] {message.lstrip()}")+ def launched(home: Path) -> bool: # this process's env (a shell export) is the launch home's, as at start+ return hermes_home_key(home) == hermes_home_key(get_routing_process_hermes_home())+pending: dict[tuple[str, bool], tuple[LeftCoreFeature, list[Path]]] = {}for home in dependency_homes():try:- features = _pending(home, say=labelled(home))+ features = _pending(home, say=labelled(home), process_env=launched(home))consent = bool(features) and _home_consent(home)except Exception as exc:logger.debug("left-core migration skipped for %s: %s", home, exc)@@ -969,7 +973,8 @@ def migrate_all_homes(*, say: Callable[[str], None] = print) -> list[str]:f"questions apply to all of them.")with shared_dependency_answers():for index, home in enumerate(homes):- if _install_one(home, feature, install=_install_into(home), say=labelled(home)):+ if _install_one(home, feature, install=_install_into(home), say=labelled(home),+ process_env=launched(home)):installed.append(feature.plugin)continuerest = homes[index + 1:]diff --git a/tests/hermes_cli/test_left_core_provider_rows.py b/tests/hermes_cli/test_left_core_provider_rows.pyindex fd876b7916c..bba95a5e7b6 100644--- a/tests/hermes_cli/test_left_core_provider_rows.py+++ b/tests/hermes_cli/test_left_core_provider_rows.py@@ -131,6 +131,28 @@ def test_gh_only_home_is_told_to_log_in_on_every_migration_outcome(tmp_path):assert "could not be installed automatically" in said[0] and "run `hermes auth add copilot`" in said[0]+def test_update_reads_the_launch_homes_exported_token_for_the_relogin_notice(tmp_path, monkeypatch):+ """`hermes update` from a shell that exports GH_TOKEN: the launch home's agent will read it, so no+ "sign in again" notice; a sibling profile never sees the launch shell's env."""+ import pm.plugins_state as ps+ launch, other = (_home(tmp_path / name, config="model:\n provider: copilot\n").rename(tmp_path / name / name)+ for name in ("launch", "other"))+ monkeypatch.setenv("HERMES_HOME", str(launch))+ monkeypatch.setenv("GH_TOKEN", "gho_exported")+ monkeypatch.setattr(ps, "dependency_homes", lambda: [launch, other])+ monkeypatch.setattr(lcm, "_home_consent", lambda home: True)++ def install_into(home, **kw):+ return lambda name: (home / "plugins" / name).mkdir(parents=True) or {"ok": True}+ monkeypatch.setattr(lcm, "_install_into", install_into)+ said = []+ lcm.migrate_all_homes(say=said.append)+ by_home = {h: " ".join(m for m in said if lcm._home_label(h) in m) for h in (launch, other)}+ assert "✓ GitHub Copilot moved out of core" in by_home[launch]+ assert "run `hermes auth add copilot`" not in by_home[launch]+ assert "run `hermes auth add copilot`" in by_home[other]++# ── generic seams through a fake row ─────────────────────────────────────────────────────────────