The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): verify the Windows update receipt against the checkout, not cwd
Teknium8068c09432d3
diff --git a/hermes_cli/desktop_update_verify.py b/hermes_cli/desktop_update_verify.pyindex a9e88be86bc..a847f889cfc 100644--- a/hermes_cli/desktop_update_verify.py+++ b/hermes_cli/desktop_update_verify.py@@ -69,8 +69,20 @@ def _verify_packaged_entry(resources: Path) -> None:raise RuntimeError(f"The updated Desktop renderer entry is invalid: {exc}") from exc-def verify_windows_desktop_update(project_root: Path) -> None:- """Raise when a zero-exit updater left an incomplete or stale packaged app."""+def checkout_root() -> Path:+ """The checkout this module was imported from: the only root the receipt may describe."""+ return Path(__file__).resolve().parent.parent+++def verify_windows_desktop_update(project_root: Path | None = None) -> None:+ """Raise when a zero-exit updater left an incomplete or stale packaged app.++ The root defaults to the imported checkout, never the caller's cwd: the hand-off+ is spawned from HERMES_HOME by the pre-update Desktop, and a cwd-derived root+ reported a healthy install as "Desktop executable is missing" (Sep 2026).+ """+ if project_root is None:+ project_root = checkout_root()desktop = project_root / "apps" / "desktop"executable = _desktop_packaged_executable(desktop)if executable is None:diff --git a/scripts/desktop-update/windows.ps1 b/scripts/desktop-update/windows.ps1index 17d4d721973..5124b2123d2 100644--- a/scripts/desktop-update/windows.ps1+++ b/scripts/desktop-update/windows.ps1@@ -1644,7 +1644,7 @@ try {# A zero-exit update is not proof that the runtime survived the update.if ($res.Code -eq 0 -and -not $desktopBuildFailed) {- $verifyCode = "import hermes_cli.main; from pathlib import Path; from hermes_cli.desktop_update_verify import verify_windows_desktop_update; verify_windows_desktop_update(Path.cwd())"+ $verifyCode = "import hermes_cli.main; from hermes_cli.desktop_update_verify import verify_windows_desktop_update; verify_windows_desktop_update()"$verify = Invoke-HermesStep $pythonExe @("-c", $verifyCode) "verify"if ($verify.Code -ne 0) {$finalCode = 8diff --git a/tests/hermes_cli/test_desktop_update_verify.py b/tests/hermes_cli/test_desktop_update_verify.pyindex 69590a39bc5..701f560a695 100644--- a/tests/hermes_cli/test_desktop_update_verify.py+++ b/tests/hermes_cli/test_desktop_update_verify.py@@ -51,3 +51,15 @@ def test_current_stamp_does_not_hide_damaged_output(bundle, damage):(dist / 'index.html').write_bytes({'empty-index': b'', 'unreadable-index': b'\xff', 'no-module': b'<html></html>'}[damage])with pytest.raises((RuntimeError, OSError, ValueError)):verify.verify_windows_desktop_update(root)+++def test_default_root_is_the_imported_checkout_not_cwd(tmp_path, monkeypatch):+ # The Windows hand-off is spawned from HERMES_HOME; the receipt must describe the checkout anyway.+ monkeypatch.chdir(tmp_path)+ seen = {}+ monkeypatch.setattr(verify, '_desktop_packaged_executable', lambda desktop: seen.setdefault('desktop', desktop) and None)+ with pytest.raises(RuntimeError, match='executable is missing'):+ verify.verify_windows_desktop_update()+ assert seen['desktop'] == verify.checkout_root() / 'apps' / 'desktop'+ assert (verify.checkout_root() / 'hermes_cli' / 'desktop_update_verify.py').is_file()+ assert verify.checkout_root() != tmp_path