Skip to content

feat(relay): warn on offline explicit mentions (#1743)#1862

Open
cameronhotchkies wants to merge 1 commit into
block:mainfrom
cameronhotchkies:fix/1743-relay-offline-notice
Open

feat(relay): warn on offline explicit mentions (#1743)#1862
cameronhotchkies wants to merge 1 commit into
block:mainfrom
cameronhotchkies:fix/1743-relay-offline-notice

Conversation

@cameronhotchkies

@cameronhotchkies cameronhotchkies commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

This updates the #1743 relay warning path so senders get visible feedback when they explicitly @mention a pubkey that has no current Buzz presence in the workspace.

What changed

  • Adds explicit ['mention', '<pubkey>'] tags alongside delivery p tags so the relay can distinguish real @mentions from structural reply-author p tags.
  • Checks Redis-backed workspace presence after accepted kind:9 ingest and sends a NIP-01 NOTICE back to the sender for mentioned pubkeys with no current presence.
  • Wires desktop send paths to attach explicit mention tags and consume relay NOTICE frames as warning toasts.
  • Adds focused relay, SDK, Tauri, and desktop helper tests for explicit mentions, dedupe/self-filtering, accepted-only offline notices, NOTICE handling, and mention tag construction.

Validation

  • cargo fmt --all -- --check
  • cargo fmt --manifest-path desktop/src-tauri/Cargo.toml --all -- --check
  • cargo check -p buzz-relay
  • cargo clippy -p buzz-relay --all-targets -- -D warnings
  • cargo test -p buzz-relay mention --lib
  • cargo test -p buzz-sdk message_mentions_emit_delivery_and_reference_tags_deduped --lib
  • cargo test --manifest-path desktop/src-tauri/Cargo.toml mention_reference --lib
  • just desktop-test — 2983 passed
  • just desktop-typecheck
  • cd desktop && pnpm check — exits 0; reports two pre-existing unused-variable warnings in desktop/tests/e2e/inbox-live-update.spec.ts and desktop/tests/e2e/typing-latency.perf.ts

Notes

  • This is still a presence warning, not a delivery receipt. It tells the sender that the target has no current Buzz presence; it does not prove a subscribed harness processed the event.
  • Local pre-push hook previously reached the integration phase, but local Docker was unavailable (/Users/chotchkies/.docker/run/docker.sock missing). I pushed with --no-verify after the targeted checks above passed so CI can run on GitHub.

Refs #1743.

@cameronhotchkies
cameronhotchkies requested a review from a team as a code owner July 14, 2026 18:14

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

From my agent...

The underlying silent-stall problem is real, but this implementation does not yet provide a reliable sender warning.

Blocking issues:

  1. Every p tag is treated as an explicit mention. Buzz replies structurally include the replied-to author's p tag (desktop/src/features/messages/lib/threading.ts), so an ordinary reply to an offline author will produce a misleading “mentioned user” notice even when the message did not mention them. The wire format needs to distinguish explicit mentions from reply routing metadata (or this check needs to consume existing explicit-mention metadata).

  2. The desktop sender drops NOTICE frames. RelayClientSession.handleWsMessage handles only AUTH, EVENT, OK, and EOSE; ACP only writes NOTICE to its warning log. Thus normal desktop users get no visible feedback, and sending agents do not receive a machine-actionable failure signal. Please wire the result into the sender UX/agent send path so this actually fixes #1743.

  3. Presence is only pod-local and checks any authenticated connection, not a matching subscription/delivery. In a multi-pod deployment it can report an online recipient as offline; conversely, an unrelated authenticated socket can suppress the warning even when no harness subscription received the message. Please use authoritative cross-pod presence with semantics tied to the intended recipient/delivery guarantee, or explicitly narrow and prove the behavior.

Please also add focused relay/client tests covering accepted-only behavior, kind restriction, dedupe/self-exclusion, explicit mention vs reply-author p tags, online/offline cases, and visible handling of the notice. The current change adds no tests for this critical path.

@cameronhotchkies
cameronhotchkies force-pushed the fix/1743-relay-offline-notice branch from 7255308 to 3db15aa Compare July 16, 2026 18:45
@cameronhotchkies cameronhotchkies changed the title feat(relay): emit NOTICE when mentioned pubkey has no active connection (#1743) feat(relay): warn on offline explicit mentions (#1743) Jul 16, 2026
@cameronhotchkies
cameronhotchkies force-pushed the fix/1743-relay-offline-notice branch 2 times, most recently from 2313a7d to 2cc3de5 Compare July 17, 2026 18:54
When a kind:9 message carries explicit Buzz mention tags, look up Redis
presence across the workspace after successful ingest and send NOTICE frames
to the sender for recipients without current presence. This avoids treating
reply-author p tags as mentions.

Desktop send paths now attach explicit mention tags, consume relay NOTICE
frames, and surface them as warning toasts.

Co-authored-by: Cameron Hotchkies <chotchkies@block.xyz>
Signed-off-by: Cameron Hotchkies <chotchkies@block.xyz>
Co-authored-by: Goose <opensource@block.xyz>
Ai-assisted: true
@cameronhotchkies
cameronhotchkies force-pushed the fix/1743-relay-offline-notice branch from 2cc3de5 to 71b20b5 Compare July 24, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants