mirror of
https://github.com/openai/codex.git
synced 2026-11-11 21:10:39 +00:00
Enable server-side output truncation for Code Mode sessions (#57870)
## Why Code Mode sessions always used client-side output handling, leaving server truncation settings and observation budgets unused. ## What changed - Honor each session's `output_truncation` setting in the runtime and both host transports, and advertise the bounded-output capability. - Apply `max_output_tokens` independently to execute, wait, and terminate responses in server mode. Keep client mode as the default when the setting is omitted. - Use bounded output collection and rendering in server mode, preserving head and tail output with omission notices. Include script errors in the output budget while retaining failure status and a separate diagnostic capped at 64 KiB. - Estimate audio tokens without the Tokio-dependent cache when rendering bounded output. ## Testing Add runtime and host regression tests for session mode selection, per-request budgets, output overflow, oversized images, zero-token audio output, diagnostic preservation, and termination under output backpressure. GitOrigin-RevId: 3d9661edcdd2dde31526bb92eb83fa0614f0fa88
This commit is contained in:
@@ -54,6 +54,7 @@ struct Inner {
|
||||
}
|
||||
|
||||
impl SessionRuntime {
|
||||
#[cfg(test)]
|
||||
pub(crate) fn new() -> Self {
|
||||
Self::new_with_task_failure_handler(/*task_failure_handler*/ None)
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ pub(crate) enum CellEvent {
|
||||
},
|
||||
Completed {
|
||||
content_items: OutputCollector,
|
||||
/// None is success. Server diagnostics have already been bounded
|
||||
/// independently of the observing request's output budget.
|
||||
error_text: Option<String>,
|
||||
/// Time the completed result spent waiting for an observer.
|
||||
result_buffered_for: Duration,
|
||||
|
||||
Reference in New Issue
Block a user