The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(updater): finish Node phase after Windows handoff
fangliquanflq4e3165b75a83
diff --git a/hermes_cli/update_cmd.py b/hermes_cli/update_cmd.pyindex 758b5c7a8e8..67cd72017af 100644--- a/hermes_cli/update_cmd.py+++ b/hermes_cli/update_cmd.py@@ -596,7 +596,7 @@ def _print_update_check_result(behind: int | None, compare_branch: str) -> None:def _repair_venv_on_current_checkout(- *, assume_yes, gateway_mode, pre_update_snapshot_id, desktop_dir,+ *, assume_yes, gateway_mode, pre_update_snapshot_id,had_desktop_app_before_update, active_lazy_features, active_tool_dependencies,_windows_gateway_resume) -> bool:"""Reinstall ``.[all]`` + lazy/tool deps into an unhealthy (or handed-off) venv; returns@@ -630,15 +630,17 @@ def _repair_venv_on_current_checkout(print(" Close all Hermes windows/gateways and re-run: hermes update")return Falseprint("✓ Dependencies repaired!")- # Check for config migrations (#91360).- _check_and_apply_config_migration(- assume_yes=assume_yes, gateway_mode=gateway_mode, pre_update_snapshot_id=pre_update_snapshot_id)- # The hand-off child never reaches the commits-pulled rebuild; do it here.- if _rebuild_desktop_after_update(desktop_dir, had_desktop_app_before_update=had_desktop_app_before_update):- return _print_verified_update_completion("✓ Update complete!")- _print_update_completion(- "⚠ Update partially complete — the desktop app was not rebuilt and is still on the previous build.")- return False+ # The hand-off child never reaches the commits-pulled Node/web/Desktop+ # phase. Finish through the current-checkout repair path, whose npm digest+ # gate keeps this cheap when the pulled manifests did not change.+ return _repair_node_deps_on_current_checkout(+ _print_verified_update_completion,+ assume_yes=assume_yes,+ gateway_mode=gateway_mode,+ pre_update_snapshot_id=pre_update_snapshot_id,+ completion_message="✓ Update complete!",+ had_desktop_app_before_update=had_desktop_app_before_update,+ )def _pip_install_prefix(uv_bin) -> tuple[list[str], dict | None]:@@ -657,7 +659,7 @@ def _pip_install_prefix(uv_bin) -> tuple[list[str], dict | None]:def _repair_current_checkout(- *, assume_yes, gateway_mode, pre_update_snapshot_id, desktop_dir,+ *, assume_yes, gateway_mode, pre_update_snapshot_id,had_desktop_app_before_update, active_lazy_features, active_tool_dependencies,upstream_checked, _windows_gateway_resume) -> bool:"""Already-up-to-date path: keep the managed runtime current, repair a broken venv.@@ -685,7 +687,7 @@ def _repair_current_checkout(if handed_off_sync or not healthy:current_checkout_complete = _repair_venv_on_current_checkout(assume_yes=assume_yes, gateway_mode=gateway_mode,- pre_update_snapshot_id=pre_update_snapshot_id, desktop_dir=desktop_dir,+ pre_update_snapshot_id=pre_update_snapshot_id,had_desktop_app_before_update=had_desktop_app_before_update,active_lazy_features=active_lazy_features,active_tool_dependencies=active_tool_dependencies,@@ -1173,7 +1175,7 @@ def _finalize_receipt(status: str, debug_message: str) -> None:def _finish_already_up_to_date(git_cmd, branch: str, current_branch: str, _plan, *, assume_yes: bool, gateway_mode: bool,- gw_input_fn, pre_update_snapshot_id, desktop_dir, had_desktop_app_before_update: bool,+ gw_input_fn, pre_update_snapshot_id, had_desktop_app_before_update: bool,active_lazy_features, active_tool_dependencies, _windows_gateway_resume) -> None:""""Already up to date" path: restore stash/branch, repair the checkout, catch up the fleet.``sys.exit(1)`` when the repair is incomplete (after gateway exit code + partial receipt)."""@@ -1198,7 +1200,7 @@ def _finish_already_up_to_date(current_checkout_complete = _repair_current_checkout(assume_yes=assume_yes, gateway_mode=gateway_mode,- pre_update_snapshot_id=pre_update_snapshot_id, desktop_dir=desktop_dir,+ pre_update_snapshot_id=pre_update_snapshot_id,had_desktop_app_before_update=had_desktop_app_before_update,active_lazy_features=active_lazy_features,active_tool_dependencies=active_tool_dependencies, upstream_checked=_plan.upstream_checked,@@ -1373,7 +1375,7 @@ def _cmd_update_impl(args, gateway_mode: bool):_finish_already_up_to_date(git_cmd, branch, current_branch, _plan, assume_yes=assume_yes,gateway_mode=gateway_mode, gw_input_fn=gw_input_fn,- pre_update_snapshot_id=pre_update_snapshot_id, desktop_dir=desktop_dir,+ pre_update_snapshot_id=pre_update_snapshot_id,had_desktop_app_before_update=had_desktop_app_before_update,active_lazy_features=opts.active_lazy_features,active_tool_dependencies=opts.active_tool_dependencies,diff --git a/tests/hermes_cli/test_update_handoff_desktop_rebuild.py b/tests/hermes_cli/test_update_handoff_desktop_rebuild.pyindex 357d12bdd11..5be2707b0b6 100644--- a/tests/hermes_cli/test_update_handoff_desktop_rebuild.py+++ b/tests/hermes_cli/test_update_handoff_desktop_rebuild.py@@ -52,3 +52,39 @@ def test_failed_desktop_rebuild_withholds_success_completion():assert complete is Falsefor call in completion.call_args_list:assert not call[0][0].startswith("✓")+++def test_handoff_venv_repair_finishes_node_and_web_phase(tmp_path):+ """A successful Python repair must not bypass the remaining update work."""+ project_root = tmp_path / "hermes"+ venv_python = project_root / "venv" / "Scripts" / "python.exe"+ venv_python.parent.mkdir(parents=True)+ venv_python.touch()++ with (+ patch.object(update_cmd, "venv_python_path", return_value=venv_python),+ patch.object(update_cmd, "_pip_install_prefix", return_value=(["uv", "pip"], None)),+ patch.object(update_cmd, "_venv_core_imports_healthy", return_value=(True, "ok")),+ patch.object(update_cmd, "_write_update_incomplete_marker"),+ patch.object(update_cmd, "_update_node_dependencies", return_value=[]) as update_node,+ patch.object(update_cmd, "_check_and_apply_config_migration"),+ patch.object(update_cmd, "_rebuild_desktop_after_update", return_value=True),+ patch.object(update_cmd, "_print_verified_update_completion", return_value=True) as completion,+ patch("hermes_cli.managed_uv.ensure_uv", return_value="uv"),+ patch.object(update_cmd, "_m") as m,+ ):+ m.return_value.PROJECT_ROOT = project_root+ complete = update_cmd._repair_venv_on_current_checkout(+ assume_yes=True,+ gateway_mode=False,+ pre_update_snapshot_id=None,+ had_desktop_app_before_update=False,+ active_lazy_features=(),+ active_tool_dependencies=(),+ _windows_gateway_resume=None,+ )++ assert complete is True+ update_node.assert_called_once_with()+ m.return_value._build_web_ui.assert_called_once_with(project_root / "web")+ completion.assert_called_once_with("✓ Update complete!")