mirror of
https://github.com/openai/codex.git
synced 2026-10-19 16:17:49 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user