Skip to content

The agent that grows with you

test(child-env): fixture isolates the process-wide skill passthrough set

Brooklyn Nicholsone92da2f9064c
diff --git a/tests/tools/_child_env_fixtures.py b/tests/tools/_child_env_fixtures.py
index d17672948cf..3da2672c4fa 100644
--- a/tests/tools/_child_env_fixtures.py
+++ b/tests/tools/_child_env_fixtures.py
@@ -29,14 +29,20 @@ def child_env(monkeypatch, tmp_path):
from tools.environments import local
monkeypatch.setattr(local, "_read_terminal_shell_init_config", lambda: ([], False))
monkeypatch.setattr(env_passthrough, "_config_passthrough", {})
- token = env_passthrough._allowed_env_vars_var.set(set())
+ # The skill-registered allowlist is a process-wide set (see #90004): the
+ # registration must survive tool dispatch's copy_context() snapshots, so
+ # a ContextVar cannot back it. Save/restore the set contents instead of a
+ # ContextVar token so each test starts from an empty allowlist.
+ saved_allowed = set(env_passthrough._allowed_env_vars)
+ env_passthrough._allowed_env_vars.clear()
with patch.dict(os.environ, seed, clear=True):
try:
yield tmp_path
finally:
from tools.code_kernel import shutdown_all_kernels
shutdown_all_kernels()
- env_passthrough._allowed_env_vars_var.reset(token)
+ env_passthrough._allowed_env_vars.clear()
+ env_passthrough._allowed_env_vars.update(saved_allowed)
@pytest.fixture