Skip to content

perf(mobile): read only changed custom emoji sets on reconnect - #9446

Merged
brow merged 2 commits into
mainfrom
tomb/mobile-custom-emoji-since
Nov 13, 2026
Merged

brow merged 2 commits into
mainfrom
tomb/mobile-custom-emoji-since

Conversation

@brow

@brow brow commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Once anything has read the custom emoji palette (opening any channel does), every reconnect refetches every member's kind 30030 emoji set. On Block's Builderlab that is 123 sets, about 1 MB, on every resume, though the sets rarely change. The provider also watched the whole session state, not just its status.

The palette now keeps the sets it has read per author and, on a reconnect, asks only for sets written since shortly before the previous read (since reaching back relayCrossDeviceSkewSeconds, the window the unread catch-up already uses for events other devices write). A newer set replaces the known one for its author, with the relay's order for a same-second tie (the lower event id wins); the palette is the union as before, recomputed only when a set changes, so a reconnect that brings nothing new republishes the identical list and rebuilds nothing. A community or account switch (a new relay client) starts over with a full read.

Two side benefits: the loaded palette stays visible while disconnected (before, it was empty until the full read finished, so :shortcode:s in visible messages briefly showed as text on resume), and the palette no longer refetches on every reconnect attempt during backoff, only on status changes.

Validation

Added test: the first read has no since; a reconnect with nothing new sends a since and keeps the palette as the identical list; a new member's set and a replaced set both arrive in the window and update it; a same-second replacement wins with a lower id and is ignored with a higher one. It fails without this change. Existing emoji picker tests pass; full mobile test suite and flutter analyze pass.

On an iPhone 12 mini signed in to Block's Builderlab (instrumented profile build): after opening a channel, a resume after 60 s in the background downloaded the 1 MB of sets again (kind 30030, 123 events). With this change the same resume sent the read with a since and got no events back, so the 1 MB was not downloaded again; the first read when opening the channel is unchanged (123 sets, 1 MB).

Regressions

A set removed with a NIP-09 deletion (rather than replaced) stays in the palette until the app restarts, since a deletion isn't a newer set. Buzz clients edit a set by replacing it (desktop removes a shortcode by republishing the set), so that only affects other clients, and desktop's emoji directory keeps deleted sets the same way. A set written by a device whose clock is more than 30 minutes behind is missed until restart, the same bound the unread catch-up accepts.

Every reconnect refetched every member's kind 30030 emoji set (about 1 MB on
Builderlab). Keep the sets read so far and ask only for sets written since
shortly before the previous read. Watch only the session status, not the
whole session state.

Signed-off-by: Tom Brow <[email protected]>
@brow

brow commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T19:10:36.833869Z 9d12344 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ff54c1679

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The relay replaces an addressable event at the same created_at when the
new id is lower; the palette kept the old set. Also keep the union until a
set changes, so a reconnect with nothing new republishes the same list.

Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
Signed-off-by: Tom Brow <[email protected]>
@brow

brow commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 9d12344634

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@brow
brow marked this pull request as ready for review November 13, 2026 19:08
@brow
brow requested a review from a team as a code owner November 13, 2026 19:08
@brow
brow deployed to codex-review November 13, 2026 19:09 — with GitHub Actions Active
@github-actions github-actions Bot added the codex-security-review-current The posted Codex security review matches its recorded range. label Nov 13, 2026
@github-actions

Copy link
Copy Markdown

🔐 Codex Security Review

Note: This is an automated, security-focused review generated by Codex.
Use it as a supplement to human review; false positives are possible.

Scope

  • Exact PR diff: 59ae028a360242d43ffbfdafca8a76eda00484d9...9d123446348180a521939f326e8ced0e419ca081
  • Model: gpt-6.1-sol

💡 Click "edited" above to see earlier reviews for this PR.


Review Summary

Overall Risk: MEDIUM

The incremental emoji cache permanently retains sets deleted from the relay.

Findings

[MEDIUM] Reconcile deleted emoji sets instead of only merging updates

  • Category: Reliability
  • Location: mobile/lib/shared/custom_emoji/custom_emoji_provider.dart:68 (source)
  • Description: After a cached set's author submits a valid kind-5 deletion referencing its event ID, the relay soft-deletes the set and excludes it from history responses. This loop only inserts or replaces cached entries, while the filter requests only kind 30030, so no response can remove the deleted set. Reconnects and refresh() retain it until the RelayClient changes. Previously, a successful reconnect fetch rebuilt the palette and removed absent sets.
  • Impact: Deleted emoji remain available in the picker and renderer, and composing messages can continue publishing their removed image references.
  • Recommendation: Add deletion-aware cache invalidation with reconnect reconciliation, or periodically replace the cache from a complete authoritative snapshot. Cover deletion followed by reconnect in the provider tests.

