From fc78f26c82cacf58a462f9d6a89f1aeba8758a3d Mon Sep 17 00:00:00 2001 From: "Matt Johnson (via Claude)" Date: Sun, 7 Jun 2026 06:57:11 +0000 Subject: [PATCH] fix(grouper): strip non-serializable values before persisting held events event.data can contain callables and internal _on_ callbacks that cause json.dumps to fail with TypeError. Filter these out before serializing to SQLite. Co-Authored-By: Claude Opus 4.6 --- meshai/notifications/pipeline/grouper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meshai/notifications/pipeline/grouper.py b/meshai/notifications/pipeline/grouper.py index 900fa8d..082bec5 100644 --- a/meshai/notifications/pipeline/grouper.py +++ b/meshai/notifications/pipeline/grouper.py @@ -70,10 +70,14 @@ class Grouper: try: import json from meshai.persistence import get_db + d = event.to_dict() + d["data"] = {k: v for k, v in d.get("data", {}).items() + if not callable(v) and not k.startswith("_on_")} + event_json = json.dumps(d) get_db().execute( "INSERT OR REPLACE INTO grouper_held(group_key, event_json, " "hold_until_at, updated_at) VALUES (?,?,?,?)", - (group_key, json.dumps(event.to_dict()), hold_until, self._now()), + (group_key, event_json, hold_until, self._now()), ) except Exception: self._logger.exception("grouper: persist failed key=%s", group_key)