The federation.deliver worker task sends queued activities:
- signed POSTs as the user, draft-cavage first and RFC 9421 after a
401 (double-knocking), several at once (FEDERATION_DELIVERY_
CONCURRENCY), up to 50 per pass
- 2xx delivered; 410 removes whoever that inbox belongs to as a
follower and marks them gone; other 4xx (except 401/408/429) are
abandoned; everything else retries at 1m, 5m, 30m, 2h, 6h, then
every 12h, abandoned after 2 days
- claiming leases a delivery (pushes its next attempt forward), so a
crashed worker's sends become due again on their own; claiming
skips the eager join Postgres can't lock through
- metrics: deliveries by result, delivery time, outgoing signatures,
queue depths and follower totals (gauges set every 30s)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
Intake (in the request, no network): size, content type and shape
checks, blocked domains refused (403), duplicates acknowledged once,
then stored and answered 202.
Processing (federation.inbox worker task):
- verify the HTTP signature with either scheme, as of when it arrived,
using the cached key and refreshing the sender once on failure (key
rotation); a deleted account's Delete still verifies from cache
- the signer must be the activity's actor and the activity id must be
on the actor's host
- handlers: Follow (accept, or pending with manual approval; repeat
follows re-accepted; blocked accounts rejected), Undo of a Follow
(only by the same actor), Delete of an actor, Update of an actor;
anything else recorded
- items being processed are marked, retried on transient failures,
re-queued if a worker dies, and pruned after 30 days
Outgoing Accept/Reject/Block activities are stored with stable ids and
queued per inbox for the delivery task (next step). Public activities
are fetchable at /activities/<uuid>. Metrics for inbox activities and
signature checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW