Skip to content

fix(paths): preserve real home under sandbox HOME overrides#8671

Closed
sgaofen wants to merge 1 commit into
NousResearch:mainfrom
sgaofen:codex/real-home-path-resolution
Closed

fix(paths): preserve real home under sandbox HOME overrides#8671
sgaofen wants to merge 1 commit into
NousResearch:mainfrom
sgaofen:codex/real-home-path-resolution

Conversation

@sgaofen

@sgaofen sgaofen commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add get_real_home() and expand_real_user_path() so Hermes can distinguish the machine home from profile-local subprocess HOME sandboxes
  • pass HERMES_REAL_HOME into local/background/code-execution subprocess environments and switch the affected path-resolution call sites to use the real home helper
  • update file tools to expand ~/... before handing paths to the shell, and cover the regression with focused tests across constants, subprocess envs, Claude credentials, Modal config, gateway status, profiles, and file tools

Root Cause

Hermes used Path.home() and sandbox-local HOME values interchangeably, which broke path resolution whenever a profile or subprocess intentionally overrode HOME. That caused features that should use the real machine home directory to drift into the sandbox home instead.

Fixes #8669.

Testing

  • python3 -m py_compile hermes_constants.py tools/environments/local.py tools/code_execution_tool.py hermes_cli/profiles.py agent/anthropic_adapter.py tools/tool_backend_helpers.py gateway/status.py tools/file_tools.py tools/delegate_tool.py cli.py tests/test_hermes_constants.py tests/test_subprocess_home_isolation.py tests/agent/test_anthropic_adapter.py tests/tools/test_tool_backend_helpers.py tests/hermes_cli/test_profiles.py tests/gateway/test_status.py tests/tools/test_file_tools.py
  • uv run --directory /Users/stephenyu/Documents/hermes-agent-wt-8669 --extra dev pytest -o addopts='' tests/test_hermes_constants.py tests/test_subprocess_home_isolation.py tests/agent/test_anthropic_adapter.py tests/tools/test_tool_backend_helpers.py tests/hermes_cli/test_profiles.py tests/gateway/test_status.py tests/tools/test_file_tools.py -q -> 321 passed

Platform Tested

  • macOS 15.x (Apple Silicon)

Contribution Guide Notes

  • Reviewed CONTRIBUTING.md and checked for existing open PRs before submitting this scoped bug fix.
  • Rebased onto the latest main, resolved the only test-file conflict by preserving both branches' coverage, and reran the full targeted verification commands listed above.
  • I have not claimed a full repo-wide pytest tests/ -q pass unless explicitly noted.

@sgaofen sgaofen force-pushed the codex/real-home-path-resolution branch from 077a2a0 to 29ee9c3 Compare April 13, 2026 00:50
@sgaofen sgaofen marked this pull request as ready for review April 13, 2026 00:51
@teknium1

Copy link
Copy Markdown
Contributor

Closing as duplicate of #8910 — see comment there for the analysis. The subprocess HOME sandbox does not affect the main Python process's Path.home().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: sandbox HOME override breaks Path.home() and expanduser() resolution

2 participants