fix(paths): preserve real home under sandbox HOME overrides#8671
Closed
sgaofen wants to merge 1 commit into
Closed
fix(paths): preserve real home under sandbox HOME overrides#8671sgaofen wants to merge 1 commit into
sgaofen wants to merge 1 commit into
Conversation
077a2a0 to
29ee9c3
Compare
Contributor
|
Closing as duplicate of #8910 — see comment there for the analysis. The subprocess HOME sandbox does not affect the main Python process's |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_real_home()andexpand_real_user_path()so Hermes can distinguish the machine home from profile-local subprocessHOMEsandboxesHERMES_REAL_HOMEinto local/background/code-execution subprocess environments and switch the affected path-resolution call sites to use the real home helper~/...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 toolsRoot Cause
Hermes used
Path.home()and sandbox-localHOMEvalues interchangeably, which broke path resolution whenever a profile or subprocess intentionally overrodeHOME. 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.pyuv 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 passedPlatform Tested
Contribution Guide Notes
CONTRIBUTING.mdand checked for existing open PRs before submitting this scoped bug fix.main, resolved the only test-file conflict by preserving both branches' coverage, and reran the full targeted verification commands listed above.pytest tests/ -qpass unless explicitly noted.