The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: restore platforms() host gating that merges reverted to the legacy trio
ethernet071ccfbcdfa5
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.ymlindex 4abbbe00726..033ffc05e6f 100644--- a/.github/workflows/lint.yml+++ b/.github/workflows/lint.yml@@ -175,7 +175,7 @@ jobs:run: python scripts/check_compat_pointers.py# The OS lanes import only files carrying the matching marker, so a test that fakes- # macOS (is_macos -> True, sys.platform -> "darwin") without `macos_only` is green on+ # macOS (is_macos -> True, sys.platform -> "darwin") without `platforms("macos")` is green on# Linux over a faked branch and never runs on macOS (#111866, AGENTS.md § Don't fake the host OS).- name: Forbid unmarked macOS fakes in testsrun: python scripts/ci/check_os_marker_fakes.pydiff --git a/scripts/ci/check_os_marker_fakes.py b/scripts/ci/check_os_marker_fakes.pyindex 18f90690b62..3b1d5988532 100644--- a/scripts/ci/check_os_marker_fakes.py+++ b/scripts/ci/check_os_marker_fakes.py@@ -1,16 +1,16 @@#!/usr/bin/env python3-"""Fail when a test file fakes macOS without carrying ``@pytest.mark.macos_only``.+"""Fail when a test file fakes macOS without carrying ``@pytest.mark.platforms("macos")``.The OS lanes are marker-driven: ``.github/workflows/tests-os.yml`` selects the-files the macOS job imports via ``scripts/ci/list_os_marked_tests.py macos_only``-and then runs ``-m macos_only``. A file whose tests only pass because they make+files the macOS job imports via ``scripts/ci/list_os_marked_tests.py platforms("macos")``+and then runs ``-m platforms("macos")``. A file whose tests only pass because they makethe interpreter believe it is on macOS (``is_macos`` patched to ``True``,``sys.platform`` set to ``"darwin"``) but that carries no marker is invisible tothat lane: it is green on Linux over a faked branch and never imported on thehost it exists for (#111866). Root ``AGENTS.md`` § "Don't fake the host OS" isthe rule; this check makes a violation a red job instead of a review catch.-Flags, per ``tests/**/test_*.py`` without a whole-word ``macos_only``:+Flags, per ``tests/**/test_*.py`` without a whole-word ``platforms("macos")``:monkeypatch.setattr(mod, "is_macos", lambda: True) / patch(..., return_value=True)monkeypatch.setattr(sys, "platform", "darwin") / patch("sys.platform", "darwin")@@ -32,7 +32,7 @@ import reimport sysfrom pathlib import Path-MARKER = "macos_only"+MARKER = 'platforms("macos")'OPT_OUT = "os-marker: ok"_TRUE = r"(?:lambda[^:]*:\s*True|return_value\s*=\s*True|,\s*True\b)"@@ -49,18 +49,13 @@ _FAKES = (# Files that faked macOS before this check existed (#111866). Burn down, never extend._BASELINE = frozenset({- "tests/hermes_cli/test_doctor.py","tests/hermes_cli/test_gateway.py","tests/hermes_cli/test_gateway_proc_fallback.py","tests/hermes_cli/test_linux_sandbox_fixup.py","tests/hermes_cli/test_macos_fda_guidance.py","tests/hermes_cli/test_orphan_desktop_serve_reap.py","tests/hermes_cli/test_update_launchd_restart_verification.py",- "tests/hermes_cli/test_update_launchd_unloaded_gateway.py",- "tests/hermes_cli/test_urllib_security.py","tests/hermes_state/test_state_synchronous_pragma.py",- "tests/test_hermes_constants.py",- "tests/tools/test_macos_protected_search.py","tests/tools/test_skills_tool.py",})@@ -81,7 +76,7 @@ def _code_lines(text: str) -> list[tuple[int, str, str]]:def find_unmarked_fakes(root: Path, repo_root: Path) -> dict[str, list[tuple[int, str]]]:"""Map repo-relative test path -> ``[(lineno, line)]`` of un-opted-out macOS fakes."""- marker_pat = re.compile(rf"\b{MARKER}\b")+ marker_pat = re.compile(r'platforms\(\s*[^)]*?"[^")]*\bmacos\b[^")]*"')hits: dict[str, list[tuple[int, str]]] = {}for dirpath, _dirnames, filenames in os.walk(root):for fname in filenames:diff --git a/scripts/ci/list_os_marked_tests.py b/scripts/ci/list_os_marked_tests.pyindex f3eedf87fea..5d41bf1c77c 100644--- a/scripts/ci/list_os_marked_tests.py+++ b/scripts/ci/list_os_marked_tests.py@@ -1,27 +1,34 @@#!/usr/bin/env python3-"""List the test files that carry a given OS marker.+"""List the test files that carry a platforms() gate for a given platform.-Used by ``.github/workflows/tests-os.yml`` to scope what the macOS and-Windows lanes import.+Used by the marked-OS lane of ``.github/workflows/tests.yml`` to scope what+the macOS lane imports.-Why scope at all, when ``pytest -m macos_only`` already selects correctly?+Why scope at all, when ``pytest -m platforms`` already selects correctly?Because ``-m`` filters AFTER collection, and collection IMPORTS every testmodule under ``tests/``. On the Linux lane that is fine (it runs them all-anyway), but on the macOS/Windows lanes it would drag ~900 unrelated modules-through import on a host they were never expected to import on — one-unrelated ImportError would fail a job whose actual subject passed. Narrowing-the paths keeps each lane's failure signal about its own tests.--``-m`` is still passed by the workflow and remains the authoritative-selector: this script only decides which files get imported, never which-tests run. Over-selecting here is harmless (``-m`` drops the extras); the-failure mode to care about is UNDER-selecting, which is why the workflow-fails the job when zero tests end up selected.+anyway), but on the macOS lane it would drag ~900 unrelated modules through+import on a host they were never expected to import on — one unrelated+ImportError would fail a job whose actual subject passed. Narrowing the+paths keeps each lane's failure signal about its own tests.++``-m platforms`` (plus the conftest's per-test host skips) remains the+authoritative selector: this script only decides which files get imported,+never which tests run. Over-selecting here is harmless (the skips drop the+extras); the failure mode to care about is UNDER-selecting, which is why+the workflow fails the job when zero tests end up selected.++A file matches when a quoted ``platforms("...")`` spec names the platform —+including negated (``"not macos"``) and any-of lists. The match is anchored+inside the string literal so bare identifiers (a variable named ``windows``)+don't produce false positives.Usage:- python scripts/ci/list_os_marked_tests.py macos_only [tests_root]+ python scripts/ci/list_os_marked_tests.py macos [tests_root]-Prints one path per line (POSIX separators, repo-relative), sorted.+Prints one path per line (POSIX separators, repo-relative), sorted. Exits+non-zero when no file matches (a renamed spec or broken selection would+otherwise report a green lane that ran nothing)."""from __future__ import annotations@@ -31,18 +38,14 @@ import reimport sysfrom pathlib import Path-_VALID_MARKERS = ("linux_only", "macos_only", "windows_only")-+_VALID_PLATFORMS = ("linux", "macos", "windows")-def find_marked_files(marker: str, root: Path) -> list[Path]:- """Return every ``test_*.py`` under *root* that references *marker*.- Matches the marker as a whole word so ``macos_only`` doesn't pick up a- hypothetical ``macos_only_extra``. Catches both the decorator form- (``@pytest.mark.macos_only``, on a function or a class) and the- module-level ``pytestmark`` form.- """- pattern = re.compile(rf"\b{re.escape(marker)}\b")+def find_marked_files(platform: str, root: Path) -> list[Path]:+ """Return every ``test_*.py`` under *root* gating on *platform*."""+ pattern = re.compile(+ rf'platforms\(\s*[^)]*?"[^")]*\b{re.escape(platform)}\b[^")]*"'+ )hits: list[Path] = []# os.walk, not Path.rglob: rglob raises FileNotFoundError when a directory# (a sibling job's __pycache__) vanishes mid-scan; os.walk skips it.@@ -64,59 +67,29 @@ def main(argv: list[str]) -> int:if len(argv) < 2:print(__doc__, file=sys.stderr)return 2- marker = argv[1]- if marker not in _VALID_MARKERS:+ platform = argv[1]+ if platform not in _VALID_PLATFORMS:print(- f"error: unknown marker {marker!r} (expected one of "- f"{', '.join(_VALID_MARKERS)})",+ f"unknown platform {platform!r}; valid: {', '.join(_VALID_PLATFORMS)}",file=sys.stderr,)return 2-- repo_root = Path(__file__).resolve().parents[2]- root = Path(argv[2]) if len(argv) > 2 else repo_root / "tests"- if not root.exists():- print(f"error: no such directory: {root}", file=sys.stderr)+ tests_root = Path(argv[2]) if len(argv) > 2 else Path("tests")+ if not tests_root.is_dir():+ print(f"no such directory: {tests_root}", file=sys.stderr)return 2-- files = find_marked_files(marker, root)- if not files:+ hits = find_marked_files(platform, tests_root)+ for path in hits:+ print(path.as_posix())+ if not hits:print(- f"error: no test file references @pytest.mark.{marker} — the marker "- "was probably renamed or dropped. Refusing to emit an empty list, "- "which would let the OS lane pass without running anything.",+ f"no test files gate on {platform!r} under {tests_root} — "+ "either the spec vocabulary changed or selection is broken",file=sys.stderr,)return 1-- lines: list[str] = []- for path in files:- # POSIX separators so the output is safe to paste into a bash- # command line on the Windows runner (Git Bash accepts them).- #- # Relative to the repo root when the path is inside it (the CI case —- # pytest is invoked from the repo root). A root outside the repo is a- # test/manual invocation; emit it as-is rather than raising, since- # ``relative_to`` refuses non-descendant paths.- try:- rel = path.resolve().relative_to(repo_root)- except ValueError:- lines.append(path.as_posix())- else:- lines.append(rel.as_posix())-- # Write bytes with explicit LF rather than print(), which on Windows- # translates "\n" to "\r\n" in text mode. The consumer reads this list with- # ``$(cat ...)`` in bash, and word splitting uses IFS (space/tab/newline) —- # a CR is NOT a separator, so it stays glued to each path and pytest then- # fails with "file or directory not found: tests/...py" for a path that- # looks correct in the log because the CR is invisible. Emitting bytes makes- # the output identical on every host instead of depending on the platform's- # newline translation.- sys.stdout.buffer.write(b"".join(line.encode("utf-8") + b"\n" for line in lines))- sys.stdout.buffer.flush()return 0if __name__ == "__main__":- sys.exit(main(sys.argv))+ raise SystemExit(main(sys.argv))diff --git a/tests/agent/test_shell_hooks.py b/tests/agent/test_shell_hooks.pyindex 247038288ca..b9253650514 100644--- a/tests/agent/test_shell_hooks.py+++ b/tests/agent/test_shell_hooks.py@@ -748,7 +748,7 @@ class TestFailSemanticsEndToEnd:class TestRoutedProfileEnv:- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_hook_child_sees_routed_profile_home_and_no_default_secrets(self, tmp_path, monkeypatch):"""Under multiplexing the child gets the ROUTED HERMES_HOME, the default profile's secretsstay out of its env, and the payload names the firing profile."""diff --git a/tests/ci/test_check_os_marker_fakes.py b/tests/ci/test_check_os_marker_fakes.pyindex 11333073235..f24313ea311 100644--- a/tests/ci/test_check_os_marker_fakes.py+++ b/tests/ci/test_check_os_marker_fakes.py@@ -18,7 +18,7 @@ def test_unmarked_fake_is_flagged_marked_and_opted_out_are_not(tmp_path):_write(tmp_path, "test_fake.py", "def test_x(monkeypatch):\n"" monkeypatch.setattr(gw, 'is_macos', lambda: True)\n"" monkeypatch.setattr(sys, 'platform', 'darwin')\n")- _write(tmp_path, "test_marked.py", "import pytest\npytestmark = pytest.mark.macos_only\n"+ _write(tmp_path, "test_marked.py", "import pytest\npytestmark = pytest.mark.platforms(\"macos\")\n""def test_x(monkeypatch):\n monkeypatch.setattr(gw, 'is_macos', lambda: True)\n")_write(tmp_path, "test_opted.py", "def test_x(monkeypatch):\n"" patch('m.is_macos', return_value=True) # os-marker: ok — pure data mapping\n")diff --git a/tests/ci/test_list_os_marked_tests.py b/tests/ci/test_list_os_marked_tests.pyindex 08270694088..724fbb2ea36 100644--- a/tests/ci/test_list_os_marked_tests.py+++ b/tests/ci/test_list_os_marked_tests.py@@ -35,30 +35,66 @@ def _write(root: Path, relpath: str, body: str) -> Path:return path[email protected]("platform,expected", [- ("linux", {"linux", "posix", "any", "not_macos", "not_linux", "unknown", "dynamic", "empty"}),- ("macos", {"module", "single", "posix", "any", "not_macos", "not_linux", "unknown", "dynamic", "empty"}),- ("windows", {"arch", "multiline", "any", "not_macos", "not_linux", "unknown", "dynamic", "empty"}),-])-def test_selector_corpus(tmp_path, platform, expected):- # Selection deliberately overselects negated/unknown inputs; the runtime- # marker, not this file selector, decides whether each test runs.- calls = {- "linux": '"linux"', "single": "'macos'", "posix": '"posix"',- "any": '"any"', "not_macos": '"not macos"', "not_linux": '"not linux"',- "arch": '"windows", arch="arm64"',- "multiline": '\n"windows",\narch="arm64",\n',- "unknown": '"amiga"', "dynamic": 'PLATFORM', "empty": '',- }- for name, arguments in calls.items():- _write(tmp_path, f"test_{name}.py",- f"@pytest.mark.platforms({arguments})\ndef test_x(): pass\n")- _write(tmp_path, "nested/test_module.py", 'pytestmark = pytest.mark.platforms("macos")\n')- _write(tmp_path, "test_plain.py", "def test_x(): pass\n")- _write(tmp_path, "test_identifier.py", '@pytest.mark.parametrize("kind", ["linux", "macos", "windows"])\ndef test_x(): pass\n')[email protected]("platform", ["linux", "macos", "windows"])+def test_finds_decorator_and_pytestmark_forms(tmp_path, platform):+ """Both the decorator form and module-level ``pytestmark`` are detected."""+ _write(+ tmp_path,+ "test_decorated.py",+ f'import pytest\n\n\[email protected]("{platform}")\ndef test_x():\n pass\n',+ )+ _write(+ tmp_path,+ "nested/test_module_level.py",+ f'import pytest\n\npytestmark = pytest.mark.platforms("{platform}")\n\n\ndef test_y():\n pass\n',+ )+ # A file with no gate at all must not be selected.+ _write(tmp_path, "test_plain.py", "def test_z():\n pass\n")+ # A platforms() file gating a DIFFERENT platform must not be selected.+ other = "windows" if platform != "windows" else "linux"+ _write(+ tmp_path,+ "test_other_platform.py",+ f'import pytest\n\n\[email protected]("{other}")\ndef test_w():\n pass\n',+ )+ # A bare identifier that merely LOOKS like the platform name must not+ # match — the spec has to appear inside the quoted string literal.+ _write(+ tmp_path,+ "test_bare_identifier.py",+ f"import pytest\n\n\[email protected](\"kind\", [\"{platform}\"])\ndef test_v():\n assert kind\n",+ )+result = _run(platform, str(tmp_path))++ assert result.returncode == 0, result.stderr+ listed = result.stdout.split()+ assert any(p.endswith("test_decorated.py") for p in listed)+ assert any(p.endswith("test_module_level.py") for p in listed)+ assert not any(p.endswith("test_plain.py") for p in listed)+ assert not any(p.endswith("test_other_platform.py") for p in listed)+ assert not any(p.endswith("test_bare_identifier.py") for p in listed)+++def test_negated_spec_lists_for_that_lane(tmp_path):+ """``platforms("not macos")`` lists the file for the macOS lane import.++ The script only decides which files are IMPORTED; the per-test host+ skips remain authoritative. A negated-spec file may still contain other+ tests, so it must be imported on the macOS lane — under-selecting is+ the failure mode this tool exists to prevent.+ """+ _write(+ tmp_path,+ "test_negated.py",+ 'import pytest\n\n\[email protected]("not macos")\ndef test_x():\n pass\n',+ )++ result = _run("macos", str(tmp_path))+assert result.returncode == 0, result.stderr- assert {Path(p).stem.removeprefix("test_") for p in result.stdout.split()} == expected+ listed = result.stdout.split()+ assert any(p.endswith("test_negated.py") for p in listed)def test_unknown_platform_is_rejected(tmp_path):@@ -88,32 +124,27 @@ def test_rejects_missing_root():assert "no such directory" in result.stderr+def test_emits_repo_relative_posix_paths():+ """Output feeds a bash command line on the Windows runner, so separators+ must be POSIX and paths repo-relative.++ Asserted against the real ``tests/`` tree, which is the only case CI+ exercises — an out-of-repo root can't be made repo-relative and is+ emitted absolute instead.+ """+ result = _run("windows")++ assert result.returncode == 0, result.stderr+ listed = result.stdout.split()+ assert listed+ for line in listed:+ assert "\\" not in line+ assert not Path(line).is_absolute()++def test_real_tree_selects_files_for_every_platform():"""Against the actual ``tests/`` tree each platform resolves to real files."""for platform in ("linux", "macos", "windows"):result = _run(platform)assert result.returncode == 0, (platform, result.stderr)assert result.stdout.split(), f"{platform} selected nothing in the real tree"- for line in result.stdout.split():- assert "\\" not in line- assert not Path(line).is_absolute()- assert (REPO_ROOT / line).is_file()--def test_unparseable_file_is_still_listed(tmp_path):- """A file the selector cannot parse is conservatively listed so the lane- fails visibly there rather than silently dropping that coverage."""- _write(- tmp_path,- "test_gated.py",- 'import pytest\n\n\[email protected]("macos")\ndef test_x():\n pass\n',- )- _write(tmp_path, "test_broken.py", "def f(:\n")-- result = _run("macos", str(tmp_path))-- assert result.returncode == 0, result.stderr- listed = result.stdout.split()- assert any(p.endswith("test_broken.py") for p in listed)- assert any(p.endswith("test_gated.py") for p in listed)- # The problem is still reported, not swallowed.- assert "test_broken.py" in result.stderrdiff --git a/tests/conftest.py b/tests/conftest.pyindex 12f7699f812..d6bf5750c18 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -1506,10 +1506,21 @@ def _reject_contradictory_platform_marks(items):marker: platforms("linux", arch="arm64")."""offenders = []+ retired = []for item in items:marks = list(item.iter_markers("platforms"))if len(marks) > 1:offenders.append(f" {item.nodeid}: {len(marks)} platforms() marks")+ for legacy in ("linux_only", "macos_only", "windows_only"):+ if item.get_closest_marker(legacy):+ retired.append(f" {item.nodeid}: {legacy}")+ if retired:+ # An unregistered mark is a warning, so a merge that resurrects the old+ # trio would make a host-gated test RUN on every host, unnoticed.+ raise pytest.UsageError(+ "linux_only/macos_only/windows_only were replaced by platforms(...); rewrite:\n"+ + "\n".join(retired)+ )if offenders:raise pytest.UsageError("a test may carry at most one platforms() marker — combine the "diff --git a/tests/gateway/test_api_server_bind_guard.py b/tests/gateway/test_api_server_bind_guard.pyindex 967d46e5d4f..670c37f7466 100644--- a/tests/gateway/test_api_server_bind_guard.py+++ b/tests/gateway/test_api_server_bind_guard.py@@ -145,7 +145,7 @@ class TestBindMechanics:await second.disconnect()- @pytest.mark.macos_only # the exclusive bind (reuse_address=False) is a Darwin-only path+ @pytest.mark.platforms("macos") # the exclusive bind (reuse_address=False) is a Darwin-only path@pytest.mark.asyncioasync def test_rebind_over_time_wait(self):"""A port held only by a server-side TIME_WAIT socket (the previous gateway closed adiff --git a/tests/gateway/test_shutdown_forensics.py b/tests/gateway/test_shutdown_forensics.pyindex d6c15b4cea1..4ff1ad2947b 100644--- a/tests/gateway/test_shutdown_forensics.py+++ b/tests/gateway/test_shutdown_forensics.py@@ -106,7 +106,7 @@ def child_with_secret_argv():class TestArgvFreePersistence:- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_snapshot_and_log_line_identify_process_without_argv(self, child_with_secret_argv):"""/proc-backed summaries keep pid/name/ppid/state but never the command line, so neitherthe JSON snapshot nor the warning line can carry a credential from a parent's argv."""@@ -132,7 +132,7 @@ class TestSpawnAsyncDiagnostic:# ``pstree``). On hosts without ``timeout`` (macOS) Popen raises and the# producer returns None by design (fail-soft), so the spawn can only be# observed on Linux.- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_spawns_subprocess_and_writes_output(self, tmp_path):log_path = tmp_path / "diag.log"pid = sf.spawn_async_diagnostic(log_path, "SIGTERM", timeout_seconds=3.0)@@ -158,7 +158,7 @@ class TestSpawnAsyncDiagnostic:assert "shutdown diagnostic" in contentsassert "SIGTERM" in contents- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_diagnostic_log_omits_child_argv_and_is_owner_only(self, tmp_path, child_with_secret_argv):"""The detached ps/pstree walk must not write any process's argv to disk, and the log(even one created 0644 by an earlier release) ends up owner-only."""diff --git a/tests/gateway/test_systemd_notify.py b/tests/gateway/test_systemd_notify.pyindex aaa5d25dd41..c4765b715f7 100644--- a/tests/gateway/test_systemd_notify.py+++ b/tests/gateway/test_systemd_notify.py@@ -10,7 +10,7 @@ import pytestpytestmark = pytest.mark.platforms("linux")[email protected]_only # abstract (NUL-prefixed) AF_UNIX names are a Linux kernel feature[email protected]("linux") # abstract (NUL-prefixed) AF_UNIX names are a Linux kernel featuredef test_notify_supports_systemd_abstract_socket(monkeypatch):name = "\0hermes-test-notify"receiver = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)diff --git a/tests/hermes_cli/test_actual_provider.py b/tests/hermes_cli/test_actual_provider.pyindex 5c16d3fe524..74cb82a9e4b 100644--- a/tests/hermes_cli/test_actual_provider.py+++ b/tests/hermes_cli/test_actual_provider.py@@ -422,7 +422,7 @@ def test_actual_profile_translates_explicit_reasoning_controls():assert top_level["reasoning_effort"] == expected_effort[email protected]_only[email protected]("macos")def test_actual_hosted_client_uses_scoped_macos_certifi(monkeypatch):import certifi@@ -436,7 +436,7 @@ def test_actual_hosted_client_uses_scoped_macos_certifi(monkeypatch):)[email protected]_only[email protected]("macos")def test_actual_client_tls_default_does_not_override_explicit_config(monkeypatch):from agent.agent_runtime_helpers import create_openai_clientdiff --git a/tests/hermes_cli/test_desktop_console.py b/tests/hermes_cli/test_desktop_console.pyindex e3d48794df1..0ca62d51dd1 100644--- a/tests/hermes_cli/test_desktop_console.py+++ b/tests/hermes_cli/test_desktop_console.py@@ -9,7 +9,7 @@ import pytestfrom hermes_cli.desktop_console import desktop_console_output, desktop_launch_notice[email protected]_only[email protected]("windows")def test_packaged_console_output_drains_both_streams(caplog, monkeypatch):caplog.set_level(logging.INFO, logger="hermes_cli.desktop")@@ -30,7 +30,7 @@ def test_packaged_console_output_drains_both_streams(caplog, monkeypatch):assert any("diagnostic" in message for message in messages)[email protected]_only[email protected]("windows")@pytest.mark.parametrize("level", [logging.WARNING, logging.ERROR])def test_stderr_survives_logging_threshold(caplog, level):caplog.set_level(level, logger="hermes_cli.desktop")@@ -46,7 +46,7 @@ def test_stderr_survives_logging_threshold(caplog, level):assert not any("ordinary-output" in message for message in messages)[email protected]_only[email protected]("windows")@pytest.mark.parametrize("stream", ["stdout", "stderr"])def test_complete_records_reach_redacted_logs(tmp_path, monkeypatch, caplog, stream):import hermes_loggingdiff --git a/tests/hermes_cli/test_desktop_startup_cost.py b/tests/hermes_cli/test_desktop_startup_cost.pyindex 8a27553b505..a81caa5d5ee 100644--- a/tests/hermes_cli/test_desktop_startup_cost.py+++ b/tests/hermes_cli/test_desktop_startup_cost.py@@ -59,7 +59,7 @@ def test_desktop_hash_invalidates_for_edits_even_with_restored_mtime(tmp_path):assert desktop._compute_desktop_content_hash(root) != original[email protected]_only[email protected]("windows")def test_desktop_hash_detects_memory_mapped_edits(tmp_path):import mmap@@ -73,7 +73,7 @@ def test_desktop_hash_detects_memory_mapped_edits(tmp_path):assert desktop._compute_desktop_content_hash(root) != original[email protected]_only[email protected]("windows")def test_desktop_hash_recovers_after_a_temporary_read_lock(tmp_path):import msvcrtdiff --git a/tests/hermes_cli/test_gateway_restart_no_unit_linger.py b/tests/hermes_cli/test_gateway_restart_no_unit_linger.pyindex 8008be9d3e1..e2ae1b9fcec 100644--- a/tests/hermes_cli/test_gateway_restart_no_unit_linger.py+++ b/tests/hermes_cli/test_gateway_restart_no_unit_linger.py@@ -10,7 +10,7 @@ from types import SimpleNamespaceimport pytest[email protected]_only[email protected]("linux")def test_restart_without_service_unit_runs_gateway_even_without_linger(monkeypatch):from hermes_cli import gateway as gw@@ -29,7 +29,7 @@ def test_restart_without_service_unit_runs_gateway_even_without_linger(monkeypatassert started, "no unit installed: restart must fall through to run_gateway, linger or not"[email protected]_only[email protected]("linux")def test_restart_with_systemd_unit_still_reports_missing_linger(monkeypatch):from hermes_cli import gateway as gwdiff --git a/tests/hermes_cli/test_gateway_service.py b/tests/hermes_cli/test_gateway_service.pyindex 7c21958c126..194561dfaf6 100644--- a/tests/hermes_cli/test_gateway_service.py+++ b/tests/hermes_cli/test_gateway_service.py@@ -2855,7 +2855,7 @@ class TestUnitAnchoredServiceIdentity:resolver, and only an elevated process operates the system unit."""- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_home_not_pinned_by_unit_keeps_its_suffix(self, tmp_path, monkeypatch):alice_home = tmp_path / "alice" / ".hermes"alice_home.mkdir(parents=True)@@ -2875,7 +2875,7 @@ class TestUnitAnchoredServiceIdentity:assert name != gateway_cli._SERVICE_BASEassert name.startswith(gateway_cli._SERVICE_BASE + "-")- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_unprivileged_profile_command_ignores_the_system_unit(self, tmp_path, monkeypatch):"""A bare system unit pinning ``profiles/<name>`` must not alias that profile onto the user'sdefault unit when an unprivileged user-scope command resolves the name."""@@ -2892,7 +2892,7 @@ class TestUnitAnchoredServiceIdentity:monkeypatch.setenv("HERMES_HOME", str(profile_home))assert gateway_cli.get_service_name() == "hermes-gateway-kimi"- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_bare_unit_pinning_a_named_profile_home_keeps_the_bare_name(self, tmp_path, monkeypatch):"""``sudo ... install --system`` names the unit from root's default but pins the invoking user'sremapped home, so the BARE unit legitimately carries a ``profiles/<name>`` home. The unit-pinned@@ -2915,7 +2915,7 @@ class TestUnitAnchoredServiceIdentity:# with the readable suffix -- which is why the unit-pinned check has to be evaluated first.assert gateway_cli._profile_name_from_home(profile_home, profile_home.parent.parent) == profile_home.name- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_real_unit_sync_keeps_the_name_it_validated(self, tmp_path, monkeypatch):"""Drive the production sync instead of simulating the adoption with setenv: the name resolvedbefore ``_sync_hermes_home_from_systemd_unit()`` must survive the mutation it performs."""diff --git a/tests/hermes_cli/test_gateway_task_probe.py b/tests/hermes_cli/test_gateway_task_probe.pyindex c0cf2df56e0..3235e4a7b26 100644--- a/tests/hermes_cli/test_gateway_task_probe.py+++ b/tests/hermes_cli/test_gateway_task_probe.py@@ -9,7 +9,7 @@ import pytestfrom hermes_cli.gateway import _windows_scheduled_task_state[email protected]_only[email protected]("windows")def test_task_query_without_powershell_module_autoload():real_run = subprocess.rundiff --git a/tests/hermes_cli/test_home_directory_diagnostics.py b/tests/hermes_cli/test_home_directory_diagnostics.pyindex bb210e6b446..ae6f21d0dc8 100644--- a/tests/hermes_cli/test_home_directory_diagnostics.py+++ b/tests/hermes_cli/test_home_directory_diagnostics.py@@ -67,7 +67,7 @@ def test_initialization_preserves_external_directory_modes(tmp_path, monkeypatchassert (home / "logs").stat().st_mode & 0o777 == 0o700[email protected]_only[email protected]("linux")@pytest.mark.parametrize("existing", (False, True))def test_symlinked_parent_above_home_is_not_an_operator_home_link(tmp_path, monkeypatch, existing@@ -104,7 +104,7 @@ def test_symlinked_parent_above_home_is_not_an_operator_home_link(assert mode == 0o700, f"{name} should be 0700, got 0o{mode:o}"[email protected]_only[email protected]("linux")def test_aliased_parent_still_leaves_an_operator_home_link_alone(tmp_path, monkeypatch):"""An operator-owned link at the home boundary keeps owning the mode, aliased parent or not."""real_root = tmp_path / "real"diff --git a/tests/hermes_cli/test_kanban_gateway_restart_handoff.py b/tests/hermes_cli/test_kanban_gateway_restart_handoff.pyindex 7f201c694a8..a94b2b3c59e 100644--- a/tests/hermes_cli/test_kanban_gateway_restart_handoff.py+++ b/tests/hermes_cli/test_kanban_gateway_restart_handoff.py@@ -143,7 +143,7 @@ def test_standalone_dispatcher_keeps_direct_worker_spawn(assert captured_cmd[:3] == ["hermes", "-p", "coder"][email protected]_only[email protected]("linux")def test_oneshot_unit_dispatcher_scope_wraps_or_warns_never_dooms_silently(worker_setup: tuple[Path, kb.Task], monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture) -> None:diff --git a/tests/hermes_cli/test_kanban_worker_exit_decode.py b/tests/hermes_cli/test_kanban_worker_exit_decode.pyindex 8d4e11cc617..e22da852de3 100644--- a/tests/hermes_cli/test_kanban_worker_exit_decode.py+++ b/tests/hermes_cli/test_kanban_worker_exit_decode.py@@ -54,7 +54,7 @@ def test_windows_reaper_classifies_parked_popen_exit(monkeypatch):alive.wait()[email protected]_only[email protected]("windows")def test_native_windows_reaper_and_decode(monkeypatch):"""Native Windows, nothing patched: ``_IS_WINDOWS`` selects the Popen-pollreaper and the decode runs where ``os.WIFEXITED`` does not exist, so thediff --git a/tests/hermes_cli/test_launchd_plist_guard.py b/tests/hermes_cli/test_launchd_plist_guard.pyindex a787edb0530..569ab202d35 100644--- a/tests/hermes_cli/test_launchd_plist_guard.py+++ b/tests/hermes_cli/test_launchd_plist_guard.py@@ -16,7 +16,7 @@ from hermes_cli import main_dashboard# ``_loaded_launchd_backend_jobs`` reads ``sys.platform`` directly (no host seam), so# the scan runs only on a real macOS host — never by faking the platform.-pytestmark = pytest.mark.macos_only+pytestmark = pytest.mark.platforms("macos")# A plist that is not well-formed XML yet launchd itself tolerates: a raw `&&`diff --git a/tests/hermes_cli/test_local_runtime_processes.py b/tests/hermes_cli/test_local_runtime_processes.pyindex 17227987f55..877d44eccf4 100644--- a/tests/hermes_cli/test_local_runtime_processes.py+++ b/tests/hermes_cli/test_local_runtime_processes.py@@ -80,7 +80,7 @@ def _kill(identity):proc.wait(timeout=10)[email protected]_only[email protected]("windows")@pytest.mark.parametrize('stop_mode', ['graceful', 'abrupt'])@pytest.mark.parametrize('nested', [False, True])def test_owner_exit_kills_router_tree_not_external(tmp_path, stop_mode, nested):@@ -140,7 +140,7 @@ def test_owner_exit_kills_router_tree_not_external(tmp_path, stop_mode, nested):launcher.wait(timeout=10)[email protected]_only[email protected]("windows")@pytest.mark.parametrize('failure', ['assign', 'resume', 'popen', 'configure'])def test_failed_setup_never_runs_child_and_releases_handles(tmp_path, monkeypatch, failure):import ctypesdiff --git a/tests/hermes_cli/test_managed_uv_windows_cutover.py b/tests/hermes_cli/test_managed_uv_windows_cutover.pyindex 15c84681c8f..64dfc33538a 100644--- a/tests/hermes_cli/test_managed_uv_windows_cutover.py+++ b/tests/hermes_cli/test_managed_uv_windows_cutover.py@@ -29,7 +29,7 @@ def _info(exe: Path, version: tuple[int, int, int], sqlite: str) -> SQLiteRuntimsqlite_version_string=sqlite, sqlite_source_id=sqlite)[email protected]_only[email protected]("windows")def test_runtime_config_cutover_repoints_a_running_venv(tmp_path: Path, monkeypatch) -> None:from hermes_cli import managed_uvdiff --git a/tests/hermes_cli/test_profile_delete_mcp_log.py b/tests/hermes_cli/test_profile_delete_mcp_log.pyindex dc6bc45b81e..8a9ed9fe577 100644--- a/tests/hermes_cli/test_profile_delete_mcp_log.py+++ b/tests/hermes_cli/test_profile_delete_mcp_log.py@@ -11,7 +11,7 @@ from hermes_constants import reset_hermes_home_override, set_hermes_home_overridfrom tools import mcp_tool_config[email protected]_only[email protected]("windows")def test_delete_profile_after_stdio_probe(tmp_path, monkeypatch):monkeypatch.setattr(Path, "home", lambda: tmp_path)home = tmp_path / ".hermes"diff --git a/tests/hermes_cli/test_profiles.py b/tests/hermes_cli/test_profiles.pyindex d2eb85bf890..85535b2c489 100644--- a/tests/hermes_cli/test_profiles.py+++ b/tests/hermes_cli/test_profiles.py@@ -284,7 +284,7 @@ class TestCreateProfile:from tools.skills_tool import _collect_skill_candidatesassert len(_collect_skill_candidates("foo", None, [clone / "skills", external])) == 1- @pytest.mark.windows_only+ @pytest.mark.platforms("windows")def test_clone_keeps_real_ntfs_junction(self, profile_env):import _winapidefault_home, external = self._home_with_linked_skill(profile_env)diff --git a/tests/hermes_cli/test_relaunch.py b/tests/hermes_cli/test_relaunch.pyindex f57f30c5a86..288307259f2 100644--- a/tests/hermes_cli/test_relaunch.py+++ b/tests/hermes_cli/test_relaunch.py@@ -114,7 +114,7 @@ class TestRelaunch:assert calls == [("/usr/bin/hermes", ["/usr/bin/hermes", "--resume", "abc"])]- @pytest.mark.windows_only+ @pytest.mark.platforms("windows")def test_windows_uses_subprocess_not_execvp(self, monkeypatch):"""On Windows, os.execvp raises OSError "Exec format error" when thetarget is a .cmd shim or console-script wrapper (both common for@@ -163,7 +163,7 @@ class TestRelaunch:assert execvp_calls == []assert captured_argv == [[r"C:\Users\test\hermes.exe", "chat"]]- @pytest.mark.windows_only+ @pytest.mark.platforms("windows")def test_windows_propagates_child_exit_code(self, monkeypatch):"""A non-zero exit from the child should flow through to sys.exit."""monkeypatch.setattr(relaunch_mod, "resolve_hermes_bin", lambda: r"C:\hermes.exe")@@ -195,7 +195,7 @@ class TestResolveHermesBinWindowsPyGuard:faked ``sys.platform`` could never reproduce the hazard."""- @pytest.mark.windows_only+ @pytest.mark.platforms("windows")def test_windows_rejects_py_argv0_falls_through_to_path(self, monkeypatch, tmp_path):"""On Windows, if sys.argv[0] is a .py file, we must skip theargv[0] fast-path and fall through to PATH / python -m."""@@ -265,7 +265,7 @@ class TestResolveHermesBinWindowsPyGuard:monkeypatch.setattr(relaunch_mod.sys, "argv", [str(pinned), "chat"])assert relaunch_mod.resolve_hermes_bin() == str(pinned)- @pytest.mark.windows_only+ @pytest.mark.platforms("windows")def test_windows_py_argv0_with_no_hermes_on_path_returns_none(self, monkeypatch, tmp_path):"""Bulletproof fallback: if argv0 is .py on Windows AND hermes.exeisn't on PATH, return None so the caller falls back todiff --git a/tests/hermes_cli/test_serve_parent_watchdog.py b/tests/hermes_cli/test_serve_parent_watchdog.pyindex 95cb895cfe3..b2fd384919f 100644--- a/tests/hermes_cli/test_serve_parent_watchdog.py+++ b/tests/hermes_cli/test_serve_parent_watchdog.py@@ -199,7 +199,7 @@ def test_parent_watchdog_degrades_to_pid_liveness_when_marker_probe_raises_oserrprocess_start_marker=lookup_error_probe) is True[email protected]_only[email protected]("macos")def test_ps_marker_probe_classifies_missing_process_vs_other_ps_failures(monkeypatch):"""The darwin ``ps`` probe raises ``ProcessLookupError`` only for an explicit missing-processmessage; any other unknown failure stays a plain ``OSError`` so the watchdog degrades insteaddiff --git a/tests/hermes_cli/test_update_fleet_incomplete_warning.py b/tests/hermes_cli/test_update_fleet_incomplete_warning.pyindex 8ec5b280a90..3b6cf5a7b62 100644--- a/tests/hermes_cli/test_update_fleet_incomplete_warning.py+++ b/tests/hermes_cli/test_update_fleet_incomplete_warning.py@@ -10,7 +10,7 @@ import pytestfrom hermes_cli.update_cmd_fleet import _warn_incomplete_gateway_fleet_restart-pytestmark = pytest.mark.linux_only+pytestmark = pytest.mark.platforms("linux")def test_launchd_labels_get_launchctl_hint(capsys):diff --git a/tests/hermes_cli/test_update_launchd_fleet_restart.py b/tests/hermes_cli/test_update_launchd_fleet_restart.pyindex 2f96f613384..9632f5d4348 100644--- a/tests/hermes_cli/test_update_launchd_fleet_restart.py+++ b/tests/hermes_cli/test_update_launchd_fleet_restart.py@@ -39,7 +39,7 @@ from hermes_cli.update_cmd import ()-pytestmark = pytest.mark.macos_only # launchd fleet restart is macOS-only; helpers use POSIX os.getuid+pytestmark = pytest.mark.platforms("macos") # launchd fleet restart is macOS-only; helpers use POSIX os.getuidUID = 501diff --git a/tests/hermes_cli/test_worktree_selfheal.py b/tests/hermes_cli/test_worktree_selfheal.pyindex 21406600b6a..ac6748a586b 100644--- a/tests/hermes_cli/test_worktree_selfheal.py+++ b/tests/hermes_cli/test_worktree_selfheal.py@@ -164,7 +164,7 @@ class TestRepackStampede:worktree_ops._maintain_pack_health(str(repo))assert len(runs) == 2- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_timeout_kills_the_whole_repack_tree(self, tmp_path, monkeypatch):import osimport timediff --git a/tests/hermes_state/test_deleted_wal_checkpoint_guard.py b/tests/hermes_state/test_deleted_wal_checkpoint_guard.pyindex 2976003e8b6..d1384bebecb 100644--- a/tests/hermes_state/test_deleted_wal_checkpoint_guard.py+++ b/tests/hermes_state/test_deleted_wal_checkpoint_guard.py@@ -60,7 +60,7 @@ def _unlink_sidecars(db_path: Path) -> None:os.unlink(sidecar)[email protected]_only # deleted-WAL write halt uses Linux unlink semantics[email protected]("linux") # deleted-WAL write halt uses Linux unlink semanticsdef test_close_after_halt_runs_no_checkpoint(tmp_path, force_wal):"""A writer halted by DeletedWalGenerationError must not checkpoint (periodic, VACUUM or close) nor run FTS repair."""path = tmp_path / "state.db"@@ -92,7 +92,7 @@ def test_close_after_halt_runs_no_checkpoint(tmp_path, force_wal):)[email protected]_only # deleted-WAL write halt uses Linux unlink semantics[email protected]("linux") # deleted-WAL write halt uses Linux unlink semanticsdef test_halt_disables_close_time_checkpoint(tmp_path, force_wal):"""On 3.12+ the halt must also call _disable_close_time_checkpoint()."""import sqlite3diff --git a/tests/hermes_state/test_deleted_wal_generation_guard.py b/tests/hermes_state/test_deleted_wal_generation_guard.pyindex ae4cfc17108..1536a533085 100644--- a/tests/hermes_state/test_deleted_wal_generation_guard.py+++ b/tests/hermes_state/test_deleted_wal_generation_guard.py@@ -409,7 +409,7 @@ def _assert_retirement_preserves_recoverable_wal(tmp_path, *, fd_directory, alsoother.close()[email protected]_only[email protected]("linux")@pytest.mark.parametrize("also_corrupt", [False, True])def test_retirement_preserves_recoverable_wal_and_other_deleted_generation(tmp_path, force_wal, also_corrupt):_assert_retirement_preserves_recoverable_wal(@@ -417,7 +417,7 @@ def test_retirement_preserves_recoverable_wal_and_other_deleted_generation(tmp_p)[email protected]_only[email protected]("macos")@pytest.mark.parametrize("also_corrupt", [False, True])def test_retirement_preserves_unlinked_wal_on_macos(tmp_path, force_wal, also_corrupt):_assert_retirement_preserves_recoverable_wal(@@ -449,12 +449,12 @@ def _assert_new_generation_survives_retirement_and_exit(tmp_path, *, rename_sideassert message_count(path) == expected, "normal exit rolled back the newer rows"[email protected]_only[email protected]("linux")def test_deleted_wal_generation_survives_close_and_clean_process_exit(tmp_path):_assert_new_generation_survives_retirement_and_exit(tmp_path, rename_sidecars=False)[email protected]_only[email protected]("macos")def test_renamed_wal_generation_survives_close_and_clean_process_exit(tmp_path):_assert_new_generation_survives_retirement_and_exit(tmp_path, rename_sidecars=True)@@ -490,7 +490,7 @@ def test_refuse_helper_raises_while_deleted_wal_held(tmp_path, force_wal):# (``proc_pidinfo(PROC_PIDLISTFDS)`` + ``proc_pidfdinfo(PROC_PIDFDVNODEPATHINFO)``) that supplies# each descriptor's ``(st_dev, st_ino)``. The judgement is unchanged: identity, never path text.[email protected]_only[email protected]("macos")def test_iter_finds_self_after_wal_unlink_on_darwin(tmp_path, force_wal):path = tmp_path / "state.db"db = make_db(path, "s", "held")@@ -507,7 +507,7 @@ def test_iter_finds_self_after_wal_unlink_on_darwin(tmp_path, force_wal):db.close()[email protected]_only[email protected]("macos")def test_iter_finds_no_holder_while_sidecars_stay_linked_on_darwin(tmp_path, force_wal):"""The scan must not report the CURRENT generation: a linked sidecar is not a retired one."""path = tmp_path / "state.db"@@ -519,7 +519,7 @@ def test_iter_finds_no_holder_while_sidecars_stay_linked_on_darwin(tmp_path, fordb.close()[email protected]_only[email protected]("macos")def test_iter_darwin_judges_by_identity_not_by_pathname(tmp_path):"""A retired generation stays a holder after the path names a DIFFERENT inode: libproc reportsthe vnode's last pathname with no `` (deleted)`` marker, so only ``(st_dev, st_ino)`` can telldiff --git a/tests/hermes_state/test_fts_holder_instance_scope.py b/tests/hermes_state/test_fts_holder_instance_scope.pyindex 6f3f7f9dd85..bfe9613ad08 100644--- a/tests/hermes_state/test_fts_holder_instance_scope.py+++ b/tests/hermes_state/test_fts_holder_instance_scope.py@@ -107,7 +107,7 @@ def _install_fake_argv(monkeypatch, argv_by_pid):)[email protected]_only[email protected]("linux")class TestUninspectableHolderInstanceScope:def test_other_instance_argv_is_not_a_holder_of_our_db(self, tmp_path, monkeypatch):"""RED: fd dir unreadable + argv proves the process belongs to adiff --git a/tests/hermes_state/test_retired_wal_generation_capture.py b/tests/hermes_state/test_retired_wal_generation_capture.pyindex 674078bc435..e767f51db32 100644--- a/tests/hermes_state/test_retired_wal_generation_capture.py+++ b/tests/hermes_state/test_retired_wal_generation_capture.py@@ -299,11 +299,11 @@ def _assert_retired_rows_recoverable_after_exit(tmp_path, *, rename):live.close()[email protected]_only[email protected]("linux")def test_retired_rows_recoverable_after_process_exit(tmp_path):_assert_retired_rows_recoverable_after_exit(tmp_path, rename=False)[email protected]_only[email protected]("macos")def test_retired_rows_recoverable_after_process_exit_with_renamed_sidecars(tmp_path):_assert_retired_rows_recoverable_after_exit(tmp_path, rename=True)diff --git a/tests/hermes_state/test_state_db_second_process_maintenance.py b/tests/hermes_state/test_state_db_second_process_maintenance.pyindex 947eb8a1478..77beb26d6ce 100644--- a/tests/hermes_state/test_state_db_second_process_maintenance.py+++ b/tests/hermes_state/test_state_db_second_process_maintenance.py@@ -37,7 +37,7 @@ def delete_mode_db(tmp_path, monkeypatch) -> Path:return db[email protected]_only[email protected]("linux")def test_repair_refuses_delete_mode_db_held_open_by_another_process(delete_mode_db):"""A held DELETE-mode reader takes only SHARED, so ``BEGIN IMMEDIATE`` succeeds and the lock probe seesnothing; the holder scan must still refuse — REINDEX/VACUUM from a second process is the #103339 class."""diff --git a/tests/hermes_state/test_state_db_stats.py b/tests/hermes_state/test_state_db_stats.pyindex f4bdec9bbc3..2ee1b70deba 100644--- a/tests/hermes_state/test_state_db_stats.py+++ b/tests/hermes_state/test_state_db_stats.py@@ -147,12 +147,12 @@ def _assert_sees_own_open_connection(db_path):conn.close()[email protected]_only[email protected]("linux")def test_count_db_holders_sees_open_connection_linux(populated_db):_assert_sees_own_open_connection(populated_db)[email protected]_only[email protected]("macos")def test_count_db_holders_sees_open_connection_macos(populated_db):# #109641: the doctor's holder count was Linux-only, so `hermes doctor` on the platform with# every reporter in the deleted-WAL cluster printed no holder row at all.diff --git a/tests/hermes_state/test_wal_lock_guard.py b/tests/hermes_state/test_wal_lock_guard.pyindex 1397387dc44..b23541a1e2b 100644--- a/tests/hermes_state/test_wal_lock_guard.py+++ b/tests/hermes_state/test_wal_lock_guard.py@@ -19,7 +19,7 @@ import pytestfrom hermes_state import SessionDBfrom tests.hermes_state._wal_generation_harness import make_db, pin_wal, require_wal-pytestmark = pytest.mark.linux_only+pytestmark = pytest.mark.platforms("linux")def _foreign_open_close(db_path: Path) -> None:diff --git a/tests/hermes_state/test_wal_lock_guard_lifecycle.py b/tests/hermes_state/test_wal_lock_guard_lifecycle.pyindex 66e861fb8ef..559d5bbf54d 100644--- a/tests/hermes_state/test_wal_lock_guard_lifecycle.py+++ b/tests/hermes_state/test_wal_lock_guard_lifecycle.py@@ -17,7 +17,7 @@ import hermes_state_lockguard as lgfrom hermes_state import SessionDBfrom tests.hermes_state._wal_generation_harness import make_db, pin_wal, require_wal-pytestmark = pytest.mark.linux_only+pytestmark = pytest.mark.platforms("linux")def _foreign_exclusive_ok(path: str) -> bool:diff --git a/tests/scripts/desktop_update/test_desktop_update_linux_gate.py b/tests/scripts/desktop_update/test_desktop_update_linux_gate.pyindex d88b1fab1fb..f9c7f9a891c 100644--- a/tests/scripts/desktop_update/test_desktop_update_linux_gate.py+++ b/tests/scripts/desktop_update/test_desktop_update_linux_gate.py@@ -18,7 +18,7 @@ import pytestPOSIX_SH = Path(__file__).resolve().parent.parent.parent.parent / "scripts" / "desktop-update" / "posix.sh"-pytestmark = pytest.mark.linux_only+pytestmark = pytest.mark.platforms("linux")def _gate(install_root: Path, relaunch_target: Path) -> str:diff --git a/tests/scripts/desktop_update/test_desktop_update_windows_cwd.py b/tests/scripts/desktop_update/test_desktop_update_windows_cwd.pyindex c2ddbe85427..8ff38b85991 100644--- a/tests/scripts/desktop_update/test_desktop_update_windows_cwd.py+++ b/tests/scripts/desktop_update/test_desktop_update_windows_cwd.py@@ -10,7 +10,7 @@ from pathlib import Pathimport pytest-pytestmark = pytest.mark.windows_only+pytestmark = pytest.mark.platforms("windows")REPO_ROOT = Path(__file__).resolve().parent.parent.parent.parentWINDOWS_UPDATE_PS1 = REPO_ROOT / "scripts" / "desktop-update" / "windows.ps1"diff --git a/tests/test_atomic_json_writers_unified.py b/tests/test_atomic_json_writers_unified.pyindex 10de99c7fe2..729c93a00dc 100644--- a/tests/test_atomic_json_writers_unified.py+++ b/tests/test_atomic_json_writers_unified.py@@ -85,7 +85,7 @@ def test_surrogate_escaped_strings_round_trip_through_atomic_json_write(tmp_pathassert _leftovers(target.parent, target.name) == [][email protected]_only[email protected]("linux")def test_new_non_secret_file_follows_umask_while_secret_and_existing_modes_hold(tmp_path):"""The writers this helper replaced created files at process umask; only ``mode=`` tightens."""import os@@ -112,7 +112,7 @@ def test_new_non_secret_file_follows_umask_while_secret_and_existing_modes_hold(os.umask(old_umask)[email protected]_only[email protected]("linux")def test_mkstemp_heritage_writers_keep_new_files_owner_only(tmp_path):"""Writers that published through mkstemp on main created NEW files at 0600 regardless of umask(bot mailboxes, turn markers); folding them into utils must not loosen that to umask."""diff --git a/tests/tools/test_code_execution_windows_env.py b/tests/tools/test_code_execution_windows_env.pyindex 891076a398e..0dc5fb21dc1 100644--- a/tests/tools/test_code_execution_windows_env.py+++ b/tests/tools/test_code_execution_windows_env.py@@ -201,7 +201,7 @@ def test_windows_child_keeps_os_local_timezone_when_timezone_is_configured(monkeassert "TZ" not in _configured_timezone_child_env()[email protected]_only[email protected]("windows")def test_windows_live_child_offset_matches_os_zone_when_timezone_is_configured(monkeypatch):"""The user-visible contract of #112233: with ``timezone:`` configured, a real Windows childmust report the OS zone's UTC offset — an IANA name in ``TZ`` made the MSVC runtime derivediff --git a/tests/tools/test_mcp_oauth_stdin_console.py b/tests/tools/test_mcp_oauth_stdin_console.pyindex 1aad9ff5fe0..1a5a97badc3 100644--- a/tests/tools/test_mcp_oauth_stdin_console.py+++ b/tests/tools/test_mcp_oauth_stdin_console.py@@ -8,7 +8,7 @@ import sysimport pytest[email protected]_only[email protected]("windows")def test_devnull_stdin_is_not_a_console_on_windows():code = ("import sys, os; sys.path.insert(0, os.getcwd()); ""from tools.mcp_oauth import _stdin_is_console; print(_stdin_is_console(), sys.stdin.isatty())")diff --git a/tests/tools/test_process_registry.py b/tests/tools/test_process_registry.pyindex 952afc894c7..b462f81dfc0 100644--- a/tests/tools/test_process_registry.py+++ b/tests/tools/test_process_registry.py@@ -2188,7 +2188,7 @@ class TestSystemdCgroupIsolation:return fake_popen, captured- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_wraps_in_systemd_scope_when_supervisor_and_available(self, registry, monkeypatch, _gateway_identity):@@ -2409,7 +2409,7 @@ class TestSystemdCgroupIsolation:assert session.systemd_unit == ""- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_systemd_post_spawn_failure_never_kills_gateway_process_group(self, registry, monkeypatch, _gateway_identity):@@ -2444,7 +2444,7 @@ class TestSystemdCgroupIsolation:assert stop_unit.call_args.args[0].endswith(".scope")killpg.assert_not_called()- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_pty_spawn_is_wrapped_in_systemd_scope(self, registry, monkeypatch, _gateway_identity):"""Interactive executors receive the same sibling-cgroup isolation."""from ptyprocess import PtyProcess@@ -2476,7 +2476,7 @@ class TestSystemdCgroupIsolation:assert argv[-3:] == ["/bin/bash", "-lic", "set +m; codex"]assert session.systemd_unit == f"hermes-worker-{session.id}.scope"- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_pty_spawn_failure_reaps_scope_before_distinct_pipe_fallback(self, registry, monkeypatch, _gateway_identity):@@ -2532,7 +2532,7 @@ class TestSystemdCgroupIsolation:f"hermes-worker-{session.id}-pipe-fallback.scope")- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_pty_spawn_failure_does_not_fallback_when_scope_reap_fails(self, registry, monkeypatch, _gateway_identity):@@ -2627,7 +2627,7 @@ class TestSystemdCgroupIsolation:assert session.id in registry._finishedassert session.id not in registry._running- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_systemd_run_user_scope_available_caches_after_probe(self, registry, monkeypatch):@@ -2733,7 +2733,7 @@ class TestSystemdCgroupIsolation:assert "XDG_RUNTIME_DIR" not in os.environassert "DBUS_SESSION_BUS_ADDRESS" not in os.environ- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_scoped_spawn_lost_user_bus_honours_configured_runtime_dir(self, monkeypatch, request):"""The lost-bus check must derive from the env the worker was spawned with: when the buslives under a configured ``XDG_RUNTIME_DIR`` (not ``/run/user/<uid>``), an unrelated wrapper@@ -2771,7 +2771,7 @@ class TestSystemdCgroupIsolation:assert pr.scoped_spawn_lost_user_bus(spawn_env) is Trueassert pr._SYSTEMD_SCOPE_AVAILABLE is False- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_probe_succeeds_without_bin_true(self, monkeypatch):"""An absent ``/bin/true`` must not make a usable scope fail its probe."""import tools.process_registry as pr@@ -2795,7 +2795,7 @@ class TestSystemdCgroupIsolation:assert pr._systemd_run_user_scope_available() is Trueassert len(executed) == 1, "payload must really run (exit 0) on the host, not just be spelled right"- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_systemd_scope_first_probe_is_serialized(self, monkeypatch):"""Concurrent first-use callers must wait for one definitive probe.@@ -2843,7 +2843,7 @@ class TestSystemdCgroupIsolation:assert results == [True, True]assert len(probe_calls) == 1- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_failed_systemd_probe_retries_after_cache_ttl(self, monkeypatch):import tools.process_registry as prdiff --git a/tests/tools/test_process_registry_list_exit.py b/tests/tools/test_process_registry_list_exit.pyindex 55f933d30eb..4ef71bc434d 100644--- a/tests/tools/test_process_registry_list_exit.py+++ b/tests/tools/test_process_registry_list_exit.py@@ -13,7 +13,7 @@ import timeimport pytest[email protected]_only[email protected]("linux")def test_list_reconciles_real_exit_without_consuming_owned_result(tmp_path):# A disposable subreaper owns even the orphaned writer; no global pytest# process state is changed, and every fixture child is reaped on failure.