diff --git a/tests/gateway/test_drain_active_work_report.py b/tests/gateway/test_drain_active_work_report.py index 8e8568b459..33d3c14b50 100644 --- a/tests/gateway/test_drain_active_work_report.py +++ b/tests/gateway/test_drain_active_work_report.py @@ -11,6 +11,7 @@ import cron.scheduler as sched from gateway.run import GatewayRunner from gateway.session_state import SessionState from hermes_cli.update_cmd_drain_report import drain_progress_reporter +from gateway.status import flush_runtime_status class _FakeAgent: @@ -39,6 +40,7 @@ def test_draining_status_names_chat_and_cron_units_and_clears_when_running(tmp_p with sched._running_lock: sched._running_worker_pids["job-a"] = 4242 runner._update_runtime_status("draining") + flush_runtime_status() record = json.loads((tmp_path / "gateway_state.json").read_text()) by_kind = {unit["kind"]: unit for unit in record["active_work"]} assert by_kind["chat"]["session"] == "telegram:dm:1" and by_kind["chat"]["current_tool"] == "terminal" @@ -48,6 +50,7 @@ def test_draining_status_names_chat_and_cron_units_and_clears_when_running(tmp_p sched.release_running_job("job-a") assert sched.get_running_job_details() == [] runner._update_runtime_status("running") + flush_runtime_status() assert json.loads((tmp_path / "gateway_state.json").read_text())["active_work"] is None diff --git a/tests/gateway/test_multiplex_adapter_registry.py b/tests/gateway/test_multiplex_adapter_registry.py index 4a0d3e1c70..10db982644 100644 --- a/tests/gateway/test_multiplex_adapter_registry.py +++ b/tests/gateway/test_multiplex_adapter_registry.py @@ -13,6 +13,7 @@ import pytest import gateway.run as gateway_run from gateway.config import GatewayConfig, Platform, PlatformConfig from gateway.run import GatewayRunner +from gateway.status import flush_runtime_status class _FakeAdapter: @@ -880,6 +881,7 @@ class TestSecondaryProfileConfigHandling: runner.config = GatewayConfig(multiplex_profiles=False) assert await runner._start_secondary_profile_adapters() == 0 + flush_runtime_status() assert read_runtime_status(tmp_path / "gateway_state.json")["served_profiles"] == [] @pytest.mark.asyncio diff --git a/tests/gateway/test_multiplex_hot_serve.py b/tests/gateway/test_multiplex_hot_serve.py index 3f1f1674dc..ab5fda4e82 100644 --- a/tests/gateway/test_multiplex_hot_serve.py +++ b/tests/gateway/test_multiplex_hot_serve.py @@ -15,6 +15,7 @@ import pytest from gateway.config import GatewayConfig, Platform from gateway.run import GatewayRunner from gateway.run_profile_reconcile import profile_serve_signature +from gateway.status import flush_runtime_status class _Adapter: @@ -75,6 +76,7 @@ def _mkprofile(home, name, env=""): def _served_record(home): + flush_runtime_status() return json.loads((home / "gateway_state.json").read_text(encoding="utf-8")).get("served_profiles") diff --git a/tests/gateway/test_multiplex_shared_ingress.py b/tests/gateway/test_multiplex_shared_ingress.py index 299dc3a78b..72334e27d0 100644 --- a/tests/gateway/test_multiplex_shared_ingress.py +++ b/tests/gateway/test_multiplex_shared_ingress.py @@ -125,7 +125,7 @@ async def test_prefixed_line_webhook_is_verified_by_the_named_profiles_secret_un async def test_shared_listener_adapter_records_its_public_ingress_url(mux_home, monkeypatch): """Runtime status carries the /p// URL so `gateway status` / the dashboard can show it.""" writes: list[dict] = [] - monkeypatch.setattr("gateway.status.write_runtime_status", lambda **kw: writes.append(kw)) + monkeypatch.setattr("gateway.status.publish_runtime_status", lambda **kw: writes.append(kw)) coder = _line_adapter("secret-coder", "coder") coder._runtime_status_platform_key = "coder:line" runner = _Runner({"coder": {Platform("line"): coder}})