fix(agent): expose HERMES_REAL_HOME in subprocess envs for profile isolation#25151
Open
zccyman wants to merge 1 commit into
Open
fix(agent): expose HERMES_REAL_HOME in subprocess envs for profile isolation#25151zccyman wants to merge 1 commit into
zccyman wants to merge 1 commit into
Conversation
Collaborator
|
Related to PR #21671 (allows subprocess HOME override via |
Contributor
Author
|
Thanks @alt-glitch for the reference to #21671. Noted as related but different angles — ours preserves the real home as |
…olation
When profile isolation activates ({HERMES_HOME}/home/ exists), child
processes receive HOME={HERMES_HOME}/home/ for tool config isolation
(git, ssh, gh). However, scripts using Path.home() to locate
~/.hermes/ would incorrectly resolve to the isolated profile home,
breaking helpers that rely on the real user home directory.
New get_real_home() helper in hermes_constants resolves the actual
user home independently of profile isolation. All four subprocess
spawners now inject HERMES_REAL_HOME alongside the profile HOME:
- tools/code_execution_tool.py (execute_code)
- tools/environments/local.py (terminal background, run_env)
- agent/copilot_acp_client.py (Copilot ACP)
Child scripts can now use:
Path(os.environ.get("HERMES_REAL_HOME", os.environ.get("HOME", "")))
to reliably find the real user home regardless of profile isolation.
Closes NousResearch#25114
7e97a8b to
081a56a
Compare
11 tasks
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
When profile isolation is active (
{HERMES_HOME}/home/exists), child processes receiveHOME={HERMES_HOME}/home/for tool config isolation (git, ssh, gh, npm). However, scripts usingPath.home()to locate~/.hermes/would incorrectly resolve to the isolated profile home, breaking helpers and custom tooling.Before
After
Changes
New
get_real_home()helper inhermes_constants.py— resolves the actual user home independently of profile isolation:HERMES_REAL_HOMEenv →HOMEenv →expanduser("~")→/tmp4 subprocess spawners now inject
HERMES_REAL_HOMEalongside the profileHOME:tools/code_execution_tool.py(execute_code)tools/environments/local.py(terminal background + run_env)agent/copilot_acp_client.py(Copilot ACP)Usage pattern for skill helpers
Testing
get_real_home()(HOME env, HERMES_REAL_HOME priority, expanduser fallback, /tmp fallback)Files changed
hermes_constants.pyget_real_home()helper + update docstringtools/code_execution_tool.pyHERMES_REAL_HOMEin child_envtools/environments/local.pyHERMES_REAL_HOME(2 locations)agent/copilot_acp_client.pyHERMES_REAL_HOMEin subprocess envtests/test_subprocess_real_home.pyCloses #25114