Skip to content

feat(file_safety): support multiple HERMES_WRITE_SAFE_ROOT dirs - #53292

Merged
kshitijk4poor merged 3 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/49557-multi-safe-roots
Jun 26, 2026
Merged

feat(file_safety): support multiple HERMES_WRITE_SAFE_ROOT dirs#53292
kshitijk4poor merged 3 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/49557-multi-safe-roots

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Summary

HERMES_WRITE_SAFE_ROOT now accepts multiple colon-separated directories (: on Unix, ; on Windows), so Docker deployments with multiple bind mounts can whitelist all of them for writes.

Changes

  • agent/file_safety.py: Renamed get_safe_write_root()get_safe_write_roots() returning set[str]; splits on os.pathsep instead of literal : for cross-platform support
  • tests/tools/test_file_write_safety.py: Added 9 tests for multi-root behavior (first/second root, outside-all, trailing/leading/double separators, all-separators edge case, static deny priority, duplicate dedup)
  • hermes_cli/tips.py: Updated tip string to mention multiple paths
  • website/docs/reference/environment-variables.md + zh-Hans: Updated docs

What was dropped from the original PR

The original PR #49557 bundled an unrelated UnicodeDecodeError fix in tools/memory_tool.py (addresses #49508). That fix is correct but belongs in its own PR — dropped here to keep this PR single-concern.

What was fixed during salvage

  • Used os.pathsep instead of hardcoded : — on Windows, drive-letter paths like C:\Users\foo contain a colon that would break the split. os.pathsep is ; on Windows.
  • Added 9 new tests (original PR had zero tests for the multi-root feature).
  • Updated hermes_cli/tips.py (missed by original PR).
  • Updated docs to mention ; on Windows.

Validation

Before After
Tests 30 existing pass 39 pass (30 existing + 9 new)
Windows ; support Broken (literal :) Works (os.pathsep)

Closes #49535

Credit: @xydigit-zt's original commits cherry-picked with authorship preserved.

Supports multiple directories separated by ':' (Unix PATH-style).
E.g., HERMES_WRITE_SAFE_ROOT=/opt/data:/var/www/html

Fixes NousResearch#49535
Add note about colon-separated multiple directories support.
@kshitijk4poor
kshitijk4poor force-pushed the salvage/49557-multi-safe-roots branch from 6f707c9 to ce33d45 Compare June 26, 2026 22:15
@alt-glitch alt-glitch added type/feature New feature or request comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint area/config Config system, migrations, profiles P3 Low — cosmetic, nice to have labels Jun 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Salvage of #49557 (@xydigit-zt), cherry-picked onto current main with authorship preserved (Closes #49535). The original PR's bundled memory_tool.py UnicodeDecodeError fix was intentionally dropped to keep this single-concern. Related to #49557, not a duplicate of it.

- Use os.pathsep instead of literal ':' so Windows paths (C:\dir) and
  the Windows separator ';' work correctly.
- Add 9 tests covering multi-root behavior: writes inside first/second
  root, writes outside all roots, trailing/leading/double separators,
  all-separators edge case, static deny priority, duplicate dedup.
- Update hermes_cli/tips.py tip string to mention multiple paths.
- Update docs to mention os.pathsep / ; on Windows.

Follow-up for salvaged PR NousResearch#49557.
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 comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Support multiple HERMES_WRITE_SAFE_ROOT directories

3 participants