Distinguish conversation item IDs from Responses IDs in traces (#62898)

## Why

The rollout trace reducer assigns ordinal IDs to reduced transcript nodes
and uses Responses item IDs to match wire items to those nodes. Using
strings for both lets callers mix up the two kinds of IDs.

## What changed

Make `ConversationItemId` a Rust newtype for transcript nodes and use
`ResponseItemId` for receipt and agent delivery lookups. Carry the typed
transcript IDs through snapshot reconciliation, compaction, and links to
tool calls, code cells, and agent interactions. Continue serializing
transcript IDs as strings such as `conversation_item:9`.

GitOrigin-RevId: 28a36266bc88e1cbc036d99a90b3f88e6966d328
This commit is contained in:
cassirer-openai
2026-11-21 04:35:37 +00:00
committed by copyberry
parent e3a398d3e4
commit db72403243
9 changed files with 127 additions and 75 deletions
+17 -2
View File
@@ -26,8 +26,6 @@ pub type AgentThreadId = String;
pub type AgentPath = String;
/// Runtime submission/activation UUID. This is not a chat turn.
pub type CodexTurnId = String;
/// Reduced transcript item ID assigned by the trace reducer.
pub type ConversationItemId = String;
/// Local ID for one outbound upstream inference request.
pub type InferenceCallId = String;
/// Globally unique ID for one concrete MCP backend request.
@@ -51,6 +49,23 @@ pub type EdgeId = String;
/// Reducer-owned ID for request/log correlation metadata.
pub type CorrelationId = String;
// Ordinals identify nodes in the reduced transcript. Responses item IDs come from the wire.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ConversationItemId(String);
impl ConversationItemId {
pub(crate) fn from_ordinal(ordinal: u64) -> Self {
Self(format!("conversation_item:{ordinal}"))
}
}
impl std::fmt::Display for ConversationItemId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&self.0)
}
}
/// Whether the recorder sealed the bundle and captured all referenced payload bytes.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
+13 -12
View File
@@ -22,6 +22,7 @@ use super::TraceReducer;
use crate::model::CodeCell;
use crate::model::CodeCellId;
use crate::model::CodeCellRuntimeStatus;
use crate::model::ConversationItemId;
use crate::model::ConversationItemKind;
use crate::model::ExecutionStatus;
use crate::model::ExecutionWindow;
@@ -221,7 +222,7 @@ impl TraceReducer {
fn source_item_id_for_pending_code_cell(
&self,
pending: &PendingCodeCellStart,
) -> Result<Option<String>> {
) -> Result<Option<ConversationItemId>> {
Ok(self
.model_visible_code_cell_item_ids(
&pending.thread_id,
@@ -538,7 +539,7 @@ impl TraceReducer {
/// the runtime cell already exists.
pub(super) fn attach_model_visible_code_cell_item(
&mut self,
item_id: &str,
item_id: &ConversationItemId,
call_id: Option<&str>,
kind: &ConversationItemKind,
) -> Result<()> {
@@ -663,7 +664,7 @@ impl TraceReducer {
thread_id: &str,
call_id: &str,
kind: ConversationItemKind,
) -> Vec<String> {
) -> Vec<ConversationItemId> {
self.rollout
.threads
.get(thread_id)
@@ -680,7 +681,7 @@ impl TraceReducer {
thread_id: &str,
code_cell_id: &str,
model_visible_call_id: &str,
) -> Result<String> {
) -> Result<ConversationItemId> {
self.model_visible_code_cell_item_ids(
thread_id,
model_visible_call_id,
@@ -696,11 +697,17 @@ impl TraceReducer {
})
}
fn add_code_cell_output_item(&mut self, code_cell_id: &str, item_id: &str) -> Result<()> {
fn add_code_cell_output_item(
&mut self,
code_cell_id: &str,
item_id: &ConversationItemId,
) -> Result<()> {
let Some(cell) = self.rollout.code_cells.get_mut(code_cell_id) else {
bail!("code cell {code_cell_id} disappeared during output linking");
};
push_unique(&mut cell.output_item_ids, item_id);
if !cell.output_item_ids.contains(item_id) {
cell.output_item_ids.push(item_id.clone());
}
let Some(item) = self.rollout.conversation_items.get_mut(item_id) else {
bail!("conversation item {item_id} disappeared during code-cell output linking");
@@ -726,12 +733,6 @@ fn execution_status_for_code_cell(status: &CodeCellRuntimeStatus) -> ExecutionSt
}
}
fn push_unique(items: &mut Vec<String>, item_id: &str) {
if !items.iter().any(|existing| existing == item_id) {
items.push(item_id.to_string());
}
}
fn runtime_code_cell_key(thread_id: &str, runtime_cell_id: &str) -> (String, String) {
(thread_id.to_string(), runtime_cell_id.to_string())
}
@@ -325,7 +325,7 @@ fn fast_code_cell_lifecycle_waits_for_source_item() -> anyhow::Result<()> {
assert_eq!(rollout.tool_calls["no-cell"].started_code_cell_id, None);
assert_eq!(
cell.output_item_ids,
vec!["conversation_item:9", "conversation_item:12"]
[9, 12].map(crate::ConversationItemId::from_ordinal)
);
assert_eq!(
(
@@ -10,6 +10,7 @@ use anyhow::Context;
use anyhow::Ok;
use anyhow::Result;
use anyhow::bail;
use codex_protocol::ResponseItemId;
use serde_json::Value;
use self::normalize::NormalizedConversationItem;
@@ -17,6 +18,7 @@ use super::TraceReducer;
use crate::model::CompactionId;
use crate::model::ConversationBody;
use crate::model::ConversationItem;
use crate::model::ConversationItemId;
use crate::model::ConversationItemKind;
use crate::model::ConversationPart;
use crate::model::ConversationRole;
@@ -33,17 +35,18 @@ impl TraceReducer {
thread_id: &str,
turn_id: Option<String>,
at_unix_ms: i64,
wire_id: &str,
wire_id: &ResponseItemId,
payload: &RawPayloadRef,
) -> Result<()> {
// A snapshot can arrive first, or the recorder can repeat a notification.
let key = (thread_id.to_owned(), wire_id.to_owned());
let key = (thread_id.to_owned(), wire_id.clone());
if self.receivable_ids.contains_key(&key) {
return Ok(());
}
let ObservedJson { mut value, missing } = self.payload_reader.observed_json(payload)?;
let item = normalize::normalize_model_item(&mut value, payload, &missing)?;
if !item.is_delivery_or_tool_output() || item.responses_item_id.as_deref() != Some(wire_id)
if !item.is_delivery_or_tool_output()
|| item.responses_item_id.as_deref() != Some(wire_id.as_str())
{
bail!("accepted item payload does not match {wire_id}");
}
@@ -84,7 +87,7 @@ impl TraceReducer {
codex_turn_id: &str,
request_payload: &RawPayloadRef,
stripped_tool_output_ids: Vec<(usize, String)>,
) -> Result<Vec<String>> {
) -> Result<Vec<ConversationItemId>> {
if !request_payload.capture.is_complete() {
return Ok(Vec::new());
}
@@ -213,7 +216,7 @@ impl TraceReducer {
wall_time_unix_ms: i64,
inference_call_id: &InferenceCallId,
response_payload: &RawPayloadRef,
) -> Result<Vec<String>> {
) -> Result<Vec<ConversationItemId>> {
if !response_payload.capture.is_complete() {
return Ok(Vec::new());
}
@@ -303,7 +306,7 @@ impl TraceReducer {
&mut self,
items: Vec<NormalizedConversationItem>,
context: ReconcileItems<'_>,
) -> Result<Vec<String>> {
) -> Result<Vec<ConversationItemId>> {
let previous_snapshot = context.snapshot_override.map_or_else(
|| {
self.thread_conversation_snapshots
@@ -490,7 +493,7 @@ impl TraceReducer {
&mut self,
items: Vec<NormalizedConversationItem>,
context: DetachedReconcileItems<'_>,
) -> Result<Vec<String>> {
) -> Result<Vec<ConversationItemId>> {
let mut item_ids = Vec::with_capacity(items.len());
let mut used_item_ids = HashSet::with_capacity(items.len());
@@ -538,13 +541,16 @@ impl TraceReducer {
first_seen_at_unix_ms: i64,
item: NormalizedConversationItem,
produced_by: Vec<ProducerRef>,
) -> String {
) -> ConversationItemId {
// A request or checkpoint can contain a trimmed version of an accepted item.
// Reuse its graph ID and retain the representation actually seen by the model.
if item.is_delivery_or_tool_output()
&& let Some(wire_id) = &item.responses_item_id
{
let key = (thread_id.to_owned(), wire_id.clone());
let key = (
thread_id.to_owned(),
ResponseItemId::from_server(wire_id.clone()),
);
if let Some(receipt) = self.receivable_ids.get(&key)
&& receipt.awaiting_snapshot
{
@@ -579,7 +585,7 @@ impl TraceReducer {
fn update_conversation_item_from_sighting(
&mut self,
item_id: &str,
item_id: &ConversationItemId,
normalized: &NormalizedConversationItem,
produced_by: &[ProducerRef],
) -> Result<()> {
@@ -599,25 +605,27 @@ impl TraceReducer {
if normalized.is_delivery_or_tool_output()
&& let Some(wire_id) = &normalized.responses_item_id
{
let key = (item.thread_id.clone(), wire_id.clone());
let key = (
item.thread_id.clone(),
ResponseItemId::from_server(wire_id.clone()),
);
let receipt = self
.receivable_ids
.entry(key)
.or_insert_with(|| super::ReceivableItem {
item_id: item_id.to_owned(),
item_id: item_id.clone(),
awaiting_snapshot: false,
});
if receipt.awaiting_snapshot && receipt.item_id == item_id {
if receipt.awaiting_snapshot && &receipt.item_id == item_id {
receipt.awaiting_snapshot = false;
item.body.clone_from(&normalized.body);
if let Some(hash) = normalized.structured_output_hash {
self.structured_output_hashes
.insert(item_id.to_owned(), hash);
self.structured_output_hashes.insert(item_id.clone(), hash);
} else {
self.structured_output_hashes.remove(item_id);
}
if normalized.agent_message.is_none() {
self.snapshot_output_anchors.insert(item_id.to_owned());
self.snapshot_output_anchors.insert(item_id.clone());
}
}
}
@@ -632,7 +640,7 @@ impl TraceReducer {
fn append_thread_conversation_items(
&mut self,
thread_id: &str,
item_ids: &[String],
item_ids: &[ConversationItemId],
) -> Result<()> {
let history = &mut self
.rollout
@@ -663,10 +671,10 @@ impl TraceReducer {
fn find_matching_snapshot_item(
&self,
previous_snapshot: &[String],
used_item_ids: &HashSet<String>,
previous_snapshot: &[ConversationItemId],
used_item_ids: &HashSet<ConversationItemId>,
normalized: &NormalizedConversationItem,
) -> Option<String> {
) -> Option<ConversationItemId> {
previous_snapshot
.iter()
.find(|item_id| {
@@ -704,7 +712,11 @@ impl TraceReducer {
Ok(())
}
fn item_matches(&self, item_id: &str, normalized: &NormalizedConversationItem) -> bool {
fn item_matches(
&self,
item_id: &ConversationItemId,
normalized: &NormalizedConversationItem,
) -> bool {
let Some(item) = self.rollout.conversation_items.get(item_id) else {
return false;
};
@@ -721,10 +733,10 @@ impl TraceReducer {
conversation_item_matches(item, normalized)
}
fn next_conversation_item_id(&mut self) -> String {
fn next_conversation_item_id(&mut self) -> ConversationItemId {
let ordinal = self.next_conversation_item_ordinal;
self.next_conversation_item_ordinal += 1;
format!("conversation_item:{ordinal}")
ConversationItemId::from_ordinal(ordinal)
}
}
@@ -748,7 +760,7 @@ struct ReconcileItems<'a> {
produced_by: Vec<ProducerRef>,
start_index: usize,
mode: ReconcileMode,
snapshot_override: Option<&'a [String]>,
snapshot_override: Option<&'a [ConversationItemId]>,
}
struct DetachedReconcileItems<'a> {
@@ -756,7 +768,7 @@ struct DetachedReconcileItems<'a> {
codex_turn_id: &'a str,
wall_time_unix_ms: i64,
produced_by: Vec<ProducerRef>,
candidates: Vec<String>,
candidates: Vec<ConversationItemId>,
}
/// Conversation ids produced when a compaction checkpoint is installed.
@@ -764,9 +776,9 @@ struct DetachedReconcileItems<'a> {
/// The marker item records the boundary, while replacement items are the live
/// history that subsequent full requests should treat as their baseline.
pub(super) struct ReducedCompactionCheckpoint {
pub(super) input_item_ids: Vec<String>,
pub(super) marker_item_id: String,
pub(super) replacement_item_ids: Vec<String>,
pub(super) input_item_ids: Vec<ConversationItemId>,
pub(super) marker_item_id: ConversationItemId,
pub(super) replacement_item_ids: Vec<ConversationItemId>,
}
fn required_array<'a>(
+11 -7
View File
@@ -11,11 +11,14 @@ use anyhow::Context;
use anyhow::Result;
use anyhow::bail;
use anyhow::ensure;
use codex_protocol::ResponseItemId;
use crate::bundle::MANIFEST_FILE_NAME;
use crate::bundle::RAW_EVENT_LOG_FILE_NAME;
use crate::bundle::TRACE_MANIFEST_SCHEMA_VERSION;
use crate::bundle::TraceBundleManifest;
use crate::model::AgentThreadId;
use crate::model::ConversationItemId;
use crate::model::ExecutionStatus;
use crate::model::RolloutTrace;
use crate::model::ToolCallId;
@@ -207,7 +210,7 @@ pub fn replay_bundle(bundle_dir: impl AsRef<Path>) -> Result<RolloutTrace> {
}
struct ReceivableItem {
item_id: String,
item_id: ConversationItemId,
awaiting_snapshot: bool,
}
@@ -217,9 +220,9 @@ struct TraceReducer {
/// First (wall time, sequence) by receiving thread and Responses item ID.
first_acceptances: BTreeMap<String, BTreeMap<String, (i64, crate::RawEventSeq)>>,
/// First graph item for each receiving thread and Responses wire ID.
receivable_ids: BTreeMap<(String, String), ReceivableItem>,
receivable_ids: BTreeMap<(AgentThreadId, ResponseItemId), ReceivableItem>,
/// Accepted tool outputs first encountered in the batch about to be appended.
snapshot_output_anchors: BTreeSet<String>,
snapshot_output_anchors: BTreeSet<ConversationItemId>,
next_conversation_item_ordinal: u64,
next_terminal_operation_ordinal: u64,
/// Latest session for each thread-local runtime handle; each exec replaces it.
@@ -227,16 +230,16 @@ struct TraceReducer {
/// Retains the begin/end consistency check when a handle is later reused.
process_ids_by_terminal: BTreeMap<String, String>,
/// Latest request and its response items, used to reconcile the next request.
thread_conversation_snapshots: BTreeMap<String, Vec<String>>,
thread_conversation_snapshots: BTreeMap<AgentThreadId, Vec<ConversationItemId>>,
/// Full identities for JSON tool outputs whose reduced bodies contain only a preview.
structured_output_hashes: BTreeMap<String, [u8; 32]>,
structured_output_hashes: BTreeMap<ConversationItemId, [u8; 32]>,
/// Replacement snapshot installed by compaction but not yet seen in a sampling request.
///
/// The first full request after compaction should compare against the installed replacement
/// history, not against the pre-compaction request. That keeps repeated prefix/context messages
/// as fresh post-compaction conversation items while still reusing the summary/replacement
/// items that actually became live history.
pending_compaction_replacement_item_ids: BTreeMap<String, Vec<String>>,
pending_compaction_replacement_item_ids: BTreeMap<AgentThreadId, Vec<ConversationItemId>>,
/// Runtime cell ids indexed by thread-local code-mode handle.
///
/// Reduced `CodeCellId`s are based on the model-visible `exec` call id
@@ -365,6 +368,7 @@ impl TraceReducer {
.thread_id
.context("history acceptance has no thread")?;
self.thread_mut(&thread_id)?;
let item_id = ResponseItemId::from_server(item_id);
if let Some(source) = source_tool_call_id {
self.record_agent_message_target(source, thread_id.clone(), item_id.clone())?;
}
@@ -383,7 +387,7 @@ impl TraceReducer {
self.first_acceptances
.entry(thread_id)
.or_default()
.entry(item_id)
.entry(item_id.into())
.or_insert((event.wall_time_unix_ms, event.seq));
}
RawTraceEventPayload::InferenceStarted {
+16 -7
View File
@@ -4,6 +4,7 @@ use anyhow::bail;
use super::TraceReducer;
use crate::model::CodeModeRuntimeToolId;
use crate::model::ConversationItemId;
use crate::model::ConversationItemKind;
use crate::model::ExecutionStatus;
use crate::model::ExecutionWindow;
@@ -343,7 +344,7 @@ impl TraceReducer {
/// reverse links without duplicating matching logic.
pub(super) fn attach_model_visible_tool_item(
&mut self,
item_id: &str,
item_id: &ConversationItemId,
call_id: Option<&str>,
kind: &ConversationItemKind,
) -> Result<()> {
@@ -449,7 +450,7 @@ impl TraceReducer {
thread_id: &str,
call_id: &str,
kinds: &[ConversationItemKind],
) -> Vec<String> {
) -> Vec<ConversationItemId> {
// A late tool-start event must link outputs in history order, not map-key order.
self.rollout.threads[thread_id]
.conversation_item_ids
@@ -460,7 +461,11 @@ impl TraceReducer {
.collect::<Vec<_>>()
}
fn add_tool_call_item(&mut self, tool_call_id: &ToolCallId, item_id: &str) -> Result<()> {
fn add_tool_call_item(
&mut self,
tool_call_id: &ToolCallId,
item_id: &ConversationItemId,
) -> Result<()> {
let Some(tool_call) = self.rollout.tool_calls.get_mut(tool_call_id) else {
bail!("tool call {tool_call_id} disappeared during conversation linking");
};
@@ -468,7 +473,11 @@ impl TraceReducer {
Ok(())
}
fn add_tool_output_item(&mut self, tool_call_id: &ToolCallId, item_id: &str) -> Result<()> {
fn add_tool_output_item(
&mut self,
tool_call_id: &ToolCallId,
item_id: &ConversationItemId,
) -> Result<()> {
let Some(tool_call) = self.rollout.tool_calls.get_mut(tool_call_id) else {
bail!("tool call {tool_call_id} disappeared during output linking");
};
@@ -511,8 +520,8 @@ impl TraceReducer {
}
}
fn push_unique(items: &mut Vec<String>, item_id: &str) {
if !items.iter().any(|existing| existing == item_id) {
items.push(item_id.to_string());
fn push_unique<T: PartialEq + Clone>(items: &mut Vec<T>, item_id: &T) {
if !items.contains(item_id) {
items.push(item_id.clone());
}
}
@@ -1,6 +1,7 @@
use anyhow::Context;
use anyhow::Result;
use anyhow::bail;
use codex_protocol::ResponseItemId;
use codex_protocol::protocol::CollabAgentInteractionBeginEvent;
use codex_protocol::protocol::CollabAgentInteractionEndEvent;
use codex_protocol::protocol::CollabAgentSpawnEndEvent;
@@ -13,6 +14,8 @@ use std::collections::HashSet;
use std::collections::btree_map::Entry;
use super::super::TraceReducer;
use crate::model::AgentThreadId;
use crate::model::ConversationItemId;
use crate::model::ConversationItemKind;
use crate::model::ConversationPart;
use crate::model::ConversationRole;
@@ -56,9 +59,9 @@ pub(in crate::reducer) struct ObservedAgentResultEdge {
/// Sender completion and recipient history can arrive in either order.
pub(in crate::reducer) struct NativeToolDelivery {
receiver_thread_id: String,
receiver_thread_id: AgentThreadId,
activity_at_unix_ms: Option<i64>,
wire_item_id: Option<String>,
wire_item_id: Option<ResponseItemId>,
}
/// Builds the stable edge id for the spawn relationship between two threads.
@@ -224,7 +227,7 @@ impl TraceReducer {
fn native_tool_delivery(
&mut self,
call_id: ToolCallId,
receiver: String,
receiver: AgentThreadId,
) -> Result<&mut NativeToolDelivery> {
match self.native_tool_deliveries.entry(call_id) {
Entry::Occupied(entry) if entry.get().receiver_thread_id != receiver => {
@@ -242,8 +245,8 @@ impl TraceReducer {
pub(in crate::reducer) fn record_agent_message_target(
&mut self,
call_id: ToolCallId,
receiver: String,
item_id: String,
receiver: AgentThreadId,
item_id: ResponseItemId,
) -> Result<()> {
let delivery = self.native_tool_delivery(call_id, receiver)?;
if delivery.wire_item_id.get_or_insert(item_id.clone()) != &item_id {
@@ -254,7 +257,9 @@ impl TraceReducer {
/// Collect the distinct graph items actually sent to each receiver's model. A reset
/// can give the same Responses item a new graph ID. Repeated prompt prefixes reuse it.
fn model_visible_deliveries(&self) -> BTreeMap<(String, String), Vec<String>> {
fn model_visible_deliveries(
&self,
) -> BTreeMap<(AgentThreadId, ResponseItemId), Vec<ConversationItemId>> {
let mut visible = BTreeMap::<_, Vec<_>>::new();
let mut visited = HashSet::new();
let mut requests: Vec<_> = self.rollout.inference_calls.values().collect();
@@ -270,7 +275,10 @@ impl TraceReducer {
&& let Some(wire_id) = &item.responses_item_id
{
visible
.entry((call.thread_id.clone(), wire_id.clone()))
.entry((
call.thread_id.clone(),
ResponseItemId::from_server(wire_id.clone()),
))
.or_default()
.push(id.clone());
}
@@ -555,7 +563,7 @@ impl TraceReducer {
/// Resolves pending agent edges whose target is the newly reduced conversation item.
pub(in crate::reducer) fn resolve_pending_agent_edges_for_item(
&mut self,
item_id: &str,
item_id: &ConversationItemId,
) -> Result<()> {
if self.is_interaction_edge_target_item(item_id) {
return Ok(());
@@ -577,7 +585,7 @@ impl TraceReducer {
return Ok(());
};
let pending = self.pending_agent_interaction_edges.remove(pending_index);
self.upsert_agent_interaction_edge_for_item(pending, item_id.to_string())
self.upsert_agent_interaction_edge_for_item(pending, item_id.clone())
}
fn queue_or_resolve_agent_interaction_edge(
@@ -670,7 +678,7 @@ impl TraceReducer {
fn upsert_agent_interaction_edge_for_item(
&mut self,
pending: PendingAgentInteractionEdge,
target_item_id: String,
target_item_id: ConversationItemId,
) -> Result<()> {
self.upsert_interaction_edge(InteractionEdge {
edge_id: pending.edge_id,
@@ -721,7 +729,7 @@ impl TraceReducer {
thread_id: &str,
message_author: &str,
message_content: &str,
) -> Option<String> {
) -> Option<ConversationItemId> {
self.rollout
.threads
.get(thread_id)?
@@ -738,7 +746,10 @@ impl TraceReducer {
.cloned()
}
fn inter_agent_message_item(&self, item_id: &str) -> Option<(String, String, String)> {
fn inter_agent_message_item(
&self,
item_id: &ConversationItemId,
) -> Option<(String, String, String)> {
let item = self.rollout.conversation_items.get(item_id)?;
let delivery = item.agent_message.as_ref()?;
let thread = self.rollout.threads.get(&item.thread_id)?;
@@ -769,7 +780,7 @@ impl TraceReducer {
.with_context(|| format!("agent edge referenced unknown thread {thread_id}"))
}
fn is_interaction_edge_target_item(&self, item_id: &str) -> bool {
fn is_interaction_edge_target_item(&self, item_id: &ConversationItemId) -> bool {
self.rollout
.interaction_edges
.values()
@@ -780,7 +791,7 @@ impl TraceReducer {
&self,
thread_id: &str,
codex_turn_id: &str,
) -> Option<String> {
) -> Option<ConversationItemId> {
self.rollout
.conversation_items
.values()
@@ -796,9 +807,9 @@ impl TraceReducer {
}
}
fn extend_unique(items: &mut Vec<String>, new_items: Vec<String>) {
fn extend_unique<T: PartialEq>(items: &mut Vec<T>, new_items: Vec<T>) {
for item in new_items {
if !items.iter().any(|existing| existing == &item) {
if !items.contains(&item) {
items.push(item);
}
}
@@ -1107,7 +1107,7 @@ fn inter_agent_message(author: &str, recipient: &str, content: &str) -> serde_js
})
}
fn target_conversation_item_id(anchor: &TraceAnchor) -> &String {
fn target_conversation_item_id(anchor: &TraceAnchor) -> &crate::ConversationItemId {
let TraceAnchor::ConversationItem { item_id } = anchor else {
panic!("expected conversation item target");
};
@@ -286,7 +286,7 @@ impl TraceReducer {
status: ExecutionStatus::Running,
},
});
push_unique(&mut session.operation_ids, operation_id);
push_unique(&mut session.operation_ids, &operation.operation_id);
operation.terminal_id = Some(terminal_id.clone());
self.process_ids_by_terminal
.insert(terminal_id.clone(), process_id.to_string());