fix: make profile subprocess HOME policy explicit
This commit is contained in:
@@ -1270,14 +1270,8 @@ def execute_code(
|
||||
child_env["TZ"] = _tz_name
|
||||
child_env.pop("HERMES_TIMEZONE", None)
|
||||
|
||||
# Per-profile HOME isolation: redirect system tool configs into
|
||||
# {HERMES_HOME}/home/ when that directory exists.
|
||||
from hermes_constants import get_subprocess_home
|
||||
_profile_home = get_subprocess_home()
|
||||
if _profile_home:
|
||||
child_env["HOME"] = _profile_home
|
||||
from hermes_constants import get_real_home
|
||||
child_env["HERMES_REAL_HOME"] = get_real_home()
|
||||
from hermes_constants import apply_subprocess_home_env
|
||||
apply_subprocess_home_env(child_env)
|
||||
|
||||
# Resolve interpreter + CWD based on execute_code mode.
|
||||
# - strict : today's behavior (sys.executable + tmpdir CWD).
|
||||
|
||||
@@ -227,13 +227,8 @@ def _sanitize_subprocess_env(base_env: dict | None, extra_env: dict | None = Non
|
||||
|
||||
_inject_context_hermes_home(sanitized)
|
||||
|
||||
# Per-profile HOME isolation for background processes (same as _make_run_env).
|
||||
from hermes_constants import get_subprocess_home
|
||||
_profile_home = get_subprocess_home()
|
||||
if _profile_home:
|
||||
sanitized["HOME"] = _profile_home
|
||||
from hermes_constants import get_real_home
|
||||
sanitized["HERMES_REAL_HOME"] = get_real_home()
|
||||
from hermes_constants import apply_subprocess_home_env
|
||||
apply_subprocess_home_env(sanitized)
|
||||
|
||||
return sanitized
|
||||
|
||||
@@ -389,15 +384,8 @@ def _make_run_env(env: dict) -> dict:
|
||||
|
||||
_inject_context_hermes_home(run_env)
|
||||
|
||||
# Per-profile HOME isolation: redirect system tool configs (git, ssh, gh,
|
||||
# npm …) into {HERMES_HOME}/home/ when that directory exists. Only the
|
||||
# subprocess sees the override — the Python process keeps the real HOME.
|
||||
from hermes_constants import get_subprocess_home
|
||||
_profile_home = get_subprocess_home()
|
||||
if _profile_home:
|
||||
run_env["HOME"] = _profile_home
|
||||
from hermes_constants import get_real_home
|
||||
run_env["HERMES_REAL_HOME"] = get_real_home()
|
||||
from hermes_constants import apply_subprocess_home_env
|
||||
apply_subprocess_home_env(run_env)
|
||||
|
||||
# Inject ContextVar-based session vars into subprocess env.
|
||||
# ContextVars don't propagate to child processes, so we bridge them here.
|
||||
|
||||
Reference in New Issue
Block a user