Notes

  • No additional limitations were reported.

Generated by Codex Security Review |
Requested by: @brow |
Workflow run

@kazemek21 kazemek21 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.

Kyle reviewed this PR and the Nexus review-tracker notes and approved with no comments.

Posted by Codex (gpt-6.1-sol) on behalf of kylez

@brow
brow merged commit 9fc2b33 into main Nov 13, 2026
60 checks passed
@brow
brow deleted the tomb/mobile-custom-emoji-since branch November 13, 2026 21:40
wpfleger96 added a commit that referenced this pull request Nov 14, 2026
* origin/main: (24 commits)
  docs(readme): point desktop readers at block/buzz-app and describe where each client lives (#9493)
  test(cli,db): freeze the assertion test clock and give pool release tests a test-lane acquire budget (#9442)
  test(desktop): unmount every TerminalSubstrate tree before the window closes (#9440)
  fix(mobile): drop the iOS share extension from the build until it's signed (#9489)
  chore(release): release Buzz Desktop version 0.5.30 (#9491)
  perf(mobile): parse each event's thread reference once (#9460)
  perf(mobile): load only the directory when search opens (#9466)
  perf(mobile): stop rebuilding Home's channel list when a route covers it (#9459)
  perf(mobile): ask typing subscriptions only for the typing window (#9454)
  perf(mobile): skip avatar URL parsing for non-HTTP URLs (#9448)
  perf(mobile): download the identity archive list only when it changed (#9445)
  perf(mobile): don't treat a Control Center pull as a resume (#9443)
  fix(mobile): keep a superseded roster read out of the offline snapshot (#9452)
  perf(mobile): read channel bot roles from the member list (#9451)
  perf(mobile): read Activity once per reconnect (#9455)
  fix(mobile): offer role controls for agents (#9475)
  perf(mobile): stop rebuilding the native nav bar on every scrolled frame (#9458)
  perf(mobile): keep verified-name batches open as people are added (#9450)
  perf(mobile): read only changed custom emoji sets on reconnect (#9446)
  perf(mobile): keep latest-message times on a directory load (#9457)
  ...

Signed-off-by: Will Pfleger <[email protected]>

# Conflicts:
#	crates/buzz-cli/src/desktop_provider.rs
bostonaholic added a commit that referenced this pull request Nov 14, 2026
…eaction-recipients

* origin/main: (111 commits)
  perf(acp): avoid repeated observer batch serialization (#9483)
  docs(readme): point desktop readers at block/buzz-app and describe where each client lives (#9493)
  test(cli,db): freeze the assertion test clock and give pool release tests a test-lane acquire budget (#9442)
  test(desktop): unmount every TerminalSubstrate tree before the window closes (#9440)
  fix(mobile): drop the iOS share extension from the build until it's signed (#9489)
  chore(release): release Buzz Desktop version 0.5.30 (#9491)
  perf(mobile): parse each event's thread reference once (#9460)
  perf(mobile): load only the directory when search opens (#9466)
  perf(mobile): stop rebuilding Home's channel list when a route covers it (#9459)
  perf(mobile): ask typing subscriptions only for the typing window (#9454)
  perf(mobile): skip avatar URL parsing for non-HTTP URLs (#9448)
  perf(mobile): download the identity archive list only when it changed (#9445)
  perf(mobile): don't treat a Control Center pull as a resume (#9443)
  fix(mobile): keep a superseded roster read out of the offline snapshot (#9452)
  perf(mobile): read channel bot roles from the member list (#9451)
  perf(mobile): read Activity once per reconnect (#9455)
  fix(mobile): offer role controls for agents (#9475)
  perf(mobile): stop rebuilding the native nav bar on every scrolled frame (#9458)
  perf(mobile): keep verified-name batches open as people are added (#9450)
  perf(mobile): read only changed custom emoji sets on reconnect (#9446)
  ...

Signed-off-by: Matthew Boston <[email protected]>

This branch was successfully deployed

1 active deployment
codex-review — 9d123446 Deployed Nov 13, 2026 by brow via Run Codex Security Review #15012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex-security-review-current The posted Codex security review matches its recorded range.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants