Add opt-in output token replay for OpenAI requests (#52742)

## What changed

- Add the disabled-by-default `output_token_replay` feature to request `output.encrypted_content` from OpenAI providers.
- Preserve encrypted message and tool-call output, message and function-call status, and output-text `annotations` and `logprobs` through history and replay. Update the generated protocol schemas and SDK types.
- Strip output ciphertext from requests to other providers while retaining it in stored history, including after replay is disabled. Remove encrypted content from memory extraction inputs.

## Testing

Add integration coverage for the feature/provider combinations, metadata replay across follow-up requests, and history preservation when resuming with replay disabled.

GitOrigin-RevId: 77729a021b6771933402aebe74ece8eb39c057e2
This commit is contained in:
pakrym-oai
2026-10-10 01:25:00 +00:00
committed by copyberry
parent e4490eff65
commit 5ef96ab278
119 changed files with 1602 additions and 91 deletions
@@ -946,6 +946,8 @@ mod tests {
let api_request = ResponsesApiRequest {
model: "gpt-test".to_string(),
input: vec![ResponseItem::Message {
status: None,
encrypted_content: None,
id: Some(ResponseItemId::with_suffix("msg", "1")),
role: "user".to_string(),
content: vec![ContentItem::InputText {
@@ -157,6 +157,8 @@ mod tests {
model: "gpt-test".to_string(),
reasoning: None,
input: Some(SearchInput::Items(vec![ResponseItem::Message {
status: None,
encrypted_content: None,
id: Some(ResponseItemId::with_suffix("msg", "search")),
role: "user".to_string(),
content: vec![
+2
View File
@@ -770,6 +770,8 @@ mod tests {
] if start_content.is_empty()
&& text == "First result."
&& done_content == &vec![codex_protocol::models::ContentItem::OutputText {
annotations: None,
logprobs: None,
text: "First result.".to_string()
}]);
}