fix: close early dispatch recovery gaps

This commit is contained in:
2026-09-29 12:37:13 +09:00
parent dcf14ef565
commit 1980da2880
14 changed files with 868 additions and 70 deletions
+21
View File
@@ -50,6 +50,9 @@ pub enum LoggedItem {
role: LoggedRole,
content: Vec<LoggedContentPart>,
},
AssistantResponseBoundary {
response_id: String,
},
ToolCall {
call_id: String,
name: String,
@@ -122,6 +125,9 @@ impl From<&Item> for LoggedItem {
role: (*role).into(),
content: content.iter().map(LoggedContentPart::from).collect(),
},
Item::AssistantResponseBoundary { response_id } => Self::AssistantResponseBoundary {
response_id: response_id.clone(),
},
Item::ToolCall {
call_id,
name,
@@ -185,6 +191,9 @@ impl From<LoggedItem> for Item {
content: content.into_iter().map(Into::into).collect(),
status: None,
},
LoggedItem::AssistantResponseBoundary { response_id } => {
Item::assistant_response_boundary(response_id)
}
LoggedItem::ToolCall {
call_id,
name,
@@ -343,6 +352,18 @@ mod tests {
}
}
#[test]
fn assistant_response_boundary_round_trips_for_provider_projection() {
let original = Item::assistant_response_boundary("response-7");
let logged: LoggedItem = (&original).into();
let json = serde_json::to_string(&logged).unwrap();
assert!(json.contains(r#""kind":"assistant_response_boundary""#));
assert_eq!(
Item::from(serde_json::from_str::<LoggedItem>(&json).unwrap()),
original
);
}
#[test]
fn round_trip_tool_call() {
let original = Item::tool_call("call_42", "get_weather", r#"{"city":"Tokyo"}"#)
+2 -2
View File
@@ -386,8 +386,8 @@ fn project_item(item: &LoggedItem) -> Option<SessionSnapshotEntryData> {
})
.collect(),
}),
// Hidden model reasoning is never observable.
LoggedItem::Reasoning { .. } => None,
// Internal response grouping and hidden model reasoning are never observable.
LoggedItem::AssistantResponseBoundary { .. } | LoggedItem::Reasoning { .. } => None,
}
}