Skip to main content

forward_inject_to_peer

Function forward_inject_to_peer 

Source
async fn forward_inject_to_peer(
    state: &AppState,
    req: &InjectionRequest,
    forwarded_req: &InjectionRequest,
    peer: ForwardPeer<'_>,
) -> ForwardOutcome
Expand description

The single implementation of “POST this injection to a peer srv and echo it to the sender if it lands”, shared by every forwarding tier.

This existed as three hand-maintained copies (same-host same-channel, same-host cross-channel, LAN peer) differing only in how the URL and key were resolved and what they did on failure. That is the shape that has already produced drift bugs elsewhere in this repo: a tier that forgets the echo, or passes delivery_tier wrong, fails silently and differently from its siblings. See docs/reports/REPORT_NETWORK_ARCHITECTURE_DRYNESS_AND_ROBUST_LAN_2026_09_06.md §4.

One behaviour was unified rather than preserved: the LAN tier used to treat “anything but success: false” as delivered, while both host tiers required success: true. A 200 response whose body omits success entirely therefore counted as a successful LAN delivery — echoing a delivery confirmation to the sender for a message that may never have arrived. All three now require success: true. No real peer is affected: InjectionResponse::success is a plain bool with no skip_serializing_if, so a genuine AgentMux srv always sends it.