# NousResearch/hermes-agent · Adding Windows platform guards for UNIX-only test imports

## Open now

- Nothing open on GitHub.

Multiple issues and PRs addressing missing platform guards for UNIX-only stdlib modules (pwd, fcntl, grp) in test files, which cause failures on Windows. Proposed fixes use pytest.importorskip or skip decorators at the module level.

## TL;DR

- 9 member(s): 0 open issue(s), 2 closed issue(s), 0 open PR(s), 1 merged PR(s), 6 PR(s) closed without merging.
- A fix was merged to main in PR #22683. Verify it addresses your case.
- **Recommended:** read PR #22683 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `partially_resolved` · deciding PR(s): `pr-22683`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_PARTIAL`): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text.
- Members outside that structural core may belong to a different underlying problem.
- Pairwise link density `0.20`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #22420: tests: add Windows skip guards for UNIX-only stdlib imports (pwd, fcntl) on v2026.5.7
- #24531: test: bare \`import grp\` in TestSystemServiceIdentityRootHandling lacks platform guard

## Prior & competing PRs

- **#22683: tests: add Windows skip guards for UNIX-only stdlib imports (salvage #22567)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `scripts/release.py`, `tests/hermes_cli/test_gateway_service.py`, `tests/tools/test_file_sync_back.py`
  - fix hunks:
  - `scripts/release.py`

    ```diff
    @@ -67,6 +67,7 @@
         "[redacted:email]": "wesleysimplicio",
         "[redacted:email]": "SiliconID",
         "[redacted:email]": "xieNniu",
    +    "[redacted:email]": "wali-reheman",
         "[redacted:email]": "uzunkuyruk",
         "[redacted:email]": "Zhekinmaksim",
         "[redacted:email]": "KvnGz",
    ```
  - `tests/hermes_cli/test_gateway_service.py`

    ```diff
    @@ -1,13 +1,14 @@
     """Tests for gateway service management helpers."""
     
     import os
    -import pwd
     import subprocess
     from pathlib import Path
     from types import SimpleNamespace
     
     import pytest
     
    +pwd = pytest.importorskip("pwd")
    +
     import hermes_cli.gateway as gateway_cli
     from gateway import status
     from gateway.restart import (
    ```

    ```diff
    @@ -1284,20 +1285,17 @@ class TestSystemServiceIdentityRootHandling:
     
         def test_auto_detected_root_is_rejected(self, monkeypatch):
             """When root is auto-detected (not explicitly requested), raise."""
    -        import pwd
             import grp
     
             monkeypatch.delenv("SUDO_USER", raising=False)
             monkeypatch.setenv("USER", "root")
             monkeypatch.setenv("LOGNAME", "root")
     
    -        import pytest
             with pytest.raises(ValueError, match="pass --run-as-user root to override"):
                 gateway_cli._system_service_identity(run_as_user=None)
     
         def test_explicit_root_is_allowed(self, monkeypatch):
             """When root is explicitly passed via --run-as-user root, allow it."""
    -        import pwd
             import grp
     
             root_info = pwd.getpwnam("root")
    ```

    ```diff
    @@ -1309,7 +1307,6 @@ def test_explicit_root_is_allowed(self, monkeypatch):
     
         def test_non_root_user_passes_through(self, monkeypatch):
             """Normal non-root user works as before."""
    -        import pwd
             import grp
     
             monkeypatch.delenv("SUDO_USER", raising=False)
    ```
  - `tests/tools/test_file_sync_back.py`

    ```diff
    @@ -1,6 +1,5 @@
     """Tests for FileSyncManager.sync_back() — pull remote changes to host."""
     
    -import fcntl
     import io
     import logging
     import os
    ```

    ```diff
    @@ -12,6 +11,8 @@
     
     import pytest
     
    +fcntl = pytest.importorskip("fcntl")
    +
     from tools.environments.file_sync import (
         FileSyncManager,
         _sha256_file,
    ```
- **#24551: test: guard bare import grp with pytest.importorskip at module level**. closed without merge · fix tier `suggested`
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `4a4b9bd2dc86b1c360e31e4e104b226f6f1b0521`
  - _suggested-tier fix detail withheld; re-request with `?tier=all` to include it._
- **#24560: test: guard bare import grp with module-level pytest.importorskip**. closed without merge · fix tier `suggested`
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#24551`, `#24531`, `#24551`
  - _suggested-tier fix detail withheld; re-request with `?tier=all` to include it._
- **#22442: fix(tests): skip pwd/fcntl-dependent suites on Windows via importorskip**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `369cee018d46560e7076e209f311756aa5ec1f70`, `4e8b8573c`, `b959cfa05`, `#22683`, `#22683`
- **#22447: fix(tests): add Windows skip guards for UNIX-only pwd/fcntl imports**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#22683`
- **#22567: tests: add Windows skip guards for UNIX-only stdlib imports**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#22683`
- **#24570: fix: add platform guard for grp import in test_gateway_service.py**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#24551`, `#24531`

## Fix status

- Merged to main in PR #22683 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-05-09`.
- Subsystem: `hermes_cli`
