Skip to content

/api/send reports Relaycast publication as success without recipient reachability #1615

Description

@khaliqgant

Summary

For a Relaycast-backed direct send, the broker returns:

{"success":true,"relaycast_published":true,"local":false}

when Relaycast accepted the message even if the target agent row has no live holder and cannot receive it. Publication is durable acceptance, not delivery. This hid the orphaned-name failure measured in AgentWorkforce/relaycast#359.

Attribution

The misleading response is constructed in crates/broker/src/runtime/api.rs:

  • selected_workspace.http_client.send_with_mode(...) returns Result<()>;
  • on Ok(()), the broker unconditionally writes relaycast_published: true and no reachability/delivery field.

The information is also discarded one layer earlier: crates/broker/src/relaycast/ws.rs::send_dm_with_mode awaits the Rust SDK AgentClient::dm(...) response and then returns Ok(()).

Relay currently cannot honestly claim delivery from that response. Relaycast's POST /v1/dm creates a durable delivery row, but its public response strips the internal delivery record and dispatch happens in background. A complete delivery receipt therefore needs an upstream Relaycast contract addition; this broker must propagate it once available.

Small, independently useful relay fix

For a named DM target, return an explicit server-observed reachability snapshot even before the richer receipt exists:

{
  "success": true,
  "relaycast_published": true,
  "delivery_status": "published_unconfirmed",
  "recipient_live": false,
  "recipient_status": "offline"
}

Use Relaycast's target-agent read/presence result; do not infer life from the broker's local PTY map. If the probe is unavailable, report recipient_live: null / recipient_status: "unknown" rather than failing an already-published send or claiming success. Channel targets should likewise report delivery as unconfirmed, without inventing one boolean for multiple recipients.

This is intentionally not delivered: false: an offline recipient may later drain its durable mailbox. It says only what is known at response time — publication succeeded and no live holder was observed.

Verification

  • Must fire: Relaycast accepts a DM while the target read reports offline; /api/send remains a 200 publication success but returns delivery_status: published_unconfirmed, recipient_live: false, and recipient_status: offline.
  • Must not fire: a target read failure must not be rendered as recipient_live: true; it returns unknown.
  • A live target returns recipient_live: true but still does not claim delivered until Relaycast supplies a delivery receipt.
  • Update Broker SDK response types so the fields survive decoding.

Related: AgentWorkforce/relaycast#359. Follow-up upstream work should expose the durable delivery id/current status from POST /v1/dm so relay can replace the reachability snapshot with an actual receipt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions