unicity-aos/aos-ce · warning
Event bus dropped messages in context engine poll
Error message
Event bus dropped {result.dropped} messages in context engine poll What it means
The context engine capsule polls the IPC event bus via a typed PollResult. The bus reports how many messages it dropped (e.g. due to buffer overflow or lag); when result.dropped > 0, dispatch_poll_result logs a warning so the developer knows some events never reached the dispatcher. It is a diagnostics warning, not a hard failure — processing continues with the messages that survived.
Solutions
- Increase the event-bus subscription capacity/buffer size for the context engine so bursts fit.
- Profile and speed up the dispatch loop; ensure run() polls frequently and never blocks inside message handling.
- Instrument which topics drop most and throttle publishers emitting into those topics.
- Treat the warning as data loss signal: re-derive lost context (e.g. re-run compaction) after observing drops.
Example fix
// before: ignore polling cadence, large gaps let the queue overflow
loop {
sleep(LONG_INTERVAL);
let result = bus.poll();
dispatch_poll_result(&result, &config);
}
// after: poll promptly and drain fully each cycle
loop {
let result = bus.poll();
dispatch_poll_result(&result, &config);
if result.dropped > 0 {
rebuild_missed_context(&result, &config);
}
sleep(SHORT_INTERVAL);
} Defensive patterns
Strategy: validation
Validate before calling
// after each poll, check for drops before trusting the dispatch
if result.dropped > 0 {
eprintln!("context engine dropped {} events; refresh derived state", result.dropped);
} Prevention
- Poll the bus frequently; never sleep long between polls
- Size subscription buffers for peak burst traffic
- Alert on dropped counters rather than ignoring them
When it happens
Trigger: Any call to dispatch_poll_result (via the capsule run loop) where the PollResult returned from the event bus poll carries dropped > 0, meaning the bus had to discard messages before delivery.
Common situations: Under heavy event traffic the subscription buffer overflows; a slow consumer (long compaction hooks, blocked dispatch) causes the bus to drop queued messages; bursts of tool.v1 events during parallel tool execution.
Related errors
- hook-adapter-oracle: incomplete context fan-out on
- failed to deserialize IPC message payload
- failed to deserialize compaction response payload
- hook-adapter-oracle: dropping mismatched context reply on
- hook-bridge: response fan-out on
AI-assisted analysis of unicity-aos/aos-ce@f6f22024fb (2026-09-13).
Data as JSON: /api/errors/16b751c4f007ee44.
Report an issue: GitHub.
Appendix: source
Thrown at capsules/capsule-context-engine/src/lib.rs:328
let _ = after_sub.poll();
}
}
}
// ── Envelope dispatch ───────────────────────────────────────────────
/// Returns `true` if the topic should be dispatched (not a self-echo).
fn should_dispatch_topic(topic: &str) -> bool {
!topic.starts_with("context_engine.v1.response.")
&& !topic.starts_with("context_engine.v1.hook_response.")
&& topic != "context_engine.v1.hook.before_compaction"
&& topic != "context_engine.v1.hook.after_compaction"
}
/// Dispatch messages from a typed `PollResult`.
fn dispatch_poll_result(result: &ipc::PollResult, config: &Config) {
if result.dropped > 0 {
log::warn(format!(
"Event bus dropped {} messages in context engine poll",
result.dropped
));
}
for msg in &result.messages {
if !should_dispatch_topic(&msg.topic) {
continue;
}
let payload: serde_json::Value = match serde_json::from_str(&msg.payload) {
Ok(v) => v,
Err(e) => {
log::warn(format!("failed to deserialize IPC message payload: {e}"));
continue;
}
};
View on GitHub (pinned to f6f22024fb)