unicity-aos/aos-ce · warning

Event bus dropped messages - TUI may be stale

Error message

Event bus dropped {poll_result.dropped} messages - TUI may be stale

What it means

broadcast_poll_messages polls the IPC event bus and the PollResult reported that `dropped` messages were discarded (e.g. a bounded broadcast channel overflowed between polls). The library logs a warning because the TUI consumes these messages to update streams; dropped messages mean the TUI's accumulated stream output can be incomplete or stale.

Solutions

  1. Increase the event bus / broadcast channel buffer capacity to absorb bursts
  2. Reduce emission rate at the producer side or batch stream chunks
  3. Investigate why the TUI consumer is slow (rendering backpressure, blocking calls)
  4. Treat the affected stream as truncated — trigger a resync/re-fetch of the stream state instead of trusting the accumulated output

Example fix

// before
broadcast::channel(64) // overflows under burst
// after
broadcast::channel(4096) // larger buffer for stream bursts
Defensive patterns

Strategy: fallback

Validate before calling

if poll_result.dropped > 0 {
    stream_accum.clear(); // accumulated output is incomplete; resync instead of trusting it
    schedule_resync();
}

Prevention

When it happens

Trigger: poll_result.dropped > 0 after an ipc poll — the event bus buffer filled faster than the TUI consumed it; broadcast_poll_messages logs this warning before processing the surviving messages.

Common situations: TUI rendering stalls (terminal backpressure, paused output) while proxies emit high-volume stream output; slow consumer on a busy system with many ProxyClients; undersized event-bus buffer capacity.

Related errors


AI-assisted analysis of unicity-aos/aos-ce@f6f22024fb (2026-09-13). Data as JSON: /api/errors/e20da8d84277b701. Report an issue: GitHub.

Appendix: source

Thrown at capsules/capsule-cli/src/lib.rs:650

    session: Option<String>,
}

/// Fan a `PollResult` out to connected clients, demultiplexed by principal AND
/// session so a bound connection only sees IPC stamped with its own principal
/// (plus unprincipaled system events), and a chat response only when it is on
/// that session. Tracks failed stream indices (into `clients`) in `dead`.
///
/// `stream_accum` carries streamed chat tokens across calls so a turn's terminal
/// response can be reconciled against what was already streamed live (see
/// [`reconcile_stream_payload`]).
fn broadcast_poll_messages(
    clients: &[ProxyClient],
    poll_result: &ipc::PollResult,
    stream_accum: &mut HashMap<String, String>,
    dead: &mut Vec<usize>,
) {
    if poll_result.dropped > 0 {
        log::warn(format!(
            "Event bus dropped {} messages - TUI may be stale",
            poll_result.dropped
        ));
    }

    // Pre-serialize each message once and compute its principal target once
    // (not per client). Reconstruct the wire format the TUI expects:
    // {topic, payload, source_id}.
    let outbound: Vec<OutboundMessage> = poll_result
        .messages
        .iter()
        .filter_map(|msg| {
            // Parse the payload string back to a JSON value so the TUI
            // receives an embedded object, not an escaped string.
            let mut payload = serde_json::from_str::<serde_json::Value>(&msg.payload)
                .unwrap_or(serde_json::Value::String(msg.payload.clone()));
            // Accumulate streamed tokens and reconcile the terminal response so
            // the TUI (append-then-flush) renders the reply exactly once.

View on GitHub (pinned to f6f22024fb)