The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): surface config mutations applied silently during version-bump-only updates
3Nya3bd0586e0623a
diff --git a/hermes_cli/update_cmd.py b/hermes_cli/update_cmd.pyindex 9ed58950411..cc409468bf4 100644--- a/hermes_cli/update_cmd.py+++ b/hermes_cli/update_cmd.py@@ -5348,8 +5348,21 @@ def _cmd_update_impl(args, gateway_mode: bool):f" ℹ Updating config format (v{current_ver} → v{latest_ver})…")try:- _run_migrate_config_fresh(interactive=False, quiet=True)+ _mig_results = _run_migrate_config_fresh(+ interactive=False, quiet=True+ )print(" ✓ Config format updated (no new settings to configure)")+ # quiet=True also mutes migration steps that RESET or REMOVE an+ # existing setting (e.g. the v33→v34 personality reset from+ # #81946, which records its note only in the results dict).+ # Re-surface those notes so an unattended update never silently+ # changes user configuration (#86656). In this branch+ # missing_config is empty, so config_added can only contain+ # migration-step mutations, not missing-key listings.+ for _note in _mig_results.get("config_added") or []:+ print(f" ℹ {_note}")+ for _warn in _mig_results.get("warnings") or []:+ print(f" ⚠️ {_warn}")except Exception as _mig_err:print(f" ⚠️ Config format update failed: {_mig_err}")print(" Run 'hermes config migrate' to retry.")diff --git a/tests/hermes_cli/test_cmd_update.py b/tests/hermes_cli/test_cmd_update.pyindex b9aac2a1ee2..9f8f59f4d47 100644--- a/tests/hermes_cli/test_cmd_update.py+++ b/tests/hermes_cli/test_cmd_update.py@@ -326,6 +326,49 @@ class TestCmdUpdateMigrationPrompt:# The misleading question must NOT appear for a pure version bump.assert "configure them now" not in out.lower()+ def test_version_bump_only_surfaces_migration_resets(+ self, mock_args, capsys+ ):+ """A quiet version-bump migration that RESETS a user setting must say so.++ Regression for #86656: the v33→v34 personality reset ran with+ quiet=True and its results dict was discarded, so the update printed+ "no new settings to configure" while silently wiping+ display.personality. Migration-step mutations (config_added) and+ warnings must be re-surfaced even in the silent branch.+ """+ with patch("shutil.which", return_value=None), patch(+ "subprocess.run"+ ) as mock_run, patch("builtins.input") as mock_input, patch(+ "hermes_cli.config.get_missing_env_vars", return_value=[]+ ), patch(+ "hermes_cli.config.get_missing_config_fields", return_value=[]+ ), patch(+ "hermes_cli.update_cmd._reload_config_modules"+ ), patch(+ "hermes_cli.update_cmd._run_config_check_fresh", return_value=(33, 34)+ ), patch(+ "hermes_cli.update_cmd._run_migrate_config_fresh",+ return_value={+ "env_added": [],+ "config_added": ["display.personality=none (one-time reset)"],+ "warnings": ["Disabled suspicious MCP server 'evil'"],+ },+ ):+ mock_run.side_effect = _make_run_side_effect(+ branch="main", verify_ok=True, commit_count="1"+ )++ cmd_update(mock_args)++ mock_input.assert_not_called()+ out = capsys.readouterr().out+ assert "Updating config format (v33 → v34)" in out+ assert "no new settings to configure" in out+ # The migration's mutation note and warning must NOT be swallowed.+ assert "display.personality=none (one-time reset)" in out+ assert "Disabled suspicious MCP server 'evil'" in out+def test_new_options_are_listed_by_name_before_prompt(self, mock_args, capsys):