Skip to content

fix(agent): preserve real HOME for session tools#38107

Open
sweetcornna wants to merge 1 commit into
NousResearch:mainfrom
sweetcornna:codex/fix-36144-session-home
Open

fix(agent): preserve real HOME for session tools#38107
sweetcornna wants to merge 1 commit into
NousResearch:mainfrom
sweetcornna:codex/fix-36144-session-home

Conversation

@sweetcornna

@sweetcornna sweetcornna commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #36144.

Summary

  • keep host tool subprocesses on the user's real HOME so git, ssh, gh, npm, az, and similar CLIs can find existing credentials/config
  • repair HOME back to the OS account home when the parent process already points at a Hermes profile home, with HERMES_REAL_HOME as an explicit override
  • add Windows fallback repair through USERPROFILE and HOMEDRIVE/HOMEPATH when Unix pwd is unavailable
  • preserve Docker/Podman behavior by continuing to use {HERMES_HOME}/home inside containers for persistent tool state
  • update local env, code execution, ACP child env, profile docs, CLI tips, and regression coverage
  • isolate strict API validation tests from live provider metadata lookups so CI does not depend on api.fireworks.ai

Verification

  • .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 -> passed
  • git diff --check -> passed

Note: the broader local Windows run that also included tests/tools/test_local_env_blocklist.py and all of tests/test_hermes_constants.py still 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.

@sweetcornna sweetcornna force-pushed the codex/fix-36144-session-home branch from e80f0b7 to aba6a4a Compare June 3, 2026 10:16
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent loop, run_agent.py, prompt builder comp/cli CLI entry point, hermes_cli/, setup wizard tool/code-exec execute_code sandbox comp/acp Agent Communication Protocol adapter P2 Medium — degraded but workaround exists labels Jun 3, 2026
@sweetcornna sweetcornna force-pushed the codex/fix-36144-session-home branch from aba6a4a to 7d1155a Compare June 4, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/acp Agent Communication Protocol adapter comp/agent Core agent loop, run_agent.py, prompt builder comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists tool/code-exec execute_code sandbox type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent session HOME points to wrong path — tools look in hermes profile instead of user's actual home

2 participants