fix: stabilize BlueBubbles webhook handling - #43672
Conversation
|
Related: #32691 and #34183 (both "harden BlueBubbles webhook handling") — this is a competing fix in a saturated cluster. This PR: skip register/unregister for outbound-only sends, dedupe inbound by message id + sender/text fallback, suppress title-generation auxiliary warnings. #32691 has the broadest scope (port-conflict fallback + dedup + paragraph breaks); #34183 covers event-aware registration + DM dedup variants. Maintainer should pick one to consolidate. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for addressing a real BlueBubbles lifecycle problem: current main still calls BlueBubblesAdapter.connect() from the standalone sender (tools/send_message_tool.py:1806), and that path starts/registers the webhook (gateway/platforms/bluebubbles.py:275-295).
Problems
gateway/platforms/bluebubbles.py:1039treats the sender/text fallback as a duplicate even after seeing a new stable message ID. Two separate identical messages from the same sender within 90 seconds will drop the second delivery. The PR adds no dedupe behavior tests.run_agent.py:1021-1023suppresses title-generation warnings, but the current title generator explicitly wires failures toAIAgent._emit_auxiliary_failureso users see them (agent/title_generator.py:64-67,112-114), with regression coverage attests/agent/test_title_generator.py:164-178.
Suggested changes
- Prefer the stable message ID whenever available; restrict any id-less fallback so it cannot collapse separate user messages, and test both replay and same-text/different-ID cases.
- Keep the title-warning behavior out of this change unless its established failure-notification contract is intentionally revised.
Automated hermes-sweeper review.
| # Use sender/text as a fallback so one user message cannot fork into two | ||
| # Hermes sessions and send stale/old replies twice. | ||
| dedupe_keys.append(f"fallback:{sender}:{text}") | ||
| if any(self._seen_inbound_event(key) for key in dedupe_keys): |
There was a problem hiding this comment.
This checks the sender/text fallback even after recording a new stable ID. A user who sends the same text twice within 90 seconds gets the second, distinct message acknowledged and dropped. Use the ID exclusively when present; reserve a collision-safe fallback for id-less payloads.
| detail = (detail or exc.__class__.__name__).strip() | ||
| if len(detail) > 220: | ||
| detail = detail[:217].rstrip() + "..." | ||
| if task.strip().lower() == "title generation": |
There was a problem hiding this comment.
This reverses the existing title-generation contract: agent/title_generator.py invokes this callback so the user sees a failure warning, and tests/agent/test_title_generator.py:164-178 documents that regression requirement. Please keep this unrelated behavior unchanged.
Summary
Verification
uv run --extra dev python -m pytest tests/gateway/test_bluebubbles.py tests/run_agent/test_auxiliary_failure_visibility.py