Skip to content

fix(desktop): hydrate reactions for Inbox context messages#1596

Merged
wesbillman merged 2 commits into
mainfrom
brain-inbox-reactions
Jul 7, 2026
Merged

fix(desktop): hydrate reactions for Inbox context messages#1596
wesbillman merged 2 commits into
mainfrom
brain-inbox-reactions

Conversation

@wesbillman

Copy link
Copy Markdown
Collaborator

Problem

Adding a reaction from the Inbox looked broken: the emoji burst played and the pill appeared, then vanished ~1s later. Nothing seemed stored.

The kind:7 event was stored on the relay all along — the write path is identical to the channel view. The failure was on the read path: reactions carry only an #e reference (no channel tag), so the channel-window query never returns them for thread replies, and the Inbox — unlike the channel view — had no reaction hydration step. Its post-toggle refetch came back reaction-less and clobbered the optimistic pill.

Fix

  • useInboxThreadContext now fetches kind:7 events by #e reference for the rendered context messages (same buildChannelReactionAuxFilter path the channel view uses) and exposes refreshReactions.
  • HomeView merges those hydrated reaction events into the reaction pass and refreshes them after a toggle, so the refetch confirms the pill instead of clobbering it.

Test

New smoke e2e (inbox-reactions.spec.ts) reproduces the exact reported shape — a thread-reply mention reacted to from the Inbox detail pane — and asserts the pill survives both the post-toggle refetch and a full re-select (all optimistic state dropped). Supporting mock-bridge changes: #e-keyed aux filters are served across channel stores like the real relay, and emitted mock messages can carry a 64-hex id (required to be a valid reaction target).

Verified: typecheck, biome check, 1953 unit tests, full smoke suite (391 passed; the 2 failures — channels scroll-intro, custom-emoji edit — fail identically on the parent commit without this change).

Reactions added from the Inbox looked like they failed: the optimistic
pill appeared, then vanished on the next refetch. The kind:7 event was
stored on the relay all along — but the Inbox read path never fetched
reactions for thread replies, which the channel-window query does not
carry, so the refetch clobbered the pill with reaction-less data.

Give the Inbox the same `#e`-referenced reaction hydration the channel
view uses (buildChannelReactionAuxFilter), and refresh it after a
toggle. The mock bridge now serves `#e`-keyed aux filters across
channel stores like the real relay, and emitted mock messages can carry
a 64-hex id so they are valid reaction targets in tests.

Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Wes <wesbillman@users.noreply.github.com>
@wesbillman

Copy link
Copy Markdown
Collaborator Author

Screenshots (from the new e2e, fix applied)

Reaction added from the Inbox detail pane — pill persists after the post-toggle refetch (this is the moment it used to vanish):

pill persists after refetch

Item re-selected, all optimistic state dropped — pill renders purely from fetched relay data:

pill persists after re-select

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewed on behalf of Wes. LGTM with two non-blocking notes.

Verified:

  • Fix reuses the channel view's exact hydration primitives (fetchAuxEventsByReference + buildChannelReactionAuxFilter, the #e-keyed/no-#h filter) — the Inbox was the only reaction consumer without this step, so the diagnosis and the fix location line up.
  • Remove path: kind:5 soft-deletes the reaction server-side, so the awaited refreshReactions()refetch() sequence correctly drops the pill; no resurrection from stale cache.
  • Duplicate merge of channelMessages + hydrated reactionEvents is safe: formatTimelineMessages dedupes presence on targetId:actor:emoji (covered by an existing unit test).
  • Merge-base is current main tip.
  • CI red is only scroll-history.spec.ts:1546 on Smoke shard 4 — the identical test failed on a plain-main run today (run 28881441134). Pre-existing flake; shard re-run should clear it.

Non-blocking:

  1. fetchReactions's bare catch { return null } — a console.error (as renderScopedReactions.ts does) would make the next read-path failure findable; this bug was born from a swallowed error.
  2. The e2e re-select dance is a little magical; selecting a genuinely different item (or a comment) would make the "purely from relay data" assertion more robust.

Separate follow-up (pre-existing on main, not this PR): canReact still allows reacting on kind 45001/45003 summary items while canReply excludes them.

- Log fetchReactions failures instead of swallowing them silently
- e2e: switch selection to a genuinely different inbox item before
  re-selecting, instead of the filter-trigger/Escape dance

Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Wes <wesbillman@users.noreply.github.com>
@wesbillman wesbillman merged commit cdf982b into main Jul 7, 2026
25 checks passed
@wesbillman wesbillman deleted the brain-inbox-reactions branch July 7, 2026 19:29
tellaho added a commit that referenced this pull request Jul 7, 2026
…ivity

* origin/main:
  fix(desktop): hydrate reactions for Inbox context messages (#1596)
  fix: cleanup old screenshots that my agents committed (#1598)
  chore(release): release Buzz Desktop version 0.3.46 (#1585)
  fix(desktop): preserve agent model/provider when persona snapshot fields are blank (#1583)
  feat(acp,desktop): identify and reap stale agent harness processes (#1582)
  feat(desktop): active-draft badge, send-from-drafts confirm dialog, thread-deleted state (#1581)
  fix(desktop): treat baked build env vars as satisfying required agent config (#1580)
  feat(desktop): add "Copy image" to image right-click context menu (#1579)
  fix(nest): use buzz-dev symlink name for dev builds (#1587)
  fix(composer): address image-editor follow-up nits on #1491 (#1565)
  fix(desktop): render black static boot screen (#1570)
  feat(agents): group activity tool bursts (#1571)
  feat(desktop): aggregated overview rail, commit detail page, and full breadcrumbs (#1573)
  fix(desktop): fetch profiles for reaction actors and thread-reply authors (#1550)
  refactor(desktop): unify EditAgentDialog styling with PersonaDialog (#1540)
  feat(desktop): add 10-minute message grouping window (#1578)
  feat(desktop): unify sidebar section actions into a per-section ⋮ menu (#1577)
  feat(desktop): emoji avatar picker for agents + reliable picker scroll (#1576)

Co-authored-by: Taylor Ho <taylorkmho@gmail.com>
Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
tlongwell-block pushed a commit that referenced this pull request Jul 7, 2026
* origin/main:
  docs(readme): add Getting started section routing install paths (#1606)
  fix(desktop): restrict shared-agent sync to dev data dirs (#1597)
  feat(desktop): restart-required badge from spawn-time config hash (#1602)
  feat(desktop): boot-time reconcile of managed agents to relay events (#1601)
  feat(desktop): canonical <PubKey> component — hover to view/copy full keys, owner "you" labels (#1589)
  fix(desktop): hydrate reactions for Inbox context messages (#1596)
  fix: cleanup old screenshots that my agents committed (#1598)
  chore(release): release Buzz Desktop version 0.3.46 (#1585)
  fix(desktop): preserve agent model/provider when persona snapshot fields are blank (#1583)
  feat(acp,desktop): identify and reap stale agent harness processes (#1582)
  feat(desktop): active-draft badge, send-from-drafts confirm dialog, thread-deleted state (#1581)
  fix(desktop): treat baked build env vars as satisfying required agent config (#1580)
  feat(desktop): add "Copy image" to image right-click context menu (#1579)
  fix(nest): use buzz-dev symlink name for dev builds (#1587)
  fix(composer): address image-editor follow-up nits on #1491 (#1565)
  fix(desktop): render black static boot screen (#1570)
  feat(agents): group activity tool bursts (#1571)
  feat(desktop): aggregated overview rail, commit detail page, and full breadcrumbs (#1573)
  fix(desktop): fetch profiles for reaction actors and thread-reply authors (#1550)
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