mirror of
https://github.com/openai/codex.git
synced 2026-10-31 19:28:49 +00:00
Add code-mode output truncation protocol contracts (#57272)
## What changed Add session options for client- or server-owned output truncation and optional `max_output_tokens` budgets for wait and terminate observations. Introduce `TerminateRequest` and update session implementations and callers to use it. Extend the stdio and gRPC schemas with optional truncation settings and budgets, and define the `bounded-output-v1` capability. Existing sessions retain client-side truncation; providers reject server mode by default. This change defines the contracts without enabling server-side truncation. ## Testing Extend protocol serialization coverage for `outputTruncation: "server"` while preserving existing wire shapes when optional fields are absent. GitOrigin-RevId: 22145897ea16d385c5ba9e7549109f7a669fceb4
This commit is contained in:
@@ -27,6 +27,7 @@ use super::WireContentItem;
|
||||
use super::WireExecuteRequest;
|
||||
use super::WireImageDetail;
|
||||
use super::WireNestedToolCall;
|
||||
use super::WireOutputTruncation;
|
||||
use super::WireResult;
|
||||
use super::WireRuntimeResponse;
|
||||
use super::WireSessionCellExecutionLimits;
|
||||
@@ -249,6 +250,7 @@ fn open_session_serializes_optional_cell_execution_limits() {
|
||||
max_yield_time_ms: Some(250),
|
||||
max_heap_size_bytes: Some(16 * 1024 * 1024),
|
||||
}),
|
||||
output_truncation: None,
|
||||
},
|
||||
json!({
|
||||
"method": "session/open",
|
||||
@@ -304,9 +306,23 @@ fn client_to_host_v1_variants_are_pinned() {
|
||||
HostRequest::OpenSession {
|
||||
session_id: session_id(),
|
||||
cell_execution_limits: None,
|
||||
output_truncation: None,
|
||||
},
|
||||
json!({ "method": "session/open", "sessionId": "session-1" }),
|
||||
),
|
||||
(
|
||||
request_id(/*value*/ 10),
|
||||
HostRequest::OpenSession {
|
||||
session_id: session_id(),
|
||||
cell_execution_limits: None,
|
||||
output_truncation: Some(WireOutputTruncation::Server),
|
||||
},
|
||||
json!({
|
||||
"method": "session/open",
|
||||
"sessionId": "session-1",
|
||||
"outputTruncation": "server",
|
||||
}),
|
||||
),
|
||||
(
|
||||
request_id(/*value*/ 2),
|
||||
HostRequest::Execute {
|
||||
@@ -353,6 +369,7 @@ fn client_to_host_v1_variants_are_pinned() {
|
||||
cell_id: cell_id("cell-1"),
|
||||
yield_time_ms: 50,
|
||||
},
|
||||
max_output_tokens: None,
|
||||
},
|
||||
json!({
|
||||
"method": "session/wait",
|
||||
@@ -365,6 +382,7 @@ fn client_to_host_v1_variants_are_pinned() {
|
||||
HostRequest::Terminate {
|
||||
session_id: session_id(),
|
||||
cell_id: cell_id("cell-1"),
|
||||
max_output_tokens: None,
|
||||
},
|
||||
json!({
|
||||
"method": "session/terminate",
|
||||
|
||||
Reference in New Issue
Block a user