The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cli): missing sticky profile error names the recovery command
kshitijk4poorfbb0eb35e155
diff --git a/hermes_cli/main.py b/hermes_cli/main.pyindex 2785de5b37a..ac7c36e06e8 100644--- a/hermes_cli/main.py+++ b/hermes_cli/main.py@@ -627,6 +627,7 @@ def _apply_profile_override() -> None:hermes_home = resolve_profile_env(profile_name)except FileNotFoundError as exc:hermes_home = _resolve_sudo_user_profile_env(profile_name)+ error = str(exc)if not hermes_home and from_sticky_profile:from hermes_cli.main_profile_recovery import is_stale_profile_recovery_command@@ -637,8 +638,10 @@ def _apply_profile_override() -> None:"running this recovery command in the default profile.",file=sys.stderr,)+ else:+ error = f"Saved profile '{profile_name}' no longer exists. Switch back with: hermes profile use default"if not hermes_home:- print(f"Error: {exc}", file=sys.stderr)+ print(f"Error: {error}", file=sys.stderr)sys.exit(1)except ValueError as exc:print(f"Error: {exc}", file=sys.stderr)diff --git a/tests/hermes_cli/test_apply_profile_override.py b/tests/hermes_cli/test_apply_profile_override.pyindex e88c8e1424a..5ab10c00a30 100644--- a/tests/hermes_cli/test_apply_profile_override.py+++ b/tests/hermes_cli/test_apply_profile_override.py@@ -100,22 +100,25 @@ def test_missing_sticky_profile_allows_recovery_commands(assert (root / "active_profile").read_text(encoding="utf-8-sig") == "ray"[email protected]("argv", [- ["hermes", "chat"],- ["hermes", "uninstall", "--data"],- ["hermes", "uninstall", "--dat", "--yes"],- ["hermes", "uninstall", "--full", "--yes"],- ["hermes", "uninstall", "--fu"],- ["hermes", "uninstall", "--full", "--data"],- ["hermes", "-p", "ray", "uninstall"],[email protected]("argv, expect_hint", [+ (["hermes", "chat"], True),+ (["hermes", "uninstall", "--data"], True),+ (["hermes", "uninstall", "--dat", "--yes"], True),+ (["hermes", "uninstall", "--full", "--yes"], True),+ (["hermes", "uninstall", "--fu"], True),+ (["hermes", "uninstall", "--full", "--data"], True),+ (["hermes", "-p", "ray", "uninstall"], False), # explicit -p keeps the create hint])-def test_missing_profile_still_blocks_other_or_explicit_commands(tmp_path, monkeypatch, argv):+def test_missing_profile_still_blocks_other_or_explicit_commands(+ tmp_path, monkeypatch, capsys, argv, expect_hint,+):with pytest.raises(SystemExit) as exc:_run_apply_profile_override(tmp_path, monkeypatch, hermes_home=str(tmp_path / ".hermes"),active_profile="ray", create_active_profile=False, argv=argv,)assert exc.value.code == 1+ assert ("hermes profile use default" in capsys.readouterr().err) is expect_hintclass TestApplyProfileOverrideHermesHomeGuard: