- fork_dm finds or makes the new DM on the transaction that holds the
source DM's lock, so a 41011 without the tag uses one connection
besides the command's, and it checks that the source is a live,
unarchived DM, as grow_dm does.
- Removing an agent from a DM identified by all its members moves it to
its people's identity when that is free, instead of discarding it.
- A tagged add that lands in the DM its people already have checks agent
policies against that DM only.
- The direct-DM policy exemption applies only to a newly created DM, not
to a DM someone left.
- A tagged 41010 reopen adds only the named agents, so it cannot re-add
someone who left, and the race-only redirect branches are gone.
- SDK and CLI no longer cap DM opens at 8 pubkeys: the relay enforces
nine people, and agents, including an agent caller, do not count.
They document that agents cannot send the history tag.
- Tests force the lost-insert race and wait on the DM lock explicitly
instead of sleeping.
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Co-authored-by: Carl <c217fe6b9d958f41c3a5e030dccc7f626775a923089cb6491305eade75ea1f1b@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every DM membership write now reads the DM's members under its lock,
checks the add policy of the agents actually joining, and reconciles
the DM's identity against the fingerprint it has stored.
- An agent joining, or a tagged reopen of, a DM still identified by
all its members moves it to its people. If those people already have
a DM, people meet there and agents join in place.
- Reopening a DM ignores the policy of agents already in it.
- A create that loses a race reports created=false, so the opener
still adds its agents.
- Starting a new DM from a DM rereads its members under its lock and
checks every agent in the result, not only the ones being added.
- kind:41011 cannot add the relay to a DM.
- The nine-people limit counts the caller only if they are a person,
so an agent can open a DM with nine people.
- Only people send the history tag, on kind:41010 as on kind:41011.
- SDK: build_dm_open_with_history opts in to the history tag.
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Co-authored-by: Carl <c217fe6b9d958f41c3a5e030dccc7f626775a923089cb6491305eade75ea1f1b@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A DM of at most one person and their agents now never grows into a DM
of two or more people, even with ["history","include"]. grow_dm reports
PeopleStartNewDm under the membership lock, and 41011 falls back to the
fork path: it opens or creates the DM of everyone and leaves the
original untouched. This matches main, where adding a person to an
agent chat always started a new DM. Agents still join in place, and
DMs of two or more people are unchanged.
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Co-authored-by: Carl <c217fe6b9d958f41c3a5e030dccc7f626775a923089cb6491305eade75ea1f1b@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without ["history","include"], kind:41010 and kind:41011 behave as before
members could join in place: opening finds or makes the DM of exactly the
named members, agents included, and any add starts a new DM of everyone.
With the tag, opening finds the people's DM and adds the named agents, and
adds join in place. An older client can no longer put an agent into an
existing DM, and show it the history, without the user seeing a warning.
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Co-authored-by: Carl <c217fe6b9d958f41c3a5e030dccc7f626775a923089cb6491305eade75ea1f1b@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refusing kinds 9001 and 9022 on DMs took away leaving a DM, which
clients offer today, and broke agent deletion, which removes the agent
from each of its channels with kind:9001. Every removal already
releases the DM's identity when its people change, so a DM again
accepts kind:9022, and kind:9001 for yourself or your own agent.
People still join only through kind:41011.
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Co-authored-by: Carl <c217fe6b9d958f41c3a5e030dccc7f626775a923089cb6491305eade75ea1f1b@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generic membership kinds 9000, 9001 and 9022 are refused on DMs, so a
DM's members change only through kind:41010/41011, which keep its
identity current. Moderation and admin kicks remove members directly in
the database and still work on DMs; any removal from a DM now releases
its identity under the membership lock, so the DM keeps its history and
opening that group again starts a new DM instead of a stale match.
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Co-authored-by: Carl <c217fe6b9d958f41c3a5e030dccc7f626775a923089cb6491305eade75ea1f1b@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A DM is now identified by its people: agents never change which DM it
is and do not count toward the 9-person limit.
kind:41011 gains ["history", "include"]: the added people join this DM
with its history, and its identity moves to the grown set of people. If
a DM of those people already exists, that DM is returned instead.
Without the tag an added person starts a new DM of everyone, as before.
Agents always join in place, subject to their channel_add_policy.
kind:41010 finds the DM of the named people and adds any named agents
it lacks. DMs made before this change are still found by all members.
Only people grow DMs: an agent cannot send the history tag, its adds
start a new DM, and a DM it opens is identified by all its members.
Growing never reveals a DM the actor is not in.
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Co-authored-by: Carl <c217fe6b9d958f41c3a5e030dccc7f626775a923089cb6491305eade75ea1f1b@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>