fix(tui): a park claim is released even when the dequeue after it raises

The poller claimed parked events before the guarded try, so an exception from
take_ready between the claim and the try leaked the claimed copies' held marks,
and the ledger sweep then treated those delegations as live forever. Taking the
dequeue inside the try puts the claim under the same finally that releases it.
This commit is contained in:
Teknium committed 2026-11-01 22:04:17 -08:00
1 parent cbd71f33b1
commit ba18ab4d61
1 file changed
+4 -3
+4 -3
View File
@@ -794,10 +794,11 @@ def _notification_poller_scoped_loop(stop_event: threading.Event, sid: str, sess
# Addressed events parked while their owner was not live (notification_park): once this session proves it
# owns one, it is this session's to deliver, ahead of the shared queue.
parked = notification_park.claim(lambda evt: _session_owns_notification_event(sid, session, evt))
ready = take_ready(queue, 0 if parked else 0.5)
if not parked and not ready:
continue
ready = []
try:
ready = take_ready(queue, 0 if parked else 0.5)
if not parked and not ready:
continue
handle(parked + ready, None)
except Exception as exc:
# This thread is the session's only path to notifications, /loop, /heartbeat and its