fix(gateway): harden shared client lifecycle

This commit is contained in:
Xubin Ren
2026-08-17 20:56:10 +08:00
parent 19be5be1c0
commit cd6a11b3c5
11 changed files with 468 additions and 34 deletions
+8
View File
@@ -1977,6 +1977,12 @@ def _patch_webui_managed_gateway(
)
return RuntimeResult(True, "gateway_started_background", status)
def start_on_demand(self, options):
from nanobot.gateway import GatewayClientLease
GatewayClientLease(self, kind="test-webui").mark_ephemeral()
return self.start_background(options)
def status(self):
return SimpleNamespace(running=self.running)
@@ -2528,6 +2534,8 @@ def test_webui_foreground_attaches_to_existing_managed_gateway(monkeypatch, tmp_
status=SimpleNamespace(log_path=self.paths.log_path),
)
start_on_demand = start_background
def restart(self, options, *, timeout_s: int):
seen["restart_options"] = options
seen["restart_timeout"] = timeout_s