Skip to content

The agent that grows with you

fix: round-6 CI backlog (32 python, docker arm64, win32-arm64, windows lane, desktop lint)

ethernet1d602a04e364
diff --git a/COMPAT_MANIFEST.md b/COMPAT_MANIFEST.md
index 79ef74f59d0..0aeb7853fb1 100644
--- a/COMPAT_MANIFEST.md
+++ b/COMPAT_MANIFEST.md
@@ -2960,7 +2960,6 @@ to the public equivalent or the new module. Test monkeypatch seams are likewise
| `shutil` | import | `shutil` |
| `signal` | import | `signal` |
| `timezone` | import | `datetime` |
-| `warm_agent_browser_npx_cache` | moved-lazy | `tools.browser_tool_install` |
| `windows_hide_flags` | moved-lazy | `hermes_cli._subprocess_compat` |
### `tools.clarify_gateway`
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index 241c95ad01c..bbeabb01af0 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -358,7 +358,6 @@ import { createPoolStopper } from './pool-stop'
import { poolTouchKeys } from './pool-touch-scope'
import { createPortalSession } from './portal-session'
import { createKeepAwake } from './power-save'
-import { readPreUpdateBackupEnabled } from './pre-update-backup-config'
import { capturePreviewContents } from './preview-capture'
import { PreviewReachRegistry } from './preview-reach'
import {
@@ -415,7 +414,6 @@ import {
resolveRemoteRequestHeaders
} from './remote-ws-headers'
import { missingRendererAssets } from './renderer-bundle'
-import { planLaunchSwitches, readDesktopLaunchConfig } from './renderer-heap-flags'
import { loadRendererLoadErrorPage } from './renderer-load-error-page'
import { attachRendererConsoleCapture, formatRendererBoundaryReport } from './renderer-log'
import { fetchRosterSourceData } from './roster-source-fetch'
diff --git a/compat_manifest.json b/compat_manifest.json
index 292ee175eea..101e161103f 100644
--- a/compat_manifest.json
+++ b/compat_manifest.json
@@ -9428,12 +9428,6 @@
"kind": "import",
"target": "datetime"
},
- {
- "facade": "tools.browser_tool",
- "name": "warm_agent_browser_npx_cache",
- "kind": "moved-lazy",
- "target": "tools.browser_tool_install"
- },
{
"facade": "tools.browser_tool",
"name": "windows_hide_flags",
@@ -12525,4 +12519,4 @@
"target": "(deleted)"
}
]
-}
\ No newline at end of file
+}
diff --git a/pm/environment.py b/pm/environment.py
index 12acb387339..9f93e5a5525 100644
--- a/pm/environment.py
+++ b/pm/environment.py
@@ -52,6 +52,26 @@ def classify_uv_failure(stage: str, returncode: int, output: str) -> InstallErro
return InstallError("venv", cause)
+def _project_name(source: Path) -> str:
+ """``[project].name`` of *source*'s pyproject, on any Python that can run the bootstrap.
+
+ tomllib is 3.11+; the bootstrap runner stages PM's runtime from a system python that may
+ be older, so the one field this module reads is parsed with the stdlib parser when it
+ exists and a table-scoped regex otherwise.
+ """
+ text = (source / "pyproject.toml").read_text(encoding="utf-8-sig")
+ try:
+ import tomllib
+ except ModuleNotFoundError:
+ import re
+ table = re.search(r"(?ms)^\[project\]\s*$(.*?)(?=^\[)", text + "\n[")
+ match = table and re.search(r'(?m)^name\s*=\s*"([^"]+)"', table.group(1))
+ if not match:
+ raise InstallError("venv", f"{source / 'pyproject.toml'} has no [project].name")
+ return match.group(1)
+ return tomllib.loads(text)["project"]["name"]
+
+
def prune_site_pth(venv_dir: Path) -> None:
"""Drop .pth files that must never execute inside a shipped payload.
@@ -273,10 +293,7 @@ class PythonEnvironment:
# --all-packages has no single selected project in uv, so
# --no-install-project alone does not exclude the root. Name it
# explicitly without dropping member dependencies or installations.
- import tomllib
-
- project = tomllib.loads((source / "pyproject.toml").read_text(encoding="utf-8-sig"))
- command += ["--no-install-project", "--no-install-package", project["project"]["name"]]
+ command += ["--no-install-project", "--no-install-package", _project_name(source)]
for extra in sorted(set(extras)):
command += ["--extra", extra]
for group in sorted(set(groups)):
diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh
index 88c58ba8c0c..a98840f384b 100755
--- a/scripts/run_tests.sh
+++ b/scripts/run_tests.sh
@@ -139,6 +139,16 @@ for _tool_var in INCLUDE LIB LIBPATH VSINSTALLDIR VCINSTALLDIR VCToolsInstallDir
WIN_ENV+=("$_tool_var=${!_tool_var}")
fi
done
+# With DISTUTILS_USE_SDK set, setuptools takes `link.exe` from PATH. Under a bash-hosted step
+# the runner puts Git for Windows' /usr/bin (coreutils `link`) first, so lead PATH with the
+# MSVC linker's directory the toolchain setup pinned.
+if [ -n "${CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_LINKER:-}" ] && command -v cygpath >/dev/null 2>&1; then
+ _linker_dir="$(dirname "$(cygpath -u "$CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_LINKER")")"
+ case ":$PATH:" in
+ "$_linker_dir:"*) ;;
+ *) PATH="$_linker_dir:$PATH" ;;
+ esac
+fi
# ── Test-runner knobs (computed before we drop env) ────────────────────────
# The runner's own documented environment knobs must survive the hermetic
diff --git a/scripts/windows-build-deps.ps1 b/scripts/windows-build-deps.ps1
index 258a47e8dcb..c2fcfb17f11 100644
--- a/scripts/windows-build-deps.ps1
+++ b/scripts/windows-build-deps.ps1
@@ -124,6 +124,10 @@ function Initialize-HermesArm64BuildTools {
# (`env -i`) carry INCLUDE/LIB but not the discovery variables vswhere needs.
$env:DISTUTILS_USE_SDK = '1'
$env:MSSdk = '1'
+ # In that mode setuptools takes `link.exe` from PATH. A bash-hosted step (Git for Windows)
+ # puts coreutils' link.exe ahead of MSVC's, so the compiler directory must lead PATH.
+ $linkerDir = Split-Path -Parent $linker
+ if (($env:PATH -split ';')[0] -ne $linkerDir) { $env:PATH = "$linkerDir;$env:PATH" }
# Child builds isolate HOME/USERPROFILE. Keep Rust anchored to the homes
# used here, including caller-selected locations.
diff --git a/tests/hermes_cli/test_old_updater_takeover.py b/tests/hermes_cli/test_old_updater_takeover.py
index aae2df35711..bf537090fad 100644
--- a/tests/hermes_cli/test_old_updater_takeover.py
+++ b/tests/hermes_cli/test_old_updater_takeover.py
@@ -53,6 +53,12 @@ def test_historical_payload_maps_to_takeover_request_schema(tmp_path, desktop, r
# The retired updater reaches the takeover through the NEW tree's hand-off module; this
# checkout is the whole tree the child sees (CI has no editable finder for the source).
shutil.copy2(source / "hermes_cli/update_handoff.py", package / "update_handoff.py")
+ # write_handoff resolves the home through hermes_constants; the child tree is the whole
+ # sys.path (CI has no editable finder), so give it the one name the hand-off reads.
+ (root / "hermes_constants.py").write_text(
+ "import os\nfrom pathlib import Path\n"
+ "def get_hermes_home():\n return Path(os.environ['HERMES_HOME'])\n", encoding="utf-8",
+ )
program = root / "historical.py"
program.write_text(
"import os\n"
diff --git a/tests/hermes_cli/test_plugin_manifest_v2.py b/tests/hermes_cli/test_plugin_manifest_v2.py
index 98ff7bc4fb2..84e07cb5d3d 100644
--- a/tests/hermes_cli/test_plugin_manifest_v2.py
+++ b/tests/hermes_cli/test_plugin_manifest_v2.py
@@ -375,7 +375,7 @@ class TestPythonDependenciesSeam:
hermes_home / "plugins", "pipok",
manifest_extra={
"manifest_version": 2,
- "python_dependencies": ["pyyaml>=5,<7"],
+ "python_dependencies": ["rich>=13,<15"],
},
)
_enable(hermes_home, ["pipok"])
diff --git a/tests/hermes_cli/test_post_update_expose_cli.py b/tests/hermes_cli/test_post_update_expose_cli.py
index b357c41749a..167e001af53 100644
--- a/tests/hermes_cli/test_post_update_expose_cli.py
+++ b/tests/hermes_cli/test_post_update_expose_cli.py
@@ -61,11 +61,15 @@ def fake_install(tmp_path, monkeypatch):
@pytest.mark.platforms("windows")
@pytest.mark.parametrize("create", [True, False])
-def test_windows_is_installer_owned(create):
- assert _launchers.expose_cli(create=create) == {
- "ok": True,
- "skipped": "windows-installer-owned",
- }
+def test_windows_converges_on_the_installer_user_bin(create, monkeypatch, tmp_path):
+ """Windows converges on the installer's convention ($HERMES_HOME\\bin + User PATH); an update
+ no longer skips as "installer-owned" and leaves a venv\\Scripts machine behind."""
+ calls = []
+ monkeypatch.setattr(_launchers, "_expose_windows_user_bin",
+ lambda root, *, create: calls.append(create) or {"ok": True, "written": []})
+ monkeypatch.setenv("HERMES_INSTALL_ROOT", str(tmp_path))
+ assert _launchers.expose_cli(create=create) == {"ok": True, "written": []}
+ assert calls == [create]
def test_registered_as_a_home_step():
diff --git a/tests/hermes_cli/test_set_config_value.py b/tests/hermes_cli/test_set_config_value.py
index 9ed179200af..67e29ce4f88 100644
--- a/tests/hermes_cli/test_set_config_value.py
+++ b/tests/hermes_cli/test_set_config_value.py
@@ -1059,7 +1059,7 @@ class TestContainerTypeRefusal:
echoed it back."""
def _write_config(self, tmp_path, data: dict):
- import yaml as _yaml
+ import hermes_yaml as _yaml
(tmp_path / "config.yaml").write_text(_yaml.safe_dump(data, sort_keys=False), encoding="utf-8")
def test_string_where_schema_wants_list_is_refused(self, _isolated_hermes_home, capsys):
@@ -1086,7 +1086,7 @@ class TestContainerTypeRefusal:
# --force keeps its documented meaning: replace a whole mapping section.
set_config_value("model.aliases", "replaced", force=True)
- import yaml as _yaml
+ import hermes_yaml as _yaml
saved = _yaml.safe_load(_read_config(_isolated_hermes_home))
assert saved["custom_providers"] == [{"name": "ok", "base_url": "http://h/v1"}]
assert saved["model"] == {"default": "bar", "aliases": "replaced"}
@@ -1100,7 +1100,7 @@ class TestContainerTypeRefusal:
with pytest.raises(SystemExit):
set_config_value(key, "notacontainer")
- import yaml as _yaml
+ import hermes_yaml as _yaml
saved = _yaml.safe_load(_read_config(_isolated_hermes_home))
assert saved == {"model": {"default": "m"}}
@@ -1110,7 +1110,7 @@ class TestContainerTypeRefusal:
set_config_value("agent.disabled_toolsets", "web")
- import yaml as _yaml
+ import hermes_yaml as _yaml
saved = _yaml.safe_load(_read_config(_isolated_hermes_home))
assert saved["agent"]["disabled_toolsets"] == ["web"]
diff --git a/tests/hermes_cli/test_setup_pin_values.py b/tests/hermes_cli/test_setup_pin_values.py
index 27abd064db2..fc3db077660 100644
--- a/tests/hermes_cli/test_setup_pin_values.py
+++ b/tests/hermes_cli/test_setup_pin_values.py
@@ -4,6 +4,7 @@ import os
from pathlib import Path
import shutil
import subprocess
+import sys
import pytest
@@ -13,6 +14,18 @@ from pm.store import current_target
ROOT = 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):
@@ -47,7 +60,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([_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.stderr
if missing_target:
diff --git a/tests/hermes_cli/test_update_import_guard.py b/tests/hermes_cli/test_update_import_guard.py
index b69756062b0..643253c003b 100644
--- a/tests/hermes_cli/test_update_import_guard.py
+++ b/tests/hermes_cli/test_update_import_guard.py
@@ -234,13 +234,15 @@ def test_untracked_enumeration_failure_is_visible(monkeypatch, probe_root, capsy
@pytest.mark.platforms("posix")
-def test_import_guard_is_non_fatal_when_probe_cannot_run(probe_root):
+def test_import_guard_is_non_fatal_when_probe_cannot_run(monkeypatch, probe_root):
"""A venv interpreter that exists but cannot be executed must not read as a hung probe:
spawn failure stays advisory (real ``bounded_probe_run``, real ``Popen``)."""
venv_python = probe_root / "venv" / "bin" / "python"
venv_python.parent.mkdir(parents=True)
venv_python.write_text("#!/bin/sh\nexit 0\n")
venv_python.chmod(0o644) # present, not executable -> Popen raises PermissionError
+ (probe_root / "consumer.py").write_text("VALUE = 1\n")
+ monkeypatch.setattr(update_cmd, "_UPDATE_CRITICAL_MODULES", ("consumer",))
assert update_cmd._validate_critical_modules_import(probe_root) == (True, None, None)
@@ -288,7 +290,7 @@ def test_import_guard_ignores_missing_third_party_dependency(monkeypatch, probe_
def test_import_guard_rejects_module_satisfied_only_by_inherited_pythonpath(
- monkeypatch, tmp_path
+ monkeypatch, probe_root
):
"""A stale checkout on PYTHONPATH must not stand in for a candidate module.
@@ -297,7 +299,7 @@ def test_import_guard_rejects_module_satisfied_only_by_inherited_pythonpath(
fine from there and a candidate lacking it entirely read as healthy
(#115032).
"""
- stale = tmp_path / "stale"
+ stale = probe_root / "stale"
stale.mkdir()
(stale / "hermes_stale_supply.py").write_text("VALUE = 'from the stale tree'\n")
@@ -306,27 +308,27 @@ def test_import_guard_rejects_module_satisfied_only_by_inherited_pythonpath(
)
monkeypatch.setenv("PYTHONPATH", str(stale))
- ok, module, error = update_cmd._validate_critical_modules_import(tmp_path)
+ ok, module, error = update_cmd._validate_critical_modules_import(probe_root)
assert ok is False
assert module == "hermes_stale_supply"
assert error is not None and "hermes_stale_supply" in error
-def test_import_guard_accepts_candidate_with_foreign_pythonpath(monkeypatch, tmp_path):
+def test_import_guard_accepts_candidate_with_foreign_pythonpath(monkeypatch, probe_root):
"""The env scrub must not overreach: a candidate that carries the module
still passes while a foreign PYTHONPATH is set (#115032)."""
- stale = tmp_path / "stale"
+ stale = probe_root / "stale"
stale.mkdir()
(stale / "hermes_stale_supply.py").write_text("VALUE = 'stale'\n")
- (tmp_path / "hermes_stale_supply.py").write_text("VALUE = 'candidate'\n")
+ (probe_root / "hermes_stale_supply.py").write_text("VALUE = 'candidate'\n")
monkeypatch.setattr(
update_cmd, "_UPDATE_CRITICAL_MODULES", ("hermes_stale_supply",)
)
monkeypatch.setenv("PYTHONPATH", str(stale))
- assert update_cmd._validate_critical_modules_import(tmp_path) == (True, None, None)
+ assert update_cmd._validate_critical_modules_import(probe_root) == (True, None, None)
def test_import_guard_flags_missing_first_party_module(monkeypatch, probe_root):
diff --git a/tests/install/e2e-assets/source-build-env.ps1 b/tests/install/e2e-assets/source-build-env.ps1
index 394110c0ef2..e44a7e4f0f2 100644
--- a/tests/install/e2e-assets/source-build-env.ps1
+++ b/tests/install/e2e-assets/source-build-env.ps1
@@ -3,15 +3,17 @@ function Invoke-SourceBuild([scriptblock]$Action) {
$saved = @{}
$names = @('GITHUB_SHA', 'GITHUB_REF', 'GITHUB_REF_NAME', 'GITHUB_HEAD_REF', 'GITHUB_BASE_REF',
'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.
try {
foreach ($name in $names) {
- $saved[$name] = [Environment]::GetEnvironmentVariable($name, 'Process')
- [Environment]::SetEnvironmentVariable($name, $null, 'Process')
+ $saved[$name] = Get-Content -LiteralPath "env:$name" -ErrorAction SilentlyContinue
+ Remove-Item -LiteralPath "env:$name" -ErrorAction SilentlyContinue
}
& $Action
} finally {
foreach ($name in $names) {
- [Environment]::SetEnvironmentVariable($name, $saved[$name], 'Process')
+ if ($null -ne $saved[$name]) { Set-Item -LiteralPath "env:$name" -Value $saved[$name] }
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/scripts/desktop_update/test_desktop_update_gateway_flag.py b/tests/scripts/desktop_update/test_desktop_update_gateway_flag.py
index 1b3879c776b..7a9cdcf079c 100644
--- a/tests/scripts/desktop_update/test_desktop_update_gateway_flag.py
+++ b/tests/scripts/desktop_update/test_desktop_update_gateway_flag.py
@@ -48,7 +48,8 @@ def _run_handoff(tmp_path: Path, extra_args: list[str]) -> list[str]:
hermes.chmod(0o755)
argv_log = tmp_path / "argv.jsonl"
- env = {**os.environ, "TMPDIR": str(tmp_path), "HERMES_TEST_ARGV": str(argv_log)}
+ # posix.sh honours an ambient HERMES_HOME; the result file must land where this test looks.
+ env = {**os.environ, "TMPDIR": str(tmp_path), "HERMES_TEST_ARGV": str(argv_log), "HERMES_HOME": str(tmp_path)}
subprocess.run(
["/bin/bash", str(SHIM_DIR / "posix.sh"), "--install-root", str(install_root), "--no-ui", *extra_args],
env=env,
diff --git a/tests/tools/test_browser_pm.py b/tests/tools/test_browser_pm.py
index f18eac0c059..4b279f25b6c 100644
--- a/tests/tools/test_browser_pm.py
+++ b/tests/tools/test_browser_pm.py
@@ -178,7 +178,9 @@ def test_historical_warmer_is_inert(monkeypatch):
monkeypatch.setattr("subprocess.Popen", forbidden)
monkeypatch.setattr(pm, "ensure", forbidden)
- assert install.warm_agent_browser_npx_cache(timeout=0.1) is False
+ from tools import browser_tool
+
+ assert browser_tool.warm_agent_browser_npx_cache(timeout=0.1) is False
def test_external_chromium_override_survives_pm_composition(browser_store, monkeypatch, tmp_path):
diff --git a/tests/tools/test_local_env_blocklist.py b/tests/tools/test_local_env_blocklist.py
index e73cb644b9c..3bdfcf0579a 100644
--- a/tests/tools/test_local_env_blocklist.py
+++ b/tests/tools/test_local_env_blocklist.py
@@ -451,6 +451,7 @@ class TestNativeEnvironmentContracts:
assert env["PYTHONPATH"] == user_pp
+ @pytest.mark.platforms("windows")
def test_base_python_sanitizer_uses_validated_separate_runtime_venv(self, tmp_path, monkeypatch):
"""A base interpreter strips the exact Windows runtime site-packages.
@@ -884,6 +885,7 @@ class TestNativeEnvironmentContracts:
local_pythonpath._strip_hermes_owned_pythonpath(env)
assert env["PYTHONPATH"].split(os.pathsep) == ["/home/user/my-lib"]
+ @pytest.mark.platforms("windows")
def test_validated_runtime_venv_lexical_after_repo_recovery(self, tmp_path, monkeypatch):
"""uv-base gateway: once the lexical repo alias is recovered, a lexical
VIRTUAL_ENV (<lexical repo>/venv) validates and its site-packages is
diff --git a/tools/browser_tool.py b/tools/browser_tool.py
index 6fa9a516554..6fa075787ac 100644
--- a/tools/browser_tool.py
+++ b/tools/browser_tool.py
@@ -1376,7 +1376,6 @@ _PLUGIN_COMPAT_LAZY = {
'normalize_browser_cloud_provider': ('tools.tool_backend_helpers', 'normalize_browser_cloud_provider'),
'reset_hermes_home_override': ('hermes_constants', 'reset_hermes_home_override'),
'set_hermes_home_override': ('hermes_constants', 'set_hermes_home_override'),
- 'warm_agent_browser_npx_cache': ('tools.browser_tool_install', 'warm_agent_browser_npx_cache'),
'windows_hide_flags': ('hermes_cli._subprocess_compat', 'windows_hide_flags'),
}
diff --git a/tools/browser_tool_install.py b/tools/browser_tool_install.py
index 353aa12f55e..dc1a4d20c8e 100644
--- a/tools/browser_tool_install.py
+++ b/tools/browser_tool_install.py
@@ -92,7 +92,8 @@ def _find_agent_browser(*, validate: bool = True) -> str:
def warm_agent_browser_npx_cache(timeout: float = 60.0) -> bool:
- """Historical updater export: no npx work is performed; relaunch instead."""
+ """Frozen old-updater surface names this module too (the extraction-era home); tools.browser_tool
+ carries the permanent definition. No npx work is performed; relaunch instead."""
return False