Skip to content

fix: harden Windows portability tests and paths - #40891

Open
eliaschofo wants to merge 16 commits into
NousResearch:mainfrom
eliaschofo:hermes-dep-hygiene-local
Open

eliaschofo wants to merge 16 commits into
NousResearch:mainfrom
eliaschofo:hermes-dep-hygiene-local

Conversation

@eliaschofo

Copy link
Copy Markdown

Summary

  • Fixes Windows path/URI handling regressions across ACP, image/cache helpers, file-safety, shell hooks, and skill/supporting-path display.
  • Makes Windows-specific/cross-platform tests deterministic by avoiding live shell/PATH dependencies in inline-shell skill-command tests.
  • Fixes terminal subdirectory hint extraction for Windows backslash paths.

Test Plan

  • Windows: python -m pytest tests\agent\test_external_skills.py tests\agent\test_skill_commands.py::TestInlineShellExpansion::test_inline_shell_runs_when_enabled -q -o addopts="" --tb=short → 12 passed.
  • Windows: python -m pytest tests\agent\test_skill_commands.py tests\agent\test_external_skills.py tests\agent\test_external_skills_dirs_cache.py -q -o addopts="" --tb=short → 58 passed.
  • Windows: python -m pytest tests\agent\test_subdirectory_hints.py tests\agent\test_skill_commands.py tests\agent\test_external_skills.py tests\agent\test_external_skills_dirs_cache.py -q -o addopts="" --tb=short → 83 passed.
  • Windows: python -m pytest tests\agent -q -o addopts= -m "not integration" --maxfail=1 --tb=short → 3914 passed, 14 skipped.

@eliaschofo
eliaschofo requested a review from a team June 7, 2026 00:58
@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P3 Low — cosmetic, nice to have area/config Config system, migrations, profiles labels Jun 7, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pursuing the native Windows path cases. The ACP portion targets a real current-main defect: acp_adapter/server.py:176-184 always maps drive-letter URIs to /mnt/<drive>, while the PR’s acp_adapter/server.py:171-181 adds the needed native-Windows branch.

Problems

  • tests/acp/__init__.py:1-30 should not be added. AGENTS.md:165-169 explicitly documents test-tree __init__.py restoration as a load-bearing shadowing failure; the dynamic re-exec workaround still makes import behavior collection/path-order dependent.
  • tools/terminal_tool.py:1725-1768 and 1920-1930 globally reject broad raw pytest commands and redirect to a new wrapper. This is unrelated to the Windows fix and conflicts with the required scripts/run_tests.sh runner in AGENTS.md:1281-1285.
  • scripts/hermes_safe_pytest.py:104,174,180 hardcodes /tmp and venv/bin, so the added wrapper is itself not native-Windows portable.
  • tests/acp_adapter/test_acp_images.py:41 changes file writing but does not cover _path_from_file_uri; the drive-letter regression needs direct tests.

Suggested changes

  • Split out the narrow ACP/path fixes, remove tests/acp/__init__.py, and add direct C:-drive URI tests for native Windows and WSL behavior.
  • Leave the pytest guardrail, terminal behavior, and unrelated dependency churn out of this salvage.

Automated hermes-sweeper review.

Comment thread tests/acp/__init__.py
@@ -0,0 +1,30 @@
"""ACP test package marker without shadowing ``agent-client-protocol``.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not add this package marker. AGENTS.md:165-169 documents this exact test-tree __init__.py pattern as load-bearing because it can shadow the installed package; the dynamic re-exec workaround makes imports depend on collection name and sys.path order.

Comment thread tools/terminal_tool.py
return None


_RAW_PYTEST_RE = re.compile(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces a global terminal-tool denial for broad pytest commands, which is unrelated to the Windows path fixes and conflicts with the repository’s required scripts/run_tests.sh runner (AGENTS.md:1281-1285). Please remove this guardrail from this PR.

return usage.free / (1024**3)


def cleanup_known_pytest_artifacts(tmp_root: Path = Path("/tmp"), *, max_age_seconds: int = 0) -> int:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new wrapper hardcodes POSIX /tmp here (and later venv/bin), so it is not native-Windows portable. It should not be introduced as part of a Windows portability fix.

@teknium1 teknium1 added sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit labels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles P3 Low — cosmetic, nice to have sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants