Skip to content

A2A backlog warning for receivers on another server #425

Open

Description

@Jacksondr5

Problem

#424 adds a warning to send_message's result when the receiver is mid-turn and messages are already waiting for it. That only works when the receiver is on the same server, because the sending server can't see a peer server's thread state when the tool is called.

That's because nothing on the send path asks the other server. send_message writes the message to the ledger and returns (SendService.remoteMembership reuses the recorded route "so one dead peer never taxes a send to a known one"). The background delivery worker then makes the HTTP POST to the peer's /api/j5/a2a/peers/deliver (DeliveryTransport.deliverPeer). The peer acknowledges that it has the message, then puts it in the thread with its own worker. By the time the acknowledgement arrives, the tool has already returned.

What's needed

A way for a sender to learn that a receiver on another server is busy with messages waiting, without:

  • making every cross-server send wait on the network, or
  • letting a slow or dead peer server fail the send.

Options

  • Optional per-agent backlog field on the peer roster, read with a short timeout on send. Contract change; an older peer leaves it out and that's reported as unknown. It adds a network call to every cross-server send, bounded by the timeout.
  • Carry the backlog in the deliver acknowledgement and cache it per receiver. The next send's result reports the last known state and when it was measured. No added latency; the fact can be up to one delivery out of date.
  • Not supported: the result says the receiver is on another server and its state is unknown.

The second option probably fits "write first, deliver after" best. Decide when cross-server Crews are common enough to need it.

Related: #424 (same-server warning), #272 (held and limited receivers).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions