diff --git a/hermes_cli/config.py b/hermes_cli/config.py index 0b2868fa..eabbcc30 100644 --- a/hermes_cli/config.py +++ b/hermes_cli/config.py @@ -815,6 +815,19 @@ def set_config_value(key: str, value: str): with open(config_path, 'w') as f: yaml.dump(user_config, f, default_flow_style=False, sort_keys=False) + # Keep .env in sync for keys that terminal_tool reads directly from env vars. + # config.yaml is authoritative, but terminal_tool only reads TERMINAL_ENV etc. + _config_to_env_sync = { + "terminal.backend": "TERMINAL_ENV", + "terminal.docker_image": "TERMINAL_DOCKER_IMAGE", + "terminal.singularity_image": "TERMINAL_SINGULARITY_IMAGE", + "terminal.modal_image": "TERMINAL_MODAL_IMAGE", + "terminal.cwd": "TERMINAL_CWD", + "terminal.timeout": "TERMINAL_TIMEOUT", + } + if key in _config_to_env_sync: + save_env_value(_config_to_env_sync[key], str(value)) + print(f"✓ Set {key} = {value} in {config_path}") diff --git a/hermes_cli/setup.py b/hermes_cli/setup.py index 06022681..8b725b72 100644 --- a/hermes_cli/setup.py +++ b/hermes_cli/setup.py @@ -1015,6 +1015,14 @@ def run_setup_wizard(args): print_success("Terminal set to SSH") # else: Keep current (selected_backend is None) + # Sync terminal backend to .env so terminal_tool picks it up directly. + # config.yaml is the source of truth, but terminal_tool reads TERMINAL_ENV. + if selected_backend: + save_env_value("TERMINAL_ENV", selected_backend) + docker_image = config.get('terminal', {}).get('docker_image') + if docker_image: + save_env_value("TERMINAL_DOCKER_IMAGE", docker_image) + # ========================================================================= # Step 5: Agent Settings # =========================================================================