Skip to content

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

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

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

Conversation

@cameronhotchkies

@cameronhotchkies cameronhotchkies commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

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
@cameronhotchkies
cameronhotchkies force-pushed the fix/1743-relay-offline-notice branch 2 times, most recently from 71b20b5 to 9d5fa13 Compare July 30, 2026 18:05
@cameronhotchkies

Copy link
Copy Markdown
Collaborator Author

🦾 Addressed the requested changes at 9d5fa132:

  1. Explicit mentions vs. reply metadata: the sender now emits dedicated ["mention", "<pubkey>"] reference tags. The relay ignores structural p tags, limits this behavior to kind 9, excludes self-mentions, deduplicates, and caps the set.
  2. Visible Desktop handling: WebSocket NOTICE frames are consumed and surfaced as warning toasts. Explicit mention sends remain on the established WebSocket path, preserving DM expansion and relay notice handling.
  3. Cross-pod semantics: presence is read from the workspace-scoped Redis presence store. The implementation and notice text explicitly describe this as current Buzz presence and best-effort—not delivery proof. Lookup failure suppresses the warning rather than producing a false offline result.
  4. Tests: added focused relay tests for accepted-only behavior, kind restriction, explicit mention vs. reply-author p tags, dedupe/self-exclusion/cap, and online/offline presence; added Desktop/Tauri tests for mention tags and visible NOTICE handling.

Fresh CI is still running on this SHA; I’ll post the re-review note only after it is green.

@cameronhotchkies

Copy link
Copy Markdown
Collaborator Author

🦾 Ready for re-review at 9d5fa132.

The requested mention semantics, cross-pod presence handling, Desktop NOTICE UX, and focused tests are addressed. Fresh CI is green: 28 successful, 4 skipped, 0 failed. In particular, Desktop Smoke E2E shards 1–4, Desktop rollup, Desktop Core, Desktop E2E Relay/Integration, Rust lint/unit tests, macOS build, cross-compiles, security, Semgrep, zizmor, and DCO all passed.

Remaining risk: the warning deliberately reports best-effort workspace Redis presence, not guaranteed subscription delivery; the relay skips warnings if the presence lookup itself fails.

cameronhotchkies and others added 2 commits July 30, 2026 11:52
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
Keep explicit mention-only sends on the normal WebSocket path so DM expansion and relay NOTICE handling remain observable. Keep the relay client within the file-size ratchet.

Co-authored-by: npub1x4hk035p3p9q39a3fcrd2fe30lpkrhr5dwe0cqzzjphxyyh8m0gsq4vqap <356f67c681884a0897b14e06d527317fc361dc746bb2fc0042906e6212e7dbd1@buzz.block.builderlab.xyz>
Signed-off-by: npub1x4hk035p3p9q39a3fcrd2fe30lpkrhr5dwe0cqzzjphxyyh8m0gsq4vqap <356f67c681884a0897b14e06d527317fc361dc746bb2fc0042906e6212e7dbd1@buzz.block.builderlab.xyz>
Ai-assisted: true
@cameronhotchkies
cameronhotchkies force-pushed the fix/1743-relay-offline-notice branch 2 times, most recently from 9d5fa13 to 92c5833 Compare July 30, 2026 19:04
@cameronhotchkies cameronhotchkies added the triage-ready Appropriate for agentic review label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage-ready Appropriate for agentic review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants