mirror of
https://github.com/openai/codex.git
synced 2026-11-11 21:10:39 +00:00
Add early yielding for code-mode observations (#48123)
## What changed Add an optional `preempt` signal to `CodeModeSession::execute` and `CodeModeSession::wait` so callers can end an observation early while the cell continues running and remains available for later waits. Support the signal in the in-process runtime and across both remote transports: `operation/yield` with the negotiated `yield-observation` capability for stdio, and `YieldObservation` for gRPC. Preserve signals received before gRPC observation registration, and retain normal timeout behavior for older hosts that lack support. ## Testing Add runtime and transport tests covering early execute and wait yields followed by successful cell completion, yields before observation registration, and suppression of yield frames for older stdio hosts. GitOrigin-RevId: 3f8049d8f0582be6b8f0832cc03f2d974a0b8f18
This commit is contained in:
@@ -135,6 +135,9 @@ pub enum ClientToHost {
|
||||
Request { id: RequestId, request: HostRequest },
|
||||
#[serde(rename = "operation/cancel")]
|
||||
CancelRequest { id: RequestId },
|
||||
/// Yield the active observation without cancelling its cell.
|
||||
#[serde(rename = "operation/yield")]
|
||||
YieldRequest { id: RequestId },
|
||||
#[serde(rename = "delegate/response")]
|
||||
DelegateResponse {
|
||||
id: DelegateRequestId,
|
||||
|
||||
@@ -15,6 +15,9 @@ pub const MAX_PENDING_DELEGATE_CALLS: usize = 1_024;
|
||||
/// Negotiated support for cell execution resource limits on `session/open`.
|
||||
pub const SESSION_RESOURCE_LIMITS_CAPABILITY: &str = "session-cell-execution-resource-limits";
|
||||
|
||||
/// Support for yielding an in-flight execute or wait observation.
|
||||
pub const YIELD_OBSERVATION_CAPABILITY: &str = "yield-observation";
|
||||
|
||||
pub use codec::EncodedFrame;
|
||||
pub use codec::FramedReader;
|
||||
pub use codec::FramedWriter;
|
||||
|
||||
Reference in New Issue
Block a user