fix(agent): preserve real HOME for session tools#38107
Open
sweetcornna wants to merge 1 commit into
Open
Conversation
e80f0b7 to
aba6a4a
Compare
aba6a4a to
7d1155a
Compare
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.
Fixes #36144.
Summary
HOMEsogit,ssh,gh,npm,az, and similar CLIs can find existing credentials/configHOMEback to the OS account home when the parent process already points at a Hermes profile home, withHERMES_REAL_HOMEas an explicit overrideUSERPROFILEandHOMEDRIVE/HOMEPATHwhen Unixpwdis unavailable{HERMES_HOME}/homeinside containers for persistent tool stateapi.fireworks.aiVerification
.venv\\Scripts\\python.exe -m pytest tests/test_subprocess_home_isolation.py::TestGetSubprocessHome::test_profile_home_env_is_corrected_to_userprofile_when_pwd_unavailable -q --timeout-method=thread-> 1 passed after failing before the fix.venv\\Scripts\\python.exe -m pytest tests/test_subprocess_home_isolation.py::TestGetSubprocessHome tests/test_subprocess_home_isolation.py::TestSanitizeSubprocessEnvHomeInjection tests/test_subprocess_home_isolation.py::TestPythonProcessUnchanged -q --timeout-method=thread-> 14 passed.venv\\Scripts\\python.exe -m pytest tests/test_subprocess_home_isolation.py tests/agent/test_copilot_acp_client.py tests/tools/test_env_passthrough.py tests/tools/test_code_execution.py tests/tools/test_code_execution_modes.py tests/cron/test_cron_profile.py -q --timeout-method=thread-> 124 passed, 43 skipped.venv\\Scripts\\python.exe -m pytest tests/run_agent/test_strict_api_validation.py -q --timeout-method=thread-> 4 passed.venv\\Scripts\\python.exe -m ruff check hermes_constants.py hermes_cli/profiles.py hermes_cli/tips.py tools/environments/local.py tools/code_execution_tool.py agent/copilot_acp_client.py cron/scheduler.py tests/test_subprocess_home_isolation.py tests/agent/test_copilot_acp_client.py tests/cron/test_cron_profile.py tests/test_hermes_constants.py tests/run_agent/test_strict_api_validation.py-> passed.venv\\Scripts\\python.exe -m py_compile hermes_constants.py hermes_cli/profiles.py hermes_cli/tips.py tools/environments/local.py tools/code_execution_tool.py agent/copilot_acp_client.py cron/scheduler.py tests/test_subprocess_home_isolation.py-> passedgit diff --check-> passedNote: the broader local Windows run that also included
tests/tools/test_local_env_blocklist.pyand all oftests/test_hermes_constants.pystill has three environment/platform-specific failures unrelated to this diff: Homebrew PATH assertion on Windows, Windows native default Hermes root expectation, and symlink creation without Windows developer/admin privileges.