Repository navigation
Conversation
Mirrors buzz-app #2998. While a channel page is in front and the app is in use, it saves row hints for what the row shows: `seen:<channel>` for ordinary messages (synced) and a local `seen:msg:<id>` receipt for each mention, broadcast or reply. The channel list's bold and dot and the app badge leave out what the row has seen. Nothing is read: threads, the Solo list and every other unread reader keep the unread. A manual unread on the channel or a message shows the whole row again. Co-authored-by: mbot <3754f8729004d95654c46dbab3129e4ab9ef05cc2534e2a3fbfc155983bd637b@buzz.block.builderlab.xyz> Signed-off-by: Bradley Axen <baxen@squareup.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🔐 Codex Security Review
Review SummaryOverall Risk: NONE
FindingsNo concrete security, correctness, or reliability findings were identified. Notes
Generated by Codex Security Review | |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e803da93c6
ℹ️ 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".
| if (event.createdAt > newest) newest = event.createdAt; | ||
| if (event.channelCatchUp) { | ||
| ordinary = true; |
There was a problem hiding this comment.
Derive the seen frontier only from ordinary events
When the observed set contains an ordinary message plus a newer mention or reply, newest advances to the attention event's timestamp and that value is stored as seen:<channel>. If an ordinary event is subsequently delivered with a timestamp between those two values—such as after reconnect or from a sender with a slower clock—rowSawObservedUnreadEvent treats it as already seen, so the newly arrived activity never highlights the row. Update the channel frontier only while processing event.channelCatchUp; attention events already have their per-message receipts.
AGENTS.md reference: AGENTS.md:L266-L271
Useful? React with 👍 / 👎.
| } else { | ||
| marks[seenMessageContextKey(event.id)] = event.createdAt; |
There was a problem hiding this comment.
Bound locally retained attention receipts
For every attention event observed while a channel is open, this creates a unique seen:msg:<id> context, with no count-based eviction. These contexts accumulate in ReadStateManager._effectiveState; serialization filters old timestamps but never removes them from the live map, while every receipt within the 30-day horizon is rewritten into the journal. Sustained mention/reply traffic therefore makes memory use and each JSON persist grow continuously during a long-running session, so the receipt set needs live pruning or a hard capacity bound.
AGENTS.md reference: AGENTS.md:L249-L256
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
[P2] Prune expired row receipts from live state
_persistLocalState prunes into a separate observed map, leaving _effectiveState unchanged. As new attention IDs arrive, expired seen:msg: entries therefore remain in memory and participate in subsequent save scans. Please prune these obsolete row receipts from live state too. If adding capacity eviction, dropping a row hint should not advance the read floor—it quiets the row but does not mark anything read.
Posted by Codex (gpt-6.1-sol) on behalf of kylez
kazemek21
left a comment
There was a problem hiding this comment.
Kyle reviewed this PR and the Nexus review-tracker notes. Approved with the non-blocking receipt-pruning suggestion above.
Posted by Codex (gpt-6.1-sol) on behalf of kylez
## Summary A reply in a thread you started, participated in, or followed can light a mobile channel's attention dot without appearing in Activity. Activity now includes eligible replies already observed by the channel unread pipeline in **All** and **Threads**. Tapping a row uses the existing oldest-unread reply and thread navigation. Retain the reply payload alongside its bounded unread evidence, then merge by event ID with the addressed feed. Mentions retain their category and do not duplicate. Deletion, eviction, and account/community resets share the same registry. This adds no relay queries or subscriptions. Coverage follows the existing channel unread catch-up and live subscriptions. This does not introduce complete historical thread discovery: replies outside that retained window, and replies not eligible for the channel attention dot, are not newly fetched. ### Related issue Related to #9271 (clearing channel rows) and closed #9186 (broader Activity feed expansion). #9213 supplied the existing Activity filters. This PR connects existing observed replies to those filters. ### Testing - Full mobile suite, push-unconfigured tests, analysis, formatting and file-size checks. - Production-provider regression: cold catch-up, live reply, mention deduplication, excluded unrelated/quiet replies, thread read markers, deletion/replay and identity reset. - Real Activity widget journey with fake relay/storage boundaries: show the unmentioned reply, select Threads, tap the row, and verify the reply ID and thread ID passed to the conversation page. - Mutation check: removing reply-payload retention makes the widget journey fail because the reply is absent. - Independent agent source review: no blockers. ### Preview Actual Flutter widgets at phone width with synthetic data and the new reply wiring disabled/enabled. These are widget-test captures, not installed-device or live-relay evidence. | Before | After | | --- | --- | |  |  | ### Human validation pending Draft per the repository readiness checklist. On a device, receive an unmentioned reply in a thread you started, replied in, or followed. Check Activity → All and Threads, tap the row to reach the reply, then read it and confirm Unread clears without reading unrelated channel messages. Native/live-relay testing and human confirmation remain pending. --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Signed-off-by: Tom Brow <tomb@squareup.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Co-authored-by: Tom Brow <tomb@block.xyz> Co-authored-by: Tom Brow <tomb@squareup.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
wesbillman
left a comment
There was a problem hiding this comment.
🤖 Star Lord: no blocking findings at e803da9; recommend approval based on source review. Tests and device behavior were not exercised.
Use the current unread evidence revisions and preserve synced manual unread. Store attention receipts locally and expire them with the read horizon. Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>
wesbillman
left a comment
There was a problem hiding this comment.
🤖 Carl, an automated reviewer, commenting via Wes's GitHub account.
Verdict: no blockers. The row-hint design matches buzz-app a905c4865: same seen:<channel> wire key both ways, seen:msg: kept local on publish, peer ingest and own-slot recovery, and the badge simplification is equivalent to the removed backlog branch. Two recommended fixes and two optional suggestions are inline.
PR body is stale against the code: it names markContextsRead and isLocalOnlyContext (the code has markChannelRowSeen and isSeenMessageContext/isReadStateSlotContext). It says seen:<channel> is the newest ordinary message, but the code saves the newest unseen event of any kind, which matches desktop. And it says desktop's Solo inventory keeps raw unread, which it doesn't (see the inline thread on the badge).
Validation gaps: source review only; no device run. Mobile CI was partly pending at review time.
Exit criteria: address or decline the two recommended threads and correct the body.
| marks[seenMessageContextKey(event.id)] = event.createdAt; | ||
| } | ||
| } | ||
| if (ordinary) marks[seenContextKey(channelId)] = newest; |
There was a problem hiding this comment.
🤖 Optional: the saved cutoff depends on frame delivery and never retreats.
Marks are written incrementally while the page is in front, and seen:<channel> only advances when the pass finds unseen ordinary backlog. Two consequences:
- If ordinary t=100 and a mention t=120 land in one pass, mobile saves 120 (same as desktop). If they land in separate passes, it saves 100, so a late ordinary t=110 relights the row. That's conservative, and the synced value keeps clients consistent, but it isn't deterministic.
- If a thread reply at t=120 is deleted during the visit after the cut reached 120, the cut stays at 120. Desktop builds its exit snapshot from retained evidence and would cut at the newest remaining event, so a late ordinary message stamped between them stays hidden on mobile but not on desktop.
Desktop freezes the snapshot at visit end (unread.ts seeChannel). Saving the cut once from retained evidence on cover, background or exit would fix both and make it match desktop. The deletion case needs a deletion during the visit plus a delayed message inside that window, so I wouldn't block on it.
| var publish = false; | ||
| for (final MapEntry(:key, :value) in marks.entries) { | ||
| if (value <= floor) continue; | ||
| final sync = !isSeenMessageContext(key); |
There was a problem hiding this comment.
🤖 Optional hardening: row hints compete with real reads at the snapshot cap.
seen:<channel> enters the same slot plan as read frontiers, and _checkSnapshotCapacity rejects the whole batch. Its fallback only drops follow packets. Near the cap, a new row hint can therefore stop an explicit read that would fit on its own from publishing. Any new context has this property and desktop publishes the same keys, and we have no evidence that ordinary accounts approach the cap. Still, row hints are the cheapest thing to drop, so giving them lower priority in the capacity fallback would be a reasonable guard.
Journal the team channel cutoff for the next read-state publish or flush. Match the badge to the raw unread logic used by Home and Me for both labelled and legacy Solo chats. Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesb@block.xyz>


Summary
Mobile half of block/buzz-app#2998. Opening a team channel quiets its bold name, attention dot, and contribution to the app badge. The visit leaves message and thread read state intact. An ordinary message newer than the saved cutoff or an unseen mention or reply can light the row again.
seen:<channel>is the cutoff for ordinary activity. When a pass finds unseen ordinary backlog, it uses the newest unseen verified event in that pass, including attention. Mobile saves the cutoff locally and sends it with an existing read-state publish or lifecycle flush.seen:msg:<id>is a device-local receipt for a mention, broadcast, or reply. A late unread attention message still lights the row even when its timestamp is at or below the cutoff. Expired receipts are pruned from live state and disk. Receipts stay out of read-state slots.Why this improves mobile
A quick visit clears the row and badge locally while leaving the thread unread. Visit-only hints use the existing sync path, so they incur no dedicated read-state snapshot. The Solo badge follows what Home and Me show.
Related issue
N/A. Mirrors block/buzz-app#2998.
Testing