Allow upstream interruption when canceling Responses Lite turns (#57864)

## What changed

- Add the disabled-by-default `interrupt_on_cancel` feature to interrupt upstream inference when a Responses Lite turn is canceled, with a one-second cleanup deadline.
- Detach canceled WebSocket responses so replacement requests can open a new connection without waiting for cleanup.
- Add an optional `interrupt_on_cancel` override for thread samples, inheriting the parent setting when omitted.

## Testing

Add coverage for cancellation during inference and steering, replacement turns proceeding before cleanup finishes, and prompt cancellation of model response interceptors.

GitOrigin-RevId: 501368746fc04fd3fdbd45c1f34c75ce57f4e955
This commit is contained in:
liame-oai
2026-10-29 00:03:28 +00:00
committed by copyberry
parent f9c10053fb
commit f276b82185
11 changed files with 364 additions and 133 deletions
@@ -31,6 +31,9 @@ pub struct ThreadSampleParams {
/// Disable MCP servers when the inherited window uses incremental tools on Responses Lite.
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub disable_mcp: bool,
/// Override upstream interruption on cancellation for this sample; otherwise inherit the parent.
#[ts(optional = nullable)]
pub interrupt_on_cancel: Option<bool>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]