Restore phase when loading from history (#12244)

This commit is contained in:
Jack Mousseau
2026-02-19 09:56:56 -08:00
committed by GitHub
Unverified
parent f2d5842ed1
commit 3a951f8096
15 changed files with 144 additions and 9 deletions
+1 -2
View File
@@ -190,13 +190,12 @@ impl AgentMessageItem {
}
pub fn as_legacy_events(&self) -> Vec<EventMsg> {
// Legacy events only preserve visible assistant text; `phase` has no
// representation in the v1 event stream.
self.content
.iter()
.map(|c| match c {
AgentMessageContent::Text { text } => EventMsg::AgentMessage(AgentMessageEvent {
message: text.clone(),
phase: self.phase.clone(),
}),
})
.collect()
+3
View File
@@ -32,6 +32,7 @@ use crate::mcp::Tool as McpTool;
use crate::message_history::HistoryEntry;
use crate::models::BaseInstructions;
use crate::models::ContentItem;
use crate::models::MessagePhase;
use crate::models::ResponseItem;
use crate::models::WebSearchAction;
use crate::num_format::format_with_separators;
@@ -1580,6 +1581,8 @@ impl fmt::Display for FinalOutput {
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
pub struct AgentMessageEvent {
pub message: String,
#[serde(default)]
pub phase: Option<MessagePhase>,
}
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]