Skip to content

mcp: gate parent_event_id threading on NIP-10 markers#281

Closed
thomaspblock wants to merge 1 commit intomainfrom
fix/mcp-parent-event-nip10-gate-clean
Closed

mcp: gate parent_event_id threading on NIP-10 markers#281
thomaspblock wants to merge 1 commit intomainfrom
fix/mcp-parent-event-nip10-gate-clean

Conversation

@thomaspblock
Copy link
Copy Markdown
Collaborator

Prevents accidental thread creation for stream messages when parent_event_id references a root message without explicit NIP-10 root/reply markers. Forum comments are unaffected.\n\n- Only touches crates/sprout-mcp/src/server.rs\n- Adds unit tests for the NIP-10 marker detection helper\n\nTest: cargo test -p sprout-mcp

@thomaspblock thomaspblock requested a review from wesbillman as a code owner April 9, 2026 12:59
@wesbillman
Copy link
Copy Markdown
Collaborator

@codex review please

Copy link
Copy Markdown

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

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: bc68a56f6e

ℹ️ 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".

Comment on lines +918 to +922
if !parent_event_has_nip10_markers(parent_tags) {
tracing::info!(
parent_event_id = parent_event_id,
"resolve_thread_ref_if_thread_context: parent event has no NIP-10 root/reply markers; ignoring thread context"
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve direct replies when parent has no NIP-10 tags

resolve_thread_ref_if_thread_context drops parent_event_id whenever the parent lacks e tags with root/reply, but top-level messages normally have no NIP-10 markers. That means replying to a root message now produces a new top-level post in both send_message and send_diff_message, so MCP clients can no longer start a thread from a non-threaded message (a behavior that worked before this commit). Treating markerless parents as a direct reply (root == parent) avoids this regression while still handling nested thread ancestry.

Useful? React with 👍 / 👎.

@wesbillman wesbillman closed this Apr 13, 2026
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