mirror of
https://github.com/openai/codex.git
synced 2026-11-08 20:40:33 +00:00
Interrupt and drain canceled classifier responses before socket reuse (#53698)
## Why Canceled classifier requests need bounded cleanup that preserves received token usage and returns only safe WebSocket connections to the pool. ## What changed - Own classifier response streams and connection leases together, interrupting dropped responses with a one-second cleanup deadline. - Require a matching interruption acknowledgement and response completion before reusing a canceled response's socket. Retire sockets on rejection, invalid acknowledgements, or timeout while preserving any received completion and token usage. - Skip requests canceled before dispatch and return their unused sockets to the pool. - Distinguish cancellation from ordinary steering, which continues draining without requiring an interruption acknowledgement. ## Testing Add regression coverage for cancellation, acknowledgement ordering and failures, cleanup timeouts, socket reuse, and token accounting under backpressure. Extend steering tests to cover rejected and missing acknowledgements. GitOrigin-RevId: c4e7aac49d36cea2c2d0e9f2ba5f6147f67471dd
This commit is contained in:
@@ -117,7 +117,7 @@ fn normalize_image_detail(detail: &mut Option<ImageDetail>, model_info: &ModelIn
|
||||
|
||||
pub struct ResponseStream {
|
||||
pub(crate) rx_event: mpsc::Receiver<Result<ResponseEvent>>,
|
||||
pub(crate) interrupt: Option<oneshot::Sender<()>>,
|
||||
pub(crate) interrupt: Option<oneshot::Sender<codex_api::ResponseInterrupt>>,
|
||||
/// Signals the mapper task that the consumer stopped polling before the
|
||||
/// provider stream reached its own terminal event.
|
||||
pub(crate) consumer_dropped: CancellationToken,
|
||||
|
||||
Reference in New Issue
Block a user