From e787529064152e690b5d5678bd2efe761dda6213 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Sun, 20 Sep 2026 00:04:31 -0700 Subject: [PATCH] refactor: route the /loop wakeup send through _notif_submit The hand-rolled try/except around message.start + _run_prompt_submit duplicated _notif_submit, which already emits the start event, submits, and releases the claimed turn on failure (and logs why). One release path per claim site keeps the leak fix in one place. --- tui_gateway/session_notifications.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tui_gateway/session_notifications.py b/tui_gateway/session_notifications.py index 22e504a7ae..e6d8d5de31 100644 --- a/tui_gateway/session_notifications.py +++ b/tui_gateway/session_notifications.py @@ -189,12 +189,8 @@ def _notif_slash_loop_tick(rid: str, sid: str, session: dict, mgr, wakeup: str) if not _notif_claim_turn(session): mgr.abandon_tick() return - try: - _emit("message.start", sid) - _run_prompt_submit(rid, sid, session, payload["message"]) - except Exception: - _notif_release_turn(session) # the swallow below would otherwise leave the session busy for good - raise + # Releases the claim on failure: the swallow below would otherwise leave the session busy for good. + _notif_submit(rid, sid, session, payload["message"], "loop wakeup send failed") return except Exception: pass