From 7cf0afdf980bfa6fbe16f4e004ba3c35d076aabd Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Tue, 22 Sep 2026 14:26:04 -0700 Subject: [PATCH] fix(update): drop the --reinstall plumbing; a plain editable install already rewrites the finder Review fix for #119525. The stale-map detection stays; the forced `--reinstall` goes, for three reasons verified live: - uv (0.12.13, the version the updater ships) reinstalls an editable source tree on every `uv pip install -e .` (`~ hermes-agent==0.21.4` even with no change). Adding a root module and running the plain install rewrote the finder MAPPING without touching packaging files, so once the skip is refused the existing install already refreshes it. - `--reinstall` reinstalls EVERY package in the venv, not just hermes-agent; the narrow spelling would be `--reinstall-package hermes-agent`, and neither is needed. - `--reinstall` is not a pip option. On the pip fallback path (no uv: Termux without uv, some site-packages installs) a stale map turned the update into a hard `no such option` failure, worse than the skip. Also removes the second `_editable_finder_mapping_current` call in `_sync_python_dependencies_after_pull` (the predicate already ran it) and the flag's test. --- hermes_cli/main_install_repair.py | 5 +--- hermes_cli/update_cmd_deps.py | 4 +--- ..._update_skip_unchanged_editable_install.py | 24 ------------------- 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/hermes_cli/main_install_repair.py b/hermes_cli/main_install_repair.py index 33e17f0bc9..6e1fd55353 100644 --- a/hermes_cli/main_install_repair.py +++ b/hermes_cli/main_install_repair.py @@ -951,8 +951,7 @@ def _interpreter_scripts_dir() -> Path | None: def _install_python_dependencies_with_optional_fallback( - install_cmd_prefix: list[str], *, env: dict[str, str] | None = None, group: str = "all", - reinstall: bool = False, + install_cmd_prefix: list[str], *, env: dict[str, str] | None = None, group: str = "all" ) -> None: """Install base deps plus as many optional extras as the environment supports. @@ -981,8 +980,6 @@ def _install_python_dependencies_with_optional_fallback( scripts_dir = _interpreter_scripts_dir() def _install(args: list[str]) -> None: - if reinstall: - args = [args[0], "--reinstall", *args[1:]] if pin_python: args = _insert_python_pin(args) # strict_quarantine: this is the UPDATE dependency sync; ShimQuarantineError propagates diff --git a/hermes_cli/update_cmd_deps.py b/hermes_cli/update_cmd_deps.py index 1bacabf4e4..c0c47261dd 100644 --- a/hermes_cli/update_cmd_deps.py +++ b/hermes_cli/update_cmd_deps.py @@ -1199,7 +1199,6 @@ def _sync_python_dependencies_after_pull( # by the next launch (``_recover_from_interrupted_install``). Lazy refresh uses its own marker. _write_update_incomplete_marker() deps_current = _editable_install_is_current(git_cmd, _m().PROJECT_ROOT, pre_pull_sha) - mapping_current = _editable_finder_mapping_current(_m().PROJECT_ROOT) print( "→ Python dependencies unchanged — skipping reinstall" if deps_current else "→ Updating Python dependencies...") @@ -1232,8 +1231,7 @@ def _sync_python_dependencies_after_pull( print(" → Termux/Android detected: prebuilding psutil with Linux source path compatibility...") _install_psutil_android_compat(install_prefix, env=lazy_env) _m()._install_python_dependencies_with_optional_fallback( - install_prefix, env=lazy_env, group=install_group, - reinstall=mapping_current is False) + install_prefix, env=lazy_env, group=install_group) # Clear the core breadcrumb before lazy refresh, which uses its own marker so a lazy # failure can't be "healed" by a narrow core import probe. diff --git a/tests/hermes_cli/test_update_skip_unchanged_editable_install.py b/tests/hermes_cli/test_update_skip_unchanged_editable_install.py index b781b2c0fe..3ab43556d5 100644 --- a/tests/hermes_cli/test_update_skip_unchanged_editable_install.py +++ b/tests/hermes_cli/test_update_skip_unchanged_editable_install.py @@ -116,30 +116,6 @@ def test_unreadable_finder_fails_closed(repo, monkeypatch): assert _editable_install_is_current(GIT, repo, before) is False -def test_mapping_drift_requests_reinstall_flag(): - from hermes_cli.main_install_repair import _install_python_dependencies_with_optional_fallback - - recorded = [] - monkeypatch = pytest.MonkeyPatch() - monkeypatch.setattr( - "hermes_cli.main_install_repair._run_quarantined_install", - lambda cmd, **kwargs: recorded.append(cmd), - ) - monkeypatch.setattr( - "hermes_cli.main_install_repair._verify_console_scripts_installed", - lambda *args, **kwargs: None, - ) - monkeypatch.setattr("hermes_cli.main_install_repair._is_windows", lambda: False) - try: - _install_python_dependencies_with_optional_fallback(["uv", "pip"], reinstall=True) - assert recorded and "--reinstall" in recorded[0] - recorded.clear() - _install_python_dependencies_with_optional_fallback(["uv", "pip"], reinstall=False) - assert recorded and "--reinstall" not in recorded[0] - finally: - monkeypatch.undo() - - def test_source_only_pull_skips_the_reinstall(repo): """The common update: .py churn inside already-mapped packages.""" before = _head(repo)