mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
Keep rejected audio file IDs out of protocol events (#63667)
## Why Codex needs rejected audio file IDs when reconstructing a session so later model requests can omit those attachments. Clients only need the turn error. ## What changed Store rejected audio file IDs as rollout metadata and restore them from that metadata when replaying history. Keep the existing JSONL layout under `error.rejected_audio_file_ids` so older versions can still read newly written rollouts. ## Testing Add a regression test that round-trips a legacy rollout entry and verifies that serializing the protocol event omits the rejected IDs. GitOrigin-RevId: 982dd85d0037cebee056caf61d70988762e42767
This commit is contained in:
@@ -33,7 +33,9 @@ pub fn apply_rollout_item(
|
||||
match item {
|
||||
RolloutItem::SessionMeta(meta_line) => apply_session_meta_from_item(metadata, meta_line),
|
||||
RolloutItem::TurnContext(turn_ctx) => apply_turn_context(metadata, turn_ctx),
|
||||
RolloutItem::EventMsg(event) => apply_event_msg(metadata, event),
|
||||
RolloutItem::EventMsg { event, .. } => {
|
||||
apply_event_msg(metadata, event);
|
||||
}
|
||||
RolloutItem::ResponseItem(item) => apply_response_item(metadata, &item.item),
|
||||
RolloutItem::InterAgentCommunication(_)
|
||||
| RolloutItem::InterAgentCommunicationMetadata { .. } => {}
|
||||
@@ -54,21 +56,25 @@ pub fn apply_rollout_item(
|
||||
pub fn rollout_item_affects_thread_metadata(item: &RolloutItem) -> bool {
|
||||
match item {
|
||||
RolloutItem::SessionMeta(_) | RolloutItem::TurnContext(_) => true,
|
||||
RolloutItem::EventMsg(
|
||||
EventMsg::TokenCount(_)
|
||||
| EventMsg::UserMessage(_)
|
||||
| EventMsg::ThreadGoalUpdated(_)
|
||||
| EventMsg::ThreadSettingsApplied(_),
|
||||
) => true,
|
||||
RolloutItem::EventMsg(EventMsg::ItemCompleted(event))
|
||||
if matches!(
|
||||
event.item,
|
||||
TurnItem::UserMessage(_) | TurnItem::FunctionCallOutput(_)
|
||||
) =>
|
||||
RolloutItem::EventMsg {
|
||||
event:
|
||||
EventMsg::TokenCount(_)
|
||||
| EventMsg::UserMessage(_)
|
||||
| EventMsg::ThreadGoalUpdated(_)
|
||||
| EventMsg::ThreadSettingsApplied(_),
|
||||
..
|
||||
} => true,
|
||||
RolloutItem::EventMsg {
|
||||
event: EventMsg::ItemCompleted(event),
|
||||
..
|
||||
} if matches!(
|
||||
event.item,
|
||||
TurnItem::UserMessage(_) | TurnItem::FunctionCallOutput(_)
|
||||
) =>
|
||||
{
|
||||
true
|
||||
}
|
||||
RolloutItem::EventMsg(_)
|
||||
RolloutItem::EventMsg { .. }
|
||||
| RolloutItem::ResponseItem(_)
|
||||
| RolloutItem::InterAgentCommunication(_)
|
||||
| RolloutItem::InterAgentCommunicationMetadata { .. }
|
||||
|
||||
@@ -1559,7 +1559,7 @@ pub(super) fn extract_memory_mode(items: &[RolloutItem]) -> Option<String> {
|
||||
| RolloutItem::DynamicToolsUpdated { .. }
|
||||
| RolloutItem::SecurityRiskScore(_)
|
||||
| RolloutItem::TokenUsageRecord(_)
|
||||
| RolloutItem::EventMsg(_) => None,
|
||||
| RolloutItem::EventMsg { .. } => None,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user