mirror of
https://github.com/openai/codex.git
synced 2026-11-13 21:30:47 +00:00
Expose non-consuming input activity waits to hosts (#58411)
## Why Host-owned tools need to wait for agent messages or steering input with the same behavior as native `wait_agent`, including when native multi-agent support is disabled. ## What changed - Add `CodexThread::wait_for_input_activity` and export `InputWaitOutcome` through core and core-api, sharing the wait implementation with `wait_agent`. - Distinguish notifying agent messages from steering input, with steering taking precedence when both are pending. Passive response items do not wake waits. - Observe input without consuming it. Waits remain active after the original turn ends, support independent observers, and can be cancelled by dropping the future. ## Testing Add coverage for pending and incoming input, agent-message classification, cancellation, independent observers, timeouts, and input arriving after the original turn completes or is interrupted. GitOrigin-RevId: d0c0bd776c3b6fd4ba3021603d87eaaf1d93976f
This commit is contained in:
@@ -460,6 +460,20 @@ impl CodexThread {
|
||||
.await
|
||||
}
|
||||
|
||||
/// Waits for input activity without consuming input, following native `wait_agent` behavior.
|
||||
///
|
||||
/// The named turn supplies any already-buffered steering input. Subsequent activity is
|
||||
/// thread-wide: ending or replacing that turn does not end this wait. Mailbox input
|
||||
/// already pending is also observed. Callers own cancellation; dropping this future
|
||||
/// does not consume input or affect execution. Each call observes independently.
|
||||
pub async fn wait_for_input_activity(
|
||||
&self,
|
||||
turn_id: &str,
|
||||
timeout: std::time::Duration,
|
||||
) -> crate::InputWaitOutcome {
|
||||
crate::thread_input::wait_for_input_activity(&self.session, turn_id, timeout).await
|
||||
}
|
||||
|
||||
/// Submits turn input without requiring the caller to inspect thread state.
|
||||
///
|
||||
/// The result describes whether Core started a turn, steered an active
|
||||
|
||||
Reference in New Issue
Block a user