You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Delivery can attach another Squadron's message references #421
When a delivery to a local agent is sent, DeliveryWorker re-reads the message's message.sent event to recover its canonical references (attachments). It looks the event up by sequence number alone:
// apps/server/src/j5/a2a/DeliveryWorker.ts (delivery to a local agent)SELECTkind,payloadFROMj5_a2a_comm_eventWHEREseq=${row.sent_seq}
seq is numbered per ledger: the table's key is (squadron_id, seq), and every Squadron counts from 1. On a server with more than one Squadron, the query can match another Squadron's event at the same number.
If that event is a message.sent: the delivery carries the other message's attachments, or loses its own.
If it is another kind: the attachments are silently dropped.
Which row SQLite returns is unspecified.
A real install with three Squadrons has overlapping sequence ranges (1–84 exist in two of them), so this can happen today.
Fix
Scope the lookup to the delivery's own ledger (squadron_id = row.squadron_id AND seq = row.sent_seq). That pair is the table's primary key. Add a focused test with two ledgers whose message.sent events share a seq and carry different attachments, and assert that each delivery gets its own.
Activity