mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Add per-item retention policies for injected history (#61344)
## What changed Allow `thread/inject_items` to accept wrapped items with `retention: "default"` or `retention: "always"`, while preserving support for raw response items. Persist explicit policies separately from legacy client-authored metadata. Carry explicitly retained items through local and remote compaction, context-window changes, and child-agent creation, subject to retention budgets. Preserve history order and keep retained tool exchanges together; require matching calls and outputs to be adjacent in the injection request and both marked `always`. Update Quinn dependencies and record exceptions for additional Hickory DNSSEC advisories where DNSSEC is disabled. ## Testing Update injection tests for explicit retention metadata and extend the compaction scenario to cover a retained tool exchange across repeated compaction and restart. GitOrigin-RevId: 1195a4ed62dc162a62e58bc2ad733262fbabea27
This commit is contained in:
@@ -18,6 +18,7 @@ use codex_protocol::protocol::TurnEnvironmentRequests;
|
||||
use codex_protocol::protocol::TurnSettingsUpdate;
|
||||
use codex_protocol::protocol::TurnSettingsUpdateOutcome;
|
||||
use codex_protocol::turn_input::AnnotatedResponseItem;
|
||||
use codex_protocol::turn_input::InjectedResponseItem;
|
||||
use codex_protocol::turn_input::ResponseItemAnnotations;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
|
||||
@@ -1081,15 +1082,17 @@ impl TurnRequestProcessor {
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(index, value)| {
|
||||
serde_json::from_value::<ResponseItem>(value)
|
||||
serde_json::from_value::<InjectedResponseItem>(value)
|
||||
.map_err(|err| format!("items[{index}] is not a valid response item: {err}"))
|
||||
})
|
||||
.collect::<std::result::Result<Vec<_>, _>>()
|
||||
.map_err(invalid_request)?;
|
||||
validate_response_item_image_urls(&items)?;
|
||||
for item in &items {
|
||||
validate_response_item_image_urls(std::slice::from_ref(&item.item))?;
|
||||
}
|
||||
|
||||
thread
|
||||
.inject_response_items(items)
|
||||
.inject_response_items_with_retention(items)
|
||||
.await
|
||||
.map_err(|err| match err.details() {
|
||||
CodexErrorDetails::InvalidRequest(message) => invalid_request(message.clone()),
|
||||
|
||||
Reference in New Issue
Block a user