Skip to content

The agent that grows with you

fix(tts): resolve command-provider env_passthrough through the profile secret scope

John Paul Soliva1df4af417ff1
diff --git a/tests/tools/test_tts_command_providers.py b/tests/tools/test_tts_command_providers.py
index b8dcee13307..daf11c3a95c 100644
--- a/tests/tools/test_tts_command_providers.py
+++ b/tests/tools/test_tts_command_providers.py
@@ -139,6 +139,23 @@ class TestCommandTtsEnv:
assert env["MY_SAFE_TTS_VAR"] == "keep"
+ def test_env_passthrough_forwards_the_served_profiles_value(self, monkeypatch):
+ """Under the multiplexer os.environ holds the launch profile's .env; a served profile's
+ command provider must get its own declared key, never the launch profile's."""
+ from agent import secret_scope as ss
+
+ monkeypatch.setenv("MY_TTS_TOKEN", "tok-launch")
+ command = _shell_command(sys.executable, "-c", "import os; print(os.environ.get('MY_TTS_TOKEN'))")
+ ss.set_multiplex_active(True)
+ token = ss.set_secret_scope({"MY_TTS_TOKEN": "tok-work"})
+ try:
+ result = _run_command_tts(command, timeout=30, env_passthrough=["MY_TTS_TOKEN"])
+ finally:
+ ss.reset_secret_scope(token)
+ ss.set_multiplex_active(False)
+
+ assert result.stdout.strip() == "tok-work"
+
class TestGetNamedProviderConfig:
def test_providers_block_wins(self):
cfg = {"providers": {"voxcpm": {"command": "new"}},
diff --git a/tools/tts_command_provider.py b/tools/tts_command_provider.py
index 7f0d315b6a6..7cd7762eaa4 100644
--- a/tools/tts_command_provider.py
+++ b/tools/tts_command_provider.py
@@ -140,10 +140,13 @@ def run_command_provider(
provider survives, a silently stalled one is killed. Child env is scrubbed of Hermes secrets
while propagating delegated-child lineage markers."""
from agent.delegation_context import delegated_child_subprocess_env
+ from tools.env_passthrough import resolve_passthrough_value
from tools.environments.local import hermes_subprocess_env
scrubbed = hermes_subprocess_env(inherit_credentials=False)
for key in env_passthrough or []:
- value = os.environ.get(key)
+ # Under the multiplexer os.environ is the LAUNCH profile's .env: resolve through the served
+ # profile's secret scope so its own key is forwarded and never another profile's.
+ value = resolve_passthrough_value(key, os.environ.get(key))
if value is not None:
scrubbed[key] = value
# Own process group so the whole tree can be signalled on idle timeout. Lossy UTF-8 decode: