refactor(tui-gateway): lazy resume reattaches through _rebind_live_transport

_resume_live_unpersisted hand-rolled the same transport + viewers + reap-cancel
sequence _rebind_live_transport now owns. Route it through the helper; the
stdio case (no current transport) keeps cancelling the reap as before.
This commit is contained in:
kshitijk4poor
2026-09-06 14:00:08 +05:30
committed by kshitij
parent c6cb7111a2
commit 212ed99d96
+3 -3
View File
@@ -529,9 +529,9 @@ def _resume_live_unpersisted(ctx: _Resume, live_sid: str, live: dict) -> dict:
live["last_active"] = time.time()
if (transport := current_transport()) is not None:
with live.setdefault("history_lock", threading.Lock()):
live["transport"] = transport
live.setdefault("viewers", {})[transport] = time.time()
_cancel_ws_orphan_reap(live_sid)
_rebind_live_transport(live_sid, live, transport)
else:
_cancel_ws_orphan_reap(live_sid)
history = live.get("history") or []
return _ok(ctx.rid, _attach_todo_state({
"session_id": live_sid, "stored_session_id": str(live.get("session_key") or ""),