mirror of
https://github.com/openai/codex.git
synced 2026-11-20 15:07:25 +00:00
Preserve harness metadata across conversation history (#38058)
## What changed - Wrap response items with optional harness-owned metadata while keeping the persisted response payload shape backward compatible. - Store compacted-history metadata in an aligned sidecar and reject malformed sidecars. - Carry metadata through history normalization, compaction, resume, fork, truncation, migration, and rollout recording without sending it to model providers. ## Testing - Cover legacy rollout compatibility, metadata serialization and validation, compaction retention, and resume/fork reconstruction. GitOrigin-RevId: 17a6127c9048ff984cb4df4d97c0751a38c29f5f
This commit is contained in:
1 parent
44d992c14e
commit
3a6f747d77
67 files changed
+2075
-655
No files matched your search
@@ -2,7 +2,6 @@ use std::io::Write;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use crate::RolloutItem;
|
||||
use codex_otel::MetricsClient;
|
||||
use codex_protocol::ThreadId;
|
||||
use codex_protocol::items::TurnItem;
|
||||
@@ -10,6 +9,8 @@ use codex_protocol::models::ResponseItem;
|
||||
use codex_protocol::protocol::EventMsg;
|
||||
use codex_protocol::protocol::ThreadHistoryMode;
|
||||
|
||||
use crate::ResponseItemEnvelope;
|
||||
use crate::RolloutItem;
|
||||
use crate::policy::is_persisted_rollout_item;
|
||||
|
||||
const ITEM_BYTES_METRIC: &str = "codex.rollout.persistence.item_bytes";
|
||||
@@ -265,8 +266,8 @@ fn turn_item_type(item: &TurnItem) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
fn response_item_type(item: &ResponseItem) -> &'static str {
|
||||
match item {
|
||||
fn response_item_type(item: &ResponseItemEnvelope) -> &'static str {
|
||||
match &item.item {
|
||||
ResponseItem::Message { .. } => "response.message",
|
||||
ResponseItem::AdditionalTools { .. } => "response.additional_tools",
|
||||
ResponseItem::AgentMessage { .. } => "response.agent_message",
|
||||
|
||||
Reference in new issue
Block a user