The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tools): scope-only passthrough overlay raises instead of silently dropping the declared secret
teknium1547fff75003a
diff --git a/tests/tools/test_env_passthrough.py b/tests/tools/test_env_passthrough.pyindex 00d19f991b0..8ad562e3128 100644--- a/tests/tools/test_env_passthrough.py+++ b/tests/tools/test_env_passthrough.py@@ -278,6 +278,22 @@ class TestTerminalIntegration:assert "SERVICE_TOKEN" not in _sanitize_subprocess_env(dict(base))assert "SERVICE_TOKEN" not in _scrub_child_env(dict(base))+ def test_scope_overlay_failure_is_loud_on_both_local_surfaces(self, monkeypatch):+ """A scope/config failure while resolving declared scope-only names must raise, not be+ swallowed into a debug log that silently drops the declared secret again (#114209)."""+ import tools.env_passthrough as ep+ from tools.code_execution_env import _scrub_child_env+ from tools.environments.local import _sanitize_subprocess_env++ def _boom(_present):+ raise RuntimeError("scope lookup failed")++ monkeypatch.setattr(ep, "scoped_passthrough_additions", _boom)+ with pytest.raises(RuntimeError, match="scope lookup failed"):+ _sanitize_subprocess_env({"PATH": "/usr/bin"})+ with pytest.raises(RuntimeError, match="scope lookup failed"):+ _scrub_child_env({"PATH": "/usr/bin"})+def test_shared_local_snapshot_re_resolves_current_profile(self, monkeypatch, tmp_path):"""A persistent shell snapshot must not retain the previous profile's value."""from tools.environments.local import LocalEnvironmentdiff --git a/tools/environments/local.py b/tools/environments/local.pyindex 10969119854..5cede7739a2 100644--- a/tools/environments/local.py+++ b/tools/environments/local.py@@ -285,11 +285,10 @@ def _scrubbed_env(parts, plugin_strip: frozenset, fix_path) -> dict:_filter_secret_env(items, out, unwrap_force=unwrap_force, plugin_strip=plugin_strip)# Declared names the bound profile scope holds but the process env never did (a routed# profile's own .env / sources) — the filter above can only see names already present.- try:- from tools.env_passthrough import scoped_passthrough_additions- out.update((k, v) for k, v in scoped_passthrough_additions(out).items() if k not in plugin_strip)- except Exception:- logger.debug("Could not resolve scope-only passthrough names", exc_info=True)+ # Unguarded on purpose: a scope/config failure here must be loud, not silently drop the+ # declared secret again (#114209); _scrub_child_env calls it the same way.+ from tools.env_passthrough import scoped_passthrough_additions+ out.update((k, v) for k, v in scoped_passthrough_additions(out).items() if k not in plugin_strip)path_key = _path_env_key(out)# Keep bare ``hermes`` invocations available to child jobs even when the gateway was launched by a# service manager or cron without the console script's directory on PATH. The terminal environment