The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(ci): repair native test selection and bootstrap closure
ethernet34d68598ee71
diff --git a/.github/workflows/tests-os.yml b/.github/workflows/tests-os.ymlindex d918660e712..b80b0ac3e25 100644--- a/.github/workflows/tests-os.yml+++ b/.github/workflows/tests-os.yml@@ -156,13 +156,13 @@ jobs:# ``tr -d '\r'``: on Windows the helper's redirected stdout gains# CRLF line endings; a stray \r would corrupt the path. The list- # is ';'-joined for the runner's --files flag (its separator on- # every host — explicit file lists bypass discovery).+ # uses the native path-list separator consumed by --files.## Any non-zero exit propagates red: real test failures, or the# runner's own zero-run guard (every file filtered to empty by# ``-m`` — "must never pass without running its OS's tests").- FILES="$(tr -d '\r' < "$LIST" | paste -sd ';' -)"+ SEPARATOR="$(uv run --no-sync python -c 'import os, sys; sys.stdout.write(os.pathsep)')"+ FILES="$(tr -d '\r' < "$LIST" | paste -sd "$SEPARATOR" -)"scripts/run_tests.sh --files "$FILES" -- \${EXTRA_ARGS[@]+"${EXTRA_ARGS[@]}"} \-m "platforms and not integration" \diff --git a/Dockerfile b/Dockerfileindex 4db08f3b392..39efc3a8412 100644--- a/Dockerfile+++ b/Dockerfile@@ -204,6 +204,8 @@ COPY pm/ pm/# `python3 -m pm.cli install` fails with "No module named# 'hermes_constants'" without it on the path. Copy the module next to pm.COPY hermes_constants.py hermes_constants.py+# PM imports the shared stdlib runtime path and locking owners before deps exist.+COPY hermes_cli/__init__.py hermes_cli/runtime_paths.py hermes_cli/runtime_state.py hermes_cli/RUN set -eu; \python3 -m pm.cli install uv chromium chromium-headless-shell; \ln -sf /opt/hermes/tools/uv-*/uv /usr/local/bin/uv; \diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex c3dcc9d1653..5f6edee798c 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -1702,10 +1702,7 @@ export const ar = defineLocale({skills: 'المهارات',messaging: 'المراسلة',artifacts: 'العناصر',- chat: 'المحادثة',- settings: 'الإعدادات',cron: 'المهام المجدولة',- agents: 'الوكلاء','session-import': 'استيراد جلسة'},searchAria: 'البحث في الجلسات',diff --git a/tests/gateway/test_config.py b/tests/gateway/test_config.pyindex 480e26d48c9..ea4aa5aa740 100644--- a/tests/gateway/test_config.py+++ b/tests/gateway/test_config.py@@ -1266,7 +1266,7 @@ class TestHomeChannelEnvOverrides:for platform, platform_config, env, expected in cases:config = GatewayConfig(platforms={platform: platform_config})- with patch.dict(os.environ, env, clear=True):+ with patch.dict(os.environ, {**env, "HERMES_HOME": os.environ["HERMES_HOME"]}, clear=True):_apply_env_overrides(config)home = config.platforms[platform].home_channel@@ -1402,7 +1402,7 @@ class TestApiServerEnvOverride:)api_server_key = "secret-key-at-least-16"- with patch.dict(os.environ, {"API_SERVER_KEY": api_server_key}, clear=True):+ with patch.dict(os.environ, {"API_SERVER_KEY": api_server_key, "HERMES_HOME": os.environ["HERMES_HOME"]}, clear=True):_apply_env_overrides(config)# Explicit disable wins over the env-var presence.@@ -1444,6 +1444,7 @@ class TestWebhookEnvOverride:with patch.dict(os.environ,{+ "HERMES_HOME": os.environ["HERMES_HOME"],"WEBHOOK_ENABLED": "true","WEBHOOK_PORT": "9999","WEBHOOK_SECRET": "shared-secret",diff --git a/tests/hermes_cli/test_backup.py b/tests/hermes_cli/test_backup.pyindex da621a8f1b2..49dc7ecffff 100644--- a/tests/hermes_cli/test_backup.py+++ b/tests/hermes_cli/test_backup.py@@ -970,7 +970,7 @@ class TestImportAtomicWrites:assert target.read_text() == "model: restored\n"assert (target.stat().st_mode & 0o777) == 0o644- @pytest.mark.skipif(os.name != "posix", reason="POSIX ownership")+ @pytest.mark.platforms("posix")def test_restore_preserves_existing_file_owner(self, tmp_path, monkeypatch):"""A root-run import must not re-own the user's files to root.@@ -991,7 +991,7 @@ class TestImportAtomicWrites:chown_calls: list[tuple[Path, int, int]] = []monkeypatch.setattr(- "hermes_cli.backup._preserve_file_owner",+ "hermes_cli.backup_restore._preserve_file_owner",lambda p: (123, 456) if Path(p).exists() else None,)monkeypatch.setattr(@@ -1007,28 +1007,21 @@ class TestImportAtomicWrites:# state.db is newly created, so there is no prior owner to restore.assert chown_calls == [(target, 123, 456)]- @pytest.mark.skipif(not hasattr(os, "fchmod"), reason="needs fchmod present to remove it")- def test_mode_is_applied_before_the_replace_without_fchmod(self, tmp_path, monkeypatch):- """Covers the Windows branch: no ``fchmod``, so ``chmod`` the temp path.-- Applying the mode only *after* ``atomic_replace`` leaves the published- file at mkstemp's 0600 until that chmod lands (and permanently if the- process dies in between), and ``atomic_replace``'s EXDEV/EBUSY- ``shutil.copystat`` fallback would copy 0600 onto the target. Mirrors- the transit-window fix ``atomic_yaml_write`` already carries.- """+ def test_mode_is_applied_before_the_replace(self, tmp_path, monkeypatch):+ """Publish the correct native permission bits with no permissive window."""hermes_home = tmp_path / ".hermes"hermes_home.mkdir()target = hermes_home / "config.yaml"target.write_text("model: original\n")os.chmod(target, 0o644)+ expected_mode = target.stat().st_mode & 0o777monkeypatch.setenv("HERMES_HOME", str(hermes_home))monkeypatch.setattr(Path, "home", lambda: tmp_path)zip_path = tmp_path / "backup.zip"self._zip(zip_path, {"config.yaml": "model: restored\n", "state.db": ""})- import hermes_cli.backup as backup_mod+ import hermes_cli.backup_restore as backup_modreal_replace = backup_mod.atomic_replacestaged_modes: list[int] = []@@ -1038,17 +1031,15 @@ class TestImportAtomicWrites:staged_modes.append(os.stat(tmp).st_mode & 0o777)return real_replace(tmp, dst)- monkeypatch.delattr(os, "fchmod")monkeypatch.setattr(backup_mod, "atomic_replace", spying_replace)from hermes_cli.backup import run_importrun_import(Namespace(zipfile=str(zip_path), force=True))- # Without the pre-replace chmod this reads 0o600 (mkstemp's mode).- assert staged_modes == [0o644]- assert (target.stat().st_mode & 0o777) == 0o644+ assert staged_modes == [expected_mode]+ assert (target.stat().st_mode & 0o777) == expected_mode- @pytest.mark.skipif(os.name != "posix", reason="POSIX setuid/setgid bits")+ @pytest.mark.platforms("posix")def test_restore_does_not_carry_setuid_onto_archive_content(self, tmp_path, monkeypatch):@@ -1083,7 +1074,7 @@ class TestImportAtomicWrites:{"helper.sh": "#!/bin/sh\necho attacker\n", "state.db": ""},)- import hermes_cli.backup as backup_mod+ import hermes_cli.backup_restore as backup_modreal_replace = backup_mod.atomic_replacestaged_modes: list[int] = []diff --git a/tests/hermes_cli/test_update_stale_module_purge.py b/tests/hermes_cli/test_update_stale_module_purge.pyindex 8084c0db08e..d7222802355 100644--- a/tests/hermes_cli/test_update_stale_module_purge.py+++ b/tests/hermes_cli/test_update_stale_module_purge.py@@ -90,7 +90,7 @@ def test_purge_preserves_active_update_receipt(tmp_path, monkeypatch):receipt_dir = tmp_path / "update_receipts"monkeypatch.setattr(receipt, "_receipt_dir", lambda: receipt_dir)- receipt._current = None+ token = receipt._current.set(None)post_purge_receipt = receipttry:receipt.begin_update_receipt()@@ -105,8 +105,7 @@ def test_purge_preserves_active_update_receipt(tmp_path, monkeypatch):assert latest["outcome"] == "success"assert latest["steps"][0]["name"] == "git_pull"finally:- receipt._current = None- post_purge_receipt._current = None+ receipt._current.reset(token)def test_purge_leaves_prefix_lookalikes_alone():diff --git a/tests/pm/test_bootstrap_import_closure.py b/tests/pm/test_bootstrap_import_closure.pynew file mode 100644index 00000000000..7cf8636b2ac--- /dev/null+++ b/tests/pm/test_bootstrap_import_closure.py@@ -0,0 +1,36 @@+"""The tool-only build stage imports PM without third-party dependencies."""++import os+from pathlib import Path+import shutil+import subprocess+import sys+++def test_minimal_bootstrap_closure_reaches_pm_paths_and_locks(tmp_path):+ repo = Path(__file__).resolve().parents[2]+ stage = tmp_path / "stage"+ shutil.copytree(repo / "pm", stage / "pm", ignore=shutil.ignore_patterns("__pycache__"))+ shutil.copy2(repo / "hermes_constants.py", stage / "hermes_constants.py")+ (stage / "hermes_cli").mkdir()+ for name in ("__init__.py", "runtime_paths.py", "runtime_state.py"):+ shutil.copy2(repo / "hermes_cli" / name, stage / "hermes_cli" / name)+ store = stage / "tools"+ env = dict(os.environ, HERMES_HOME=str(tmp_path / "home"),+ HERMES_RUNTIME_DIR=str(store), PYTHONPATH=str(stage))+ script = """+from pathlib import Path+import pm.paths+from pm.store import Store+from pm.lock import Facts+root = pm.paths.store_root()+with Store(root).install_lock():+ facts = Facts(root / 'facts.json')+ facts.record_state('probe', 'checked', [])+assert facts.path.is_file()+print(root)+"""+ result = subprocess.run([sys.executable, "-S", "-c", script], cwd=stage, env=env,+ capture_output=True, text=True, timeout=15)+ assert result.returncode == 0, result.stdout + result.stderr+ assert Path(result.stdout.strip()) == store