The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: round-8 CI backlog (Windows-only lane)
ethernetf7561667c79c
diff --git a/scripts/desktop-update/windows.ps1 b/scripts/desktop-update/windows.ps1index 4b3cd669313..637acbc51af 100644--- a/scripts/desktop-update/windows.ps1+++ b/scripts/desktop-update/windows.ps1@@ -1557,8 +1557,10 @@ try {$gatewayArg = @()Write-HandoffLog "update requested without --gateway (remote-served Desktop)"}- $updateArgs = $runtimeArgs + @('update', '--yes') + $gatewayArg + $targetArgs- if ($legacyInstall) { $updateArgs += '--force' }+ # --force precedes the target (the hand-off contract test reads the argv in this order).+ $forceArg = @()+ if ($legacyInstall) { $forceArg = @('--force') }+ $updateArgs = $runtimeArgs + @('update', '--yes') + $gatewayArg + $forceArg + $targetArgs# --keep-stash: never re-apply local source edits after the update (they# stay parked in git stash). Probe --help first: the flag ships with newer# backends and an unknown flag would abort argparse with exit 2, whichdiff --git a/tests/conftest.py b/tests/conftest.pyindex 640ab2856af..7a8edd1a6e1 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -2167,3 +2167,18 @@ def _forbid_real_hermes_home_io(monkeypatch, request):from tests.home_io_guard import HomeIOGuardHomeIOGuard(lambda: _REAL_HERMES_ROOT_CANDIDATES).install(monkeypatch)+++def real_bash() -> str:+ """A bash that runs shell scripts: on the Windows runners PATH resolves ``bash`` to+ System32's WSL launcher, which prints a UTF-16 "no installed distributions" notice and+ exits 1. Prefer Git for Windows' bash there; elsewhere the PATH one is real."""+ found = shutil.which("bash")+ if sys.platform == "win32" and (+ not found or any(marker in found.lower() for marker in ("system32", "windowsapps"))):+ for rel in (("Git", "bin", "bash.exe"), ("Git", "usr", "bin", "bash.exe")):+ candidate = Path(os.environ.get("ProgramFiles", r"C:\Program Files")).joinpath(*rel)+ if candidate.exists():+ return str(candidate)+ return found or "bash"diff --git a/tests/hermes_cli/test_setup_pin_values.py b/tests/hermes_cli/test_setup_pin_values.pyindex fc3db077660..9e7a8930ef8 100644--- a/tests/hermes_cli/test_setup_pin_values.py+++ b/tests/hermes_cli/test_setup_pin_values.py@@ -4,7 +4,6 @@ import osfrom pathlib import Pathimport shutilimport subprocess-import sysimport pytest@@ -14,21 +13,9 @@ from pm.store import current_targetROOT = Path(__file__).resolve().parents[2]-def _bash() -> str:- """A real bash: on the Windows runner PATH finds System32's WSL stub first (it prints a- UTF-16 "no installed distributions" notice and exits 1), so prefer Git for Windows'."""- found = shutil.which("bash")- if sys.platform == "win32" and (not found or "system32" in found.lower() or "windowsapps" in found.lower()):- for rel in (("Git", "bin", "bash.exe"), ("Git", "usr", "bin", "bash.exe")):- cand = Path(os.environ.get("ProgramFiles", r"C:\Program Files")).joinpath(*rel)- if cand.exists():- return str(cand)- return found or "bash"--@pytest.mark.platforms("windows", "posix")@pytest.mark.parametrize("missing_target", [False, True])-def test_cold_setup_uses_exact_lock_values(tmp_path, missing_target):+def test_cold_setup_uses_exact_lock_values(tmp_path, missing_target, real_bash):checkout = tmp_path / "checkout"(checkout / "pm").mkdir(parents=True)shutil.copy2(ROOT / "setup-hermes.sh", checkout / "setup-hermes.sh")@@ -60,7 +47,7 @@ def test_cold_setup_uses_exact_lock_values(tmp_path, missing_target):env = dict(os.environ, HOME=tmp_path.as_posix(), HERMES_HOME=(tmp_path / "home").as_posix(),HERMES_RUNTIME_DIR=(tmp_path / "tools").as_posix(), BASH_ENV=hook.as_posix(),PROBE_ARGS=args.as_posix(), PROBE_DOWNLOAD=corrupt.as_posix())- result = subprocess.run([_bash(), str(checkout / "setup-hermes.sh")], cwd=tmp_path,+ result = subprocess.run([real_bash, str(checkout / "setup-hermes.sh")], cwd=tmp_path,env=env, capture_output=True, text=True, encoding="utf-8", timeout=30)assert result.returncode != 0, result.stdout + result.stderrif missing_target:diff --git a/tests/hermes_cli/test_source_launcher_publication.py b/tests/hermes_cli/test_source_launcher_publication.pyindex dca4e6f6d8d..a28c1263f07 100644--- a/tests/hermes_cli/test_source_launcher_publication.py+++ b/tests/hermes_cli/test_source_launcher_publication.py@@ -67,7 +67,7 @@ def select_generation(repo, name, value):@pytest.mark.platforms("windows", "posix")@pytest.mark.parametrize("form", ["native", "shell"])-def test_source_launchers_boot_selected_generation_from_custom_home(tmp_path, monkeypatch, form):+def test_source_launchers_boot_selected_generation_from_custom_home(tmp_path, monkeypatch, form, real_bash):repo, home, interpreter = fixture_tree(tmp_path, monkeypatch)out = tmp_path / "commands"out.mkdir()@@ -92,8 +92,8 @@ def test_source_launchers_boot_selected_generation_from_custom_home(tmp_path, moenv["PYTHONPATH"] = str(tmp_path / "foreign-deps")for launcher in launchers:assert launcher is not None- command = ["bash", "-s"] if form == "shell" else [str(launcher), *args]- script = "exec " + shlex.join(["bash", str(launcher), *args]) + "\n" if form == "shell" else None+ command = [real_bash, "-s"] if form == "shell" else [str(launcher), *args]+ script = "exec " + shlex.join([real_bash, str(launcher), *args]) + "\n" if form == "shell" else Noneresult = subprocess.run(command, input=script, cwd=tmp_path, env=env,capture_output=True, text=True, encoding="utf-8", timeout=30)assert result.returncode == 7, result.stdout + result.stderrdiff --git a/tests/hermes_cli/test_update_stale_gateway_yield.py b/tests/hermes_cli/test_update_stale_gateway_yield.pyindex 59f01c459b2..f6c78048401 100644--- a/tests/hermes_cli/test_update_stale_gateway_yield.py+++ b/tests/hermes_cli/test_update_stale_gateway_yield.py@@ -125,7 +125,7 @@ def test_verify_fleet_hands_stale_rows_to_survivor_signalling(monkeypatch):)with contextlib.redirect_stdout(io.StringIO()), pytest.raises(SystemExit) as exc:fleet_mod._verify_fleet_after_update(- restart, _pre_update_plan=None, _windows_gateway_resume=None, node_failures=[], update_complete=True,+ restart, _pre_update_plan=None, _windows_gateway_resume=None, update_complete=True,)assert exc.value.code == 1assert seen["fleet"] == stale_fleetdiff --git a/tests/install/e2e-assets/source-build-env.ps1 b/tests/install/e2e-assets/source-build-env.ps1index e44a7e4f0f2..ff4c7994fd9 100644--- a/tests/install/e2e-assets/source-build-env.ps1+++ b/tests/install/e2e-assets/source-build-env.ps1@@ -5,15 +5,20 @@ function Invoke-SourceBuild([scriptblock]$Action) {'HERMES_BUILD_COMMIT', 'HERMES_PAYLOAD_TAG', 'HERMES_PAYLOAD_VERSION', 'HERMES_DESKTOP_VARIANT')# The env: drive, not [Environment]::SetEnvironmentVariable: on .NET/Unix the latter only# updates the managed copy, so a child spawned afterwards still inherits the old value.+ # Test-Path first: under $ErrorActionPreference = 'Stop' a missing item would otherwise+ # terminate the try block before $Action runs.try {foreach ($name in $names) {- $saved[$name] = Get-Content -LiteralPath "env:$name" -ErrorAction SilentlyContinue- Remove-Item -LiteralPath "env:$name" -ErrorAction SilentlyContinue+ $item = "env:$name"+ if (Test-Path -LiteralPath $item) {+ $saved[$name] = (Get-Item -LiteralPath $item).Value+ Remove-Item -LiteralPath $item+ }}& $Action} finally {- foreach ($name in $names) {- if ($null -ne $saved[$name]) { Set-Item -LiteralPath "env:$name" -Value $saved[$name] }+ foreach ($name in $saved.Keys) {+ Set-Item -LiteralPath "env:$name" -Value $saved[$name]}}}diff --git a/tests/scripts/test_install_ps1_desktop_stage.py b/tests/scripts/test_install_ps1_desktop_stage.pyindex 3e5a8fd50c5..66d12e0261b 100644--- a/tests/scripts/test_install_ps1_desktop_stage.py+++ b/tests/scripts/test_install_ps1_desktop_stage.py@@ -3,8 +3,8 @@The retained desktop stage used to call helpers deleted by the PMconsolidation (Resolve-UvCmd, Test-Node, the electron-dist recovery set) —runtime failures under `-Stage desktop`. The stage must use the CURRENT-paths: pm's venv sync for the wake/voice extras and the product CLI-(`hermes desktop --build-only`) for the build. The $Stages table must be+path: the shared completion tail (source_completion.py --desktop) that+`hermes update` also runs. The $Stages table must bethe ONE list: -Manifest prints it and the no-flag ladder runs it, so-IncludeDesktop affects the real loop exactly as the manifest advertises.`-Stage desktop` stays directly dispatchable without the flag (the@@ -47,9 +47,10 @@ public static class FakePy {string log = Environment.GetEnvironmentVariable("FAKE_PY_LOG");File.AppendAllText(log, string.Join("\u0001", args) + Environment.NewLine);if (Array.IndexOf(args, "-c") >= 0) { return 0; }- if (args.Length >= 2- && args[args.Length - 2] == "desktop"- && args[args.Length - 1] == "--build-only") {+ // The shared completion tail (hermes_cli/source_completion.py --source <root> [--desktop])+ // builds the products; with --desktop it leaves the packaged app under release/.+ if (Array.IndexOf(args, "hermes_cli/source_completion.py") >= 0+ && Array.IndexOf(args, "--desktop") >= 0) {string dir = Path.Combine(Environment.GetEnvironmentVariable("FAKE_INSTALL_DIR"),"apps", "desktop", "release", "win-unpacked");@@ -180,13 +181,17 @@ def test_manifest_without_flag_lists_no_desktop(tmp_path: Path) -> None:assert "desktop" not in _manifest_stages(_run(powershell, tmp_path, ["-Manifest"]))-def test_manifest_with_include_desktop_orders_desktop_before_complete(tmp_path: Path) -> None:+def test_manifest_with_include_desktop_selects_the_desktop_product(tmp_path: Path) -> None:+ """-IncludeDesktop selects the desktop product inside the shared ``products`` stage+ (the bootstrap installer's manifest contract); it never adds a second build stage."""powershell = shutil.which("powershell")if not powershell:pytest.skip("Windows PowerShell is required")- names = _manifest_stages(_run(powershell, tmp_path, ["-Manifest", "-IncludeDesktop"]))- assert names.index("desktop") < names.index("complete")- assert names[-1] == "complete"+ stages = json.loads(_run(powershell, tmp_path, ["-Manifest", "-IncludeDesktop"]).stdout)["stages"]+ names = [s["name"] for s in stages]+ assert "desktop" not in names+ assert names.index("products") < names.index("complete") and names[-1] == "complete"+ assert "desktop" in next(s for s in stages if s["name"] == "products")["title"].lower()def test_unknown_stage_is_rejected(tmp_path: Path) -> None:@@ -216,8 +221,8 @@ def test_complete_stage_writes_pinned_install_marker(tmp_path: Path) -> None:def test_desktop_stage_uses_pm_sync_and_product_cli(tmp_path: Path) -> None:"""-Stage desktop (without -IncludeDesktop — the standalone contract)- runs the CURRENT paths: pm's venv sync for wake/voice, then- `hermes desktop --build-only` through the published installation launcher; the produced+ runs the CURRENT path: the shared completion tail (source_completion.py+ --desktop, the same call `hermes update` makes) builds the products; the producedartifact is probed, ACL-granted, and shortcut-ed — with icacls,ie4uinit.exe, and WScript.Shell intercepted in the wrapper boundary sonothing outside the temp dirs is touched."""@@ -265,15 +270,12 @@ def test_desktop_stage_uses_pm_sync_and_product_cli(tmp_path: Path) -> None:assert run.returncode == 0, f"{run.stdout}{run.stderr}\nFAKE LOG:\n{calls}"assert isinstance(calls, list)- # 1. wake/voice extras via pm's venv sync (the pm-owned path).- assert any(- len(c) >= 3 and c[:2] == ["-I", "-c"] and "from pm import sync_venv" in c[2]- and "'wake'" in c[2] and "'voice'" in c[2] and "explicit=True" in c[2]- for c in calls- ), calls- # 2. the build through the parsed product CLI (never a `build` subcommand- # or any deleted helper).- assert any(c[-2:] == ["desktop", "--build-only"] for c in calls), calls+ # 1./2. one completion call with the desktop product selected (never a `build`+ # subcommand, a deleted helper, or a separate extras sync — pm lazy-installs+ # wake/voice at first use, #70509).+ completion = [c for c in calls if "hermes_cli/source_completion.py" in c]+ assert len(completion) == 1 and "--desktop" in completion[0], calls+ assert not any(c[-2:] == ["desktop", "--build-only"] or "sync_venv" in " ".join(c) for c in calls), calls# 3. the stage probed the artifact the fake build produced.exe = install_dir / "apps" / "desktop" / "release" / "win-unpacked" / "Hermes.exe"assert exe.is_file(), callsdiff --git a/tests/scripts/test_install_stage_frames.py b/tests/scripts/test_install_stage_frames.pyindex 6e38eb21f55..4426844f505 100644--- a/tests/scripts/test_install_stage_frames.py+++ b/tests/scripts/test_install_stage_frames.py@@ -60,11 +60,11 @@ run_stage "$STAGE"@pytest.mark.platforms("windows", "posix")-def test_real_single_stage_cli_reports_admission_or_execution_failure(tmp_path):+def test_real_single_stage_cli_reports_admission_or_execution_failure(tmp_path, real_bash):stage = 'unknown"\\\n\x1fstage'env = dict(_env(tmp_path), PROBE_STAGE=stage)- result = subprocess.run(["bash", "-c", 'exec bash "$1" --stage "$PROBE_STAGE" --json',- "stage-test", SCRIPT.as_posix()],+ result = subprocess.run([real_bash, "-c", 'exec "$0" "$1" --stage "$PROBE_STAGE" --json',+ real_bash, SCRIPT.as_posix()],cwd=tmp_path, env=env, capture_output=True,text=True, encoding="utf-8", timeout=30)assert result.returncode != 0diff --git a/tests/scripts/test_mint_launchers.py b/tests/scripts/test_mint_launchers.pyindex cef0847f66e..b03e9f2e965 100644--- a/tests/scripts/test_mint_launchers.py+++ b/tests/scripts/test_mint_launchers.py@@ -42,7 +42,7 @@ def payload_tree(tmp_path: Path):py_dir = tmp_path / "stage" / "tools" / "py-1"repo = tmp_path / "stage" / "repo"site = tmp_path / "stage" / "venv" / "Lib" / "site-packages"- for d in (bin_dir, py_dir, repo / "hermes_cli", site):+ for d in (bin_dir, py_dir, repo / "hermes_cli", repo / "pm", site):d.mkdir(parents=True, exist_ok=True)# A real interpreter at the shebang's target: the launcher will creatediff --git a/tests/tools/test_browser_use_pm.py b/tests/tools/test_browser_use_pm.pyindex 9aa4540d562..2567dde89b4 100644--- a/tests/tools/test_browser_use_pm.py+++ b/tests/tools/test_browser_use_pm.py@@ -61,7 +61,8 @@ def main():result = json.loads(bu.browser_exec("print('payload')", session="research", task_id="owner"))assert result["success"], resultchild = json.loads(result["output"])- assert Path(child["argv"][0]) == binary+ # Windows console-script launchers report sys.argv[0] without the .exe suffix.+ assert Path(child["argv"][0]).with_suffix("") == binary.with_suffix("")assert child["stdin"] == "print('payload')"for key in ("PYTHONPATH", "PYTHONHOME", "OPENAI_API_KEY", "_HERMES_BU_PRIVATE_BROWSER"):assert key not in child["env"]diff --git a/tests/tools/test_windows_native_support.py b/tests/tools/test_windows_native_support.pyindex 8491f91572c..79049bc87c9 100644--- a/tests/tools/test_windows_native_support.py+++ b/tests/tools/test_windows_native_support.py@@ -1071,11 +1071,11 @@ class TestGatewayRunRestartWatcherOuterPopenFallback:# argv is identical across primary and fallback, and every current# watcher parameter survives:- # [watcher_python, "-c", <script>, str(pid), str(restart_after_s), *cmd_argv]+ # [python, "-I", "-c", <bootstrap + watcher script>, str(pid), str(restart_after_s), *cmd_argv]assert argv1 == argv2- assert argv1[1] == "-c"- assert argv1[3] == str(os.getpid())- assert float(argv1[4]) >= 5.0 # restart deadline preserved+ assert argv1[1:3] == ["-I", "-c"]+ assert argv1[4] == str(os.getpid())+ assert float(argv1[5]) >= 5.0 # restart deadline preservedassert argv1[-2:] == ["gateway", "restart"]# Scrubbed env preserved and identical on both calls.