Skip to content

fix(home-mixer): preserve ancestor and parent context for reply notifications (#205) - #219

Open
Adityakk9031 wants to merge 1 commit into
xai-org:mainfrom
Adityakk9031:fix/reply-notification-thread-context
Open

Adityakk9031 wants to merge 1 commit into
xai-org:mainfrom
Adityakk9031:fix/reply-notification-thread-context

Conversation

@Adityakk9031

@Adityakk9031 Adityakk9031 commented Sep 29, 2026 •

Copy link
Copy Markdown

Summary

Fixes #205

Resolves an issue where opening a reply notification (or timeline requests with push-to-home focal replies) marshals the reply in isolation as an orphaned post, completely omitting the parent post being responded to.

Root Cause Analysis

  1. Push-To-Home Marshalling Omission (push_to_home_marshaller.rs):
    • PushToHomePost holds both conversation_id (root) and in_reply_to_tweet_id (direct parent).
    • In push_to_home_marshaller, in_reply_to_tweet_id was checked solely to set is_root, but was never added to module_items.
    • Only root (from conversation_id) was added. If conversation_id == 0 or equaled the reply ID, root was None and module_items only contained the isolated focal reply.
    • For multi-hop replies in a conversation thread (root -> parent -> reply), only root was rendered and the immediate parent being responded to was completely omitted from the rendered items.
  2. Conversation Marshaller Missing Parent Fallback (convo_marshaller.rs):
    • In convo_marshaller, if a post's ancestors array was empty, parent_tweets was empty, resulting in item_ids containing only [focal_id].
  3. Timeline URT Routing Flaw (urt/mod.rs & reverse_chron_following/mod.rs):
    • The condition post.ancestors.is_empty() routed replies to post_marshaller::marshal_post (a standalone post) without checking post.in_reply_to_tweet_id == 0.
  4. Hydration Omission (core_data_candidate_hydrator.rs):
    • When core data hydrated in_reply_to_tweet_id, candidate.ancestors was not populated, leaving replies vulnerable to orphan marshalling and premature filter dropping in OONRetweetReplyFilter.

Changes Made

  • home-mixer/util/urt/push_to_home_marshaller.rs:
    • Added resolution for parent (post.in_reply_to_tweet_id) in marshal_push_to_home.
    • Assembles module_items in hierarchical order: [root_id, parent_id, focal_id] (deduping if root == parent), ensuring the parent post is always rendered above the reply.
    • Added unit tests covering root posts, single-hop replies, multi-hop replies, and missing conversation_id.
  • home-mixer/util/urt/convo_marshaller.rs:
    • Added fallback to post.in_reply_to_tweet_id when post.ancestors is empty so conversation modules always render parent context.
    • Added unit tests for conversation module assembly and fallback behavior.
  • home-mixer/util/urt/mod.rs & reverse_chron_following/mod.rs:
    • Enforced post.in_reply_to_tweet_id == 0 before routing to post_marshaller::marshal_post.
  • home-mixer/candidate_hydrators/core_data_candidate_hydrator.rs:
    • Populated candidate.ancestors and ancestor_users when in_reply_to_tweet_id is present on core_data.

…ications (xai-org#205)

- In push_to_home_marshaller, ensure the direct parent tweet (in_reply_to_tweet_id)
  is included in module_items alongside the root tweet, preventing replies opened via
  notifications from rendering in isolation as orphaned posts.
- In convo_marshaller, fall back to in_reply_to_tweet_id when ancestors is empty
  so conversation modules always render parent context.
- In urt/mod.rs and reverse_chron_following/mod.rs, check post.in_reply_to_tweet_id == 0
  before routing to marshal_post to prevent replies from being marshaled as standalone posts.
- In core_data_candidate_hydrator, populate candidate.ancestors and ancestor_users
  when in_reply_to_tweet_id is present on core_data.
- Add unit tests for push_to_home_marshaller and convo_marshaller.
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.

[Bug / UX RFC]: Reply Notifications Open Replies in Isolation as Standalone Posts, Completely Omitting Parent Context

1 participant