Add opt-in reasoning status for realtime V3 delegations (#47377)

## What changed

Add `backend_reasoning_status`, disabled by default, to relay public reasoning summaries during active, server-managed realtime V3 delegations.

Use the last non-empty summary from each completed reasoning item, truncate it to 256 bytes at a character boundary, and append it as `[STATUS]` context on the `commentary` channel. Discard queued updates if their delegation is no longer active.

## Testing

Add an integration test covering enabled and disabled behavior, selection of the latest non-empty summary, exclusion of raw reasoning and partial summaries, and delivery without triggering `response.create` or changing the model's reasoning-summary setting.

GitOrigin-RevId: 75ce87dbbbab15a6d9d0ad0b23737738837192fd
This commit is contained in:
guinness-oai
2026-09-22 22:20:00 +00:00
committed by copyberry
parent 418199f6ad
commit 90e653014a
20 changed files with 303 additions and 9 deletions
@@ -4009,6 +4009,7 @@ mod tests {
codex_responses_as_items: None,
codex_response_item_prefix: None,
codex_response_handoff_mode: Some(CodexResponseHandoffMode::BemTags),
backend_reasoning_status: false,
codex_response_handoff_channel_prefixes: Some(std::collections::BTreeMap::from([
("analysis".to_string(), vec!["[THINKING]".to_string()]),
(
@@ -4095,6 +4096,7 @@ mod tests {
codex_responses_as_items: None,
codex_response_item_prefix: None,
codex_response_handoff_mode: None,
backend_reasoning_status: false,
codex_response_handoff_channel_prefixes: None,
thread_id: "thr_123".to_string(),
model: None,
@@ -4147,6 +4149,7 @@ mod tests {
codex_responses_as_items: None,
codex_response_item_prefix: None,
codex_response_handoff_mode: None,
backend_reasoning_status: false,
codex_response_handoff_channel_prefixes: None,
thread_id: "thr_123".to_string(),
model: None,
@@ -4399,6 +4402,7 @@ mod tests {
codex_responses_as_items: None,
codex_response_item_prefix: None,
codex_response_handoff_mode: None,
backend_reasoning_status: false,
codex_response_handoff_channel_prefixes: None,
thread_id: "thr_123".to_string(),
model: None,
@@ -220,6 +220,9 @@ pub struct ThreadRealtimeStartParams {
/// default to `thinking`. Realtime V1 and V2 ignore this setting.
#[ts(optional = nullable)]
pub codex_response_handoff_mode: Option<CodexResponseHandoffMode>,
/// Relays public reasoning summaries as quiet context for realtime V3 delegations. Defaults to false.
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub backend_reasoning_status: bool,
/// Overrides BEM channel prefixes by `analysis`, `commentary`, or `final`.
/// Omitted channels retain their default uppercase bracketed prefixes.
#[ts(optional = nullable)]