Implemented the next missing parity slice around session env var subprocess merging.

Wires session_env_vars.py into agent_tools._build_subprocess_env so that
variables set via the session registry now reach spawned children, matching
utils/shell/bashProvider.ts:249. Per-call extra_env still wins so explicit
tool overrides take precedence over session defaults.
This commit is contained in:
Abdelrahman Abdallah
2026-04-20 00:51:11 +02:00
parent 66920a3360
commit 72e6fffb34
3 changed files with 42 additions and 1 deletions
+6
View File
@@ -15,6 +15,7 @@ from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Iterator, Union
from .agent_types import AgentPermissions, AgentRuntimeConfig, ToolExecutionResult
from .session_env_vars import get_session_env_vars
if TYPE_CHECKING:
from .account_runtime import AccountRuntime
@@ -3321,6 +3322,11 @@ def _build_subprocess_env(context: ToolExecutionContext) -> dict[str, str]:
for key, value in os.environ.items()
if not _is_sensitive_env_var(key)
}
# Mirror utils/shell/bashProvider.ts: session env vars (set via /env)
# apply to spawned children, layered above the parent env but below
# explicit per-call extras.
for key, value in get_session_env_vars().items():
env[key] = value
env.update(context.extra_env)
return env