Skip to content

Refuse a reply whose recipients don't all hold its parent - #68

Open
markmnl wants to merge 2 commits into
mainfrom
reply-recipients-hold-parent
Open

markmnl wants to merge 2 commits into
mainfrom
reply-recipients-hold-parent

Conversation

@markmnl

@markmnl markmnl commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Rule: to reply to a message, you and everyone on your reply must have that message, whichever host they are on.

An add-to batch is a message of its own: the original's contents with a wider audience. Its participants are:

  • the original's sender and recipients;
  • the adder;
  • the people it added.

Someone only added in a batch holds the batch, not the original. So a reply that includes them must name the batch (pid = the batch sha256). Otherwise their host rejects the reply (code 6), or, on the same host, they'd get it without its parent.

Change: POST /fmsg/:id/send answers 409 when a reply has a recipient who isn't a participant of the parent it names. The error names them and gives the remedy (reply to their batch, or add-to). The sender was already checked (resolveParent).

Tests:

  • New: TestReplyRecipientsMustHoldParent.
  • TestPurge now sets up its "recipient holds a reply but not its parent" state directly in the database, since that state can still arise from stored deliveries but can no longer be sent.
  • The full suite passes against Postgres 17.

Clients: markmnl/fmsg-mcp#38 makes reply and create_draft name the batch.

🤖 Generated with Claude Code

markmnl and others added 2 commits November 19, 2026 05:52
To reply to a message, you and everyone on your reply must have that
message, whichever host they are on. An add-to batch is a message of its
own: the original's contents with the wider audience. Its participants are
the original's sender and recipients, the adder and the recipients it
added. Someone only added in a batch holds the batch, not the original, so
a reply that includes them must name the batch by its sha256. Send now
answers 409, naming who doesn't hold the parent, instead of sending a reply
their host would reject (or, on this host, that they'd receive without its
parent).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… out

A reply whose to recipients don't all hold its parent is now refused on
create and update as well as on send, so a draft that could never be sent
isn't written. Send remains the gate.

Recipients added to the reply itself (add-to on the draft) are outside the
rule, and no longer count in the remote-domain check either: they are sent
the reply as an add-to message, whose pid names the reply rather than its
parent, and a host that doesn't hold a message someone is added to takes it
as a full delivery (SPEC §10.3 step 7). The domain check was refusing a
send the spec allows.

A failed participant lookup is now logged, and the README covers the new
409 on create, update and send.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.

1 participant