Persist agent messages as response items (#29829)

## Why

Inter-agent messages are recorded in live history as
`ResponseItem::AgentMessage`, but rollouts stored
`InterAgentCommunication` and rebuilt the response item during resume.
This made the rollout differ from the actual Responses history.

## What changed

- store the prepared `agent_message` response item directly
- keep `trigger_turn` in a small local metadata record for fork
truncation
- keep reading older `inter_agent_communication` rollout items
This commit is contained in:
jif authored and GitHub committed 2026-06-24 15:43:10 +01:00
1 parent f959e7fc98
commit b4f0f3eff1
19 files changed
+144 -17

No files matched your search

+3 -1
View File
@@ -1151,6 +1151,7 @@ async fn read_head_summary(path: &Path, head_limit: usize) -> io::Result<HeadTai
.created_at
.get_or_insert_with(|| rollout_line.timestamp.clone());
}
RolloutItem::InterAgentCommunicationMetadata { .. } => {}
RolloutItem::TurnContext(_) => {
// Not included in `head`; skip.
}
@@ -1213,7 +1214,8 @@ pub async fn read_head_for_summary(path: &Path) -> io::Result<Vec<serde_json::Va
head.push(value);
}
}
RolloutItem::Compacted(_)
RolloutItem::InterAgentCommunicationMetadata { .. }
| RolloutItem::Compacted(_)
| RolloutItem::TurnContext(_)
| RolloutItem::EventMsg(_) => {}
}