The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(container): honor config.yaml multiplex_profiles at boot
1052326311ea9924b09c1f
diff --git a/hermes_cli/container_boot.py b/hermes_cli/container_boot.pyindex b0e9821b7b8..cc5c6ff0c02 100644--- a/hermes_cli/container_boot.py+++ b/hermes_cli/container_boot.py@@ -136,11 +136,23 @@ def reconcile_profile_gateways(# for every profile. Named slots must still be registered (so explicit# lifecycle management remains available), but booting them from their# persisted run intent would create additional multiplex owners.+ # Keep the boot reconciler aligned with the gateway that will own these+ # slots. The runtime resolver gives a recognized environment override+ # precedence over config.yaml and otherwise preserves the configured value.+ from gateway.config import load_gateway_configfrom utils import is_truthy_value- multiplex_profiles = is_truthy_value(- os.environ.get("GATEWAY_MULTIPLEX_PROFILES"),- )+ try:+ multiplex_profiles = load_gateway_config().multiplex_profiles+ except Exception:+ log.warning(+ "Unable to load gateway configuration during container boot; "+ "using the GATEWAY_MULTIPLEX_PROFILES override if set.",+ exc_info=True,+ )+ multiplex_profiles = is_truthy_value(+ os.environ.get("GATEWAY_MULTIPLEX_PROFILES"),+ )# Default profile — always register, even if nothing has ever# populated the root profile dir. The slot exists sodiff --git a/tests/hermes_cli/test_container_boot.py b/tests/hermes_cli/test_container_boot.pyindex 5838ffdb451..cb772eeb659 100644--- a/tests/hermes_cli/test_container_boot.py+++ b/tests/hermes_cli/test_container_boot.py@@ -128,6 +128,49 @@ def test_running_profile_is_registered_and_autostarted(tmp_path: Path) -> None:assert not (svc / "down").exists()+ "config_value,env_value,expected",+ [+ pytest.param("true", None, "registered", id="config-only-multiplex"),+ pytest.param("true", "false", "started", id="env-false-overrides-config"),+ ],+)+def test_boot_honors_config_multiplex_profiles(+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+ config_value: str,+ env_value: str | None,+ expected: str,+) -> None:+ """Container boot must resolve multiplex_profiles like the gateway does:+ config.yaml opt-in honored (#85413), env override keeps precedence."""+ scandir = tmp_path / "run-service"+ scandir.mkdir()+ _make_profile(tmp_path, "coder", state="running")+ (tmp_path / "config.yaml").write_text(+ f"multiplex_profiles: {config_value}\n",+ encoding="utf-8",+ )+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))+ if env_value is None:+ monkeypatch.delenv("GATEWAY_MULTIPLEX_PROFILES", raising=False)+ else:+ monkeypatch.setenv("GATEWAY_MULTIPLEX_PROFILES", env_value)++ actions = reconcile_profile_gateways(+ hermes_home=tmp_path,+ scandir=scandir,+ dry_run=False,+ )++ assert _named_actions(actions) == [ReconcileAction(+ profile="coder",+ prior_state="running",+ action=expected,+ )]+ assert (scandir / "gateway-coder" / "down").exists() is (expected == "registered")++def test_registered_profile_has_finish_script(tmp_path: Path) -> None:"""The finish script must be written so s6 stops restarting onfatal config errors (exit 78 → exit 125). See #51228."""@@ -299,5 +342,3 @@ def _write_lifecycle_sentinel(profile_dir: Path, payload: dict) -> None:(state_dir / "gateway.lifecycle.json").write_text(json.dumps(payload))--