Repository navigation
Description
Problem
An agent can ask an agent in another Squadron a question, but the other agent can't answer it.
- The ask works.
send_message(expect_reply=true)to a receiver in another Squadron opens an Exchange. The Exchange row and itsexchange.openedevent are written only in the asker's ledger. The receiver's ledger gets amessage.receivedcopy (DeliveryWorker.appendReceiverEntry). - The reply is refused. When the receiver calls
send_message(exchange_id=…),SendServicesees that the Exchange's ledger isn't the replier's and returnsA2ACrossSquadronReplyInvariantError: "A cross-Squadron reply cannot record the required closure fact, so nothing was sent. … do not retry send_message for this exchange."apps/server/src/j5/a2a/SendService.ts: the error at about line 212, the reply path at about line 871, and the replay path at about line 782.
So the asker's Exchange stays open until it is dropped or times out, and the replier is told to report an invariant failure.
Expected
The A2A definition says communication is never bounded by a Squadron, and gives this scenario (docs/j5/product/a2a/index.md, "Across Squadrons"): an agent in one Squadron asks an agent in another; both ledgers carry the Exchange under one correlation id, and it is answered.
A reply from the receiver's Squadron should be accepted, close the Exchange exactly once, and be delivered to the asker. Follow-ups, the one-reply rule, drops, silence notices and the human inbox should behave the same as they do within one Squadron.
Notes
- Not yet hit live: the install this was found on has no cross-Squadron traffic yet. It's reachable as soon as an agent asks across Squadrons.
- Ledger keys: the Exchange is keyed
(squadron_id, exchange_id), and sequence numbers are per ledger. The fix has to decide which ledger records the closure and keep both ledgers' sequences gap-free. - Peering: cross-environment peering already routes replies between servers (
peerCounterparty.ts,PeerInboundService.ts). Check whether that path has the same refusal, and whether its approach can be reused locally. - Naming: Retire Squadrons and fold their J5 behavior into projects (decided) #412 proposes re-keying the ledger from Squadrons to projects. This bug would then apply across projects, so the fix shouldn't depend on the name.
🤖 Generated with Claude Code
Activity