Skip to content

The agent that grows with you

fix: retain distinct repeated watch notices in local consumers

Teknium0c42619c35d1
diff --git a/tests/gateway/test_watch_automation_identity.py b/tests/gateway/test_watch_automation_identity.py
index 126a02d19d6..50abad4e836 100644
--- a/tests/gateway/test_watch_automation_identity.py
+++ b/tests/gateway/test_watch_automation_identity.py
@@ -22,3 +22,6 @@ def test_watch_event_identity_survives_retry_but_not_another_hit():
assert identity != GatewayRunner._completion_delivery_identity(second)
assert GatewayRunner._completion_delivery_identity(disabled) not in (None, identity)
assert all(e['parent_session_id'] == session.parent_session_id for e in (first, second, disabled))
+ from tui_gateway.session_notifications import _notification_event_dedup_key
+ assert _notification_event_dedup_key(first) == _notification_event_dedup_key(json.loads(json.dumps(first)))
+ assert _notification_event_dedup_key(first) != _notification_event_dedup_key(second)
diff --git a/tui_gateway/session_notifications.py b/tui_gateway/session_notifications.py
index 16bbc795dc3..a9361b358b2 100644
--- a/tui_gateway/session_notifications.py
+++ b/tui_gateway/session_notifications.py
@@ -102,6 +102,8 @@ _DEDUP_EXTRA_FIELDS = {
def _notification_event_dedup_key(evt: dict) -> tuple:
"""UI-emission identity for a process notification event."""
evt_type = evt.get("type", "completion")
+ if evt_type in {"watch_match", "watch_disabled"} and evt.get("event_id"):
+ return (evt.get("session_id", ""), evt_type, evt["event_id"])
if evt_type == "async_delegation":
# No process session_id: else every completion keys as ("", "async_delegation") and the second is suppressed forever.
# An early per-task failure notice must not collapse with the batch's final result (nor with a sibling's notice).