The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(env-loader): split source_supplied_names() out of secret_source_names()
kshitijk4pooradf3948d768a
diff --git a/hermes_cli/env_loader.py b/hermes_cli/env_loader.pyindex 24f3baaa60a..e845cde9937 100644--- a/hermes_cli/env_loader.py+++ b/hermes_cli/env_loader.py@@ -125,11 +125,18 @@ def _record_supplied_names(report) -> set[str]:def secret_source_names() -> tuple[str, ...]:- """Every env-var name some profile's external secret source supplied (names only — the map is- process-wide, so a value must be resolved through the active profile's secret scope). Includes names- the source supplied but a pre-existing process value won (``skipped_existing``): the launch value- in ``os.environ`` is still not a routed profile's to inherit."""- return tuple(dict.fromkeys((*_SECRET_SOURCES, *sorted(_SOURCE_SUPPLIED_NAMES))))+ """Every env-var name some profile's external secret source APPLIED (names only — the map is+ process-wide, so a value must be resolved through the active profile's secret scope). Consumers that+ forward source values into a child (MCP stdio env) want exactly these; see ``source_supplied_names``+ for the wider set the routed-child scrub needs."""+ return tuple(_SECRET_SOURCES)+++def source_supplied_names() -> tuple[str, ...]:+ """Every env-var name an external source supplied for any home — applied, or lost to a pre-existing+ process value (``skipped_existing``). The launch value in ``os.environ`` is still not a routed+ profile's to inherit, so the strip must see the skipped names too."""+ return tuple(sorted(set(_SECRET_SOURCES) | _SOURCE_SUPPLIED_NAMES))def launch_dotenv_keys() -> frozenset[str]:diff --git a/tools/environments/local.py b/tools/environments/local.pyindex 353e0cd41e4..0945e233f2c 100644--- a/tools/environments/local.py+++ b/tools/environments/local.py@@ -473,12 +473,12 @@ def strip_launch_profile_env(env: dict, target_home: "str | Path | None" = None)# overlay puts back exactly the ones the target's own sources supply. The administrator-managed# .env is NOT residue: its values are policy for every profile (``_apply_managed_env`` applies# it last, with override, so it beats the user's own .env) — leave them in place.- from hermes_cli.env_loader import launch_dotenv_keys, managed_dotenv_keys, secret_source_names+ from hermes_cli.env_loader import launch_dotenv_keys, managed_dotenv_keys, source_supplied_namesmanaged_names = {key.upper() for key in managed_dotenv_keys()}residue_names = {key.upper() for key inset(load_env_file(launch_home / ".env")) | set(launch_dotenv_keys())- | set(TERMINAL_CONFIG_ENV_MAP.values()) | set(secret_source_names())+ | set(TERMINAL_CONFIG_ENV_MAP.values()) | set(source_supplied_names())if not _is_global_env(key.upper()) or key.upper().startswith("TERMINAL_")} - managed_namesfor key in [k for k in env if k.upper() in residue_names]:del env[key]