Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Expose the queued event count on `CodexThread` (#43918)

Steve Coffey78932f449399
diff --git a/codex-rs/core/src/codex_thread.rs b/codex-rs/core/src/codex_thread.rs
index 5be8adadc0..99185e498a 100644
--- a/codex-rs/core/src/codex_thread.rs
+++ b/codex-rs/core/src/codex_thread.rs
@@ -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
}