Skip to content

fix: stabilize BlueBubbles webhook handling - #43672

Open
bryangauvin wants to merge 1 commit into
NousResearch:mainfrom
bryangauvin:codex/bluebubbles-webhook-stability
Open

fix: stabilize BlueBubbles webhook handling#43672
bryangauvin wants to merge 1 commit into
NousResearch:mainfrom
bryangauvin:codex/bluebubbles-webhook-stability

Conversation

@bryangauvin

Copy link
Copy Markdown

Summary

  • avoid registering/unregistering the BlueBubbles webhook for outbound-only sends
  • dedupe repeated inbound webhook deliveries by message id and sender/text fallback
  • suppress user-visible title-generation auxiliary warnings while preserving warnings for other auxiliary failures

Verification

  • uv run --extra dev python -m pytest tests/gateway/test_bluebubbles.py tests/run_agent/test_auxiliary_failure_visibility.py

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery labels Jun 10, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

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 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:1039 treats 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-1023 suppresses title-generation warnings, but the current title generator explicitly wires failures to AIAgent._emit_auxiliary_failure so users see them (agent/title_generator.py:64-67, 112-114), with regression coverage at tests/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):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread run_agent.py
detail = (detail or exc.__class__.__name__).strip()
if len(detail) > 220:
detail = detail[:217].rstrip() + "..."
if task.strip().lower() == "title generation":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants