Expose the queued event count on CodexThread (#43918)

Add `CodexThread::queued_event_count()` to support a finite event drain
before transferring the receiver. Callers must remain the sole event reader
until they consume the snapshot count, leaving later events for the next reader.

GitOrigin-RevId: 55f9dd1cf8ebd396fdb60a1dc3d1428ed28cc2d2
This commit is contained in:
Steve Coffey
2026-09-08 21:26:22 +00:00
committed by copyberry
parent f419c3214a
commit 78932f4493
+8
View File
@@ -587,6 +587,14 @@ impl CodexThread {
self.io.next_event().await
}
/// Returns the event count for a finite drain before transferring the receiver.
///
/// The caller must own the only event reader until it consumes this many events.
/// Events queued after this snapshot remain for the next reader.
pub fn queued_event_count(&self) -> usize {
self.io.rx_event.len()
}
pub async fn agent_status(&self) -> AgentStatus {
self.io.agent_status().await
}