Repository navigation
fix(a2a): a reply to an ask from another Squadron is accepted - #428
Merged
Merged
Conversation
An agent could ask an agent in another Squadron, but the answer was refused: the Exchange lives only in the asker's ledger, and the reply path would not record a closure there. The reply is now accepted. Its message.sent goes in the replier's ledger and the exchange.closed goes in the asker's ledger, both in the transaction that accepts the reply, so the Exchange closes exactly once and is never left open after it is answered. The closure has a command id derived from the reply's, because a receipt binds a command to one ledger. A replayed reply returns the original result and writes nothing. The delivery worker no longer closes an Exchange when it delivers a reply; no path reaches that branch now that closure happens at accept. Fixes #427 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
This review includes 6 billable files and costs up to $1.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 15 minutes for your next included review. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Your 52 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (6)
Comment |
This was referenced Oct 3, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An agent could ask an agent in another Squadron a question, but the answer was refused with
A2ACrossSquadronReplyInvariantError. The Exchange is recorded only in the asker's ledger, and the reply path would not write a closure there, so the ask stayed open until it was dropped or withdrawn.What changed
A reply from another Squadron is now accepted, and the asker's ledger records the closure in the same transaction that accepts the reply.
message.sent(reply)exchange.closedmessage.deliveredmessage.receivedA2AExchangeNotOpenError, as it is inside one Squadron. The existing reply count and the unique index on reply deliveries remain as the backstop, and still answerA2AExchangeAlreadyAnsweredErrorif the closure is missing.Closing at accept, not at delivery, matters for silence: if the Exchange stayed open until the delivery worker ran, a replier whose turn ended first would be reported to the asker as "turn ended without reply" for an Exchange it had answered.
A2ACrossSquadronReplyInvariantErroris removed, along with theexchange.closedbranch inDeliveryWorker.appendReceiverEntry. That branch only ran for a reply row whose ledger differs from the receiver's, and no other path produces one:HumanInboxService.answer) writes the reply and its closure in the Exchange's own ledger.PeerInboundService; a reply to a peer server takes the peer transport and never reaches this function.The peer path did not have this refusal: the receiving server opens its own copy of the Exchange, so the reply there is a same-Squadron reply. That approach can't be reused on one server, because several lookups find an Exchange by id alone and expect one row.
Tests:
SendService.test.ts: ask, follow-up, one reply closing the asker's Exchange, a second reply and a late follow-up refused, the events each ledger holds, gap-free sequences, replay writing nothing, and the one-reply backstop.DeliveryWorker.test.ts: the reply is delivered to the asker and the Exchange closes once.SilenceDetector.test.ts: the replier's turn ends after the reply is accepted and before the worker runs, and no silence notice is written.DeliveryTransport.integration.test.ts: the cross-Squadron case now runs the same ask-and-reply assertions as the same-Squadron case.Fixes #427
Checklist
FORK.md(case text and file-table row) in this PR — not applicable, onlyapps/server/src/j5is toucheddocs/j5/product/upstream.md— not applicableAGENTS.md) — server-only; no contract change. The peer (cross-server) path was checked and is unchanged. Not verified in a running client.docs/j5/product/and user docs rewritten where this changes them — none needed; the A2A definition already describes this behaviorClaude Opus 5.5 (1M context), Claude Code in J5 Code.
🤖 Generated with Claude Code