Support durable reasoning configuration updates (#42328)

## Why

Reasoning configuration changes need to retain their position and trusted provenance when model history is persisted and replayed. Client-injected history must not be able to forge these controls.

## What changed

- Add a typed `configuration_update` response item carrying reasoning effort, including custom model-defined values.
- Persist harness-authored updates with provenance and preserve them across history reconstruction, thread resume, raw response notifications, and agent forks.
- Exclude untrusted configuration updates from model history, strip client-supplied provenance metadata, and reject configuration updates supplied as turn input.
- Export the new item through the JSON and TypeScript app-server schemas and classify it in telemetry and persistence metrics.

## Testing

- Cover serialization, provenance persistence, history filtering and rollback, resume reconstruction, and injection attempts before and after restart.

GitOrigin-RevId: eb5559d2b52b7a931621e7c9812f009ff9fb8939
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-09-02 18:52:44 +00:00
1 parent 73e94ee7a6
commit 0d502a4230
37 files changed
+652 -15

No files matched your search

+17 -5
View File
@@ -32,12 +32,14 @@ use crate::ResponseItemId;
use crate::mcp::CallToolResult;
use codex_utils_path_uri::PathUri;
mod configuration_update;
mod executed_tool_calls;
mod item_metadata;
pub use crate::local_media::MAX_PROMPT_AUDIO_INPUT_BYTES;
pub use crate::local_media::snapshot_local_user_input;
pub use crate::permission_profile_snapshot::PermissionProfileSnapshot;
pub use configuration_update::ConfigurationReasoning;
pub use executed_tool_calls::ExecutedToolCall;
pub use executed_tool_calls::ExecutedToolCallArguments;
pub use executed_tool_calls::ExecutedToolCallTruncation;
@@ -1200,6 +1202,10 @@ pub enum ResponseItem {
#[ts(optional)]
internal_chat_message_metadata_passthrough: Option<InternalChatMessageMetadataPassthrough>,
},
/// A durable input control interpreted by the backend at its position in history.
ConfigurationUpdate {
reasoning: ConfigurationReasoning,
},
// Compaction triggers are request controls, not durable response items.
CompactionTrigger {},
ContextCompaction {
@@ -1241,7 +1247,7 @@ impl ResponseItem {
| Self::ImageGenerationCall { id, .. }
| Self::Compaction { id, .. }
| Self::ContextCompaction { id, .. } => id.as_ref(),
Self::CompactionTrigger { .. } | Self::Other => None,
Self::ConfigurationUpdate { .. } | Self::CompactionTrigger { .. } | Self::Other => None,
}
}
@@ -1263,7 +1269,7 @@ impl ResponseItem {
| Self::ImageGenerationCall { id, .. }
| Self::Compaction { id, .. }
| Self::ContextCompaction { id, .. } => *id = new_id,
Self::CompactionTrigger { .. } | Self::Other => {}
Self::ConfigurationUpdate { .. } | Self::CompactionTrigger { .. } | Self::Other => {}
}
}
@@ -1284,7 +1290,7 @@ impl ResponseItem {
Self::WebSearchCall { .. } => Some("ws"),
Self::ImageGenerationCall { .. } => Some("ig"),
Self::Compaction { .. } | Self::ContextCompaction { .. } => Some("cmp"),
Self::CompactionTrigger { .. } | Self::Other => None,
Self::ConfigurationUpdate { .. } | Self::CompactionTrigger { .. } | Self::Other => None,
}
}
@@ -1419,7 +1425,10 @@ impl ResponseItem {
internal_chat_message_metadata_passthrough: metadata,
..
} => metadata.as_ref(),
Self::CompactionTrigger { .. } | Self::AdditionalTools { .. } | Self::Other => None,
Self::ConfigurationUpdate { .. }
| Self::CompactionTrigger { .. }
| Self::AdditionalTools { .. }
| Self::Other => None,
}
}
@@ -1483,7 +1492,10 @@ impl ResponseItem {
internal_chat_message_metadata_passthrough: metadata,
..
} => Some(metadata),
Self::CompactionTrigger { .. } | Self::AdditionalTools { .. } | Self::Other => None,
Self::ConfigurationUpdate { .. }
| Self::CompactionTrigger { .. }
| Self::AdditionalTools { .. }
| Self::Other => None,
}
}
}