chore: add phase to message responseitem (#10455)

### What

add wiring for `phase` field on `ResponseItem::Message` to lay
groundwork for differentiating model preambles and final messages.
currently optional.

follows pattern in #9698.

updated schemas with `just write-app-server-schema` so we can see type
changes.

### Tests
Updated existing tests for SSE parsing and hydrating from history
This commit is contained in:
sayan-oai
2026-02-03 02:52:26 +00:00
committed by GitHub
parent 0999fd82b9
commit fc05374344
46 changed files with 323 additions and 4 deletions
+13
View File
@@ -1834,6 +1834,7 @@ impl Session {
text: format!("Warning: {}", message.into()),
}],
end_turn: None,
phase: None,
};
self.record_conversation_items(ctx, &[item]).await;
@@ -4542,6 +4543,7 @@ mod tests {
text: text.to_string(),
}],
end_turn: None,
phase: None,
}
}
@@ -4823,6 +4825,7 @@ mod tests {
text: "turn 1 user".to_string(),
}],
end_turn: None,
phase: None,
},
ResponseItem::Message {
id: None,
@@ -4831,6 +4834,7 @@ mod tests {
text: "turn 1 assistant".to_string(),
}],
end_turn: None,
phase: None,
},
];
sess.record_into_history(&turn_1, tc.as_ref()).await;
@@ -4843,6 +4847,7 @@ mod tests {
text: "turn 2 user".to_string(),
}],
end_turn: None,
phase: None,
},
ResponseItem::Message {
id: None,
@@ -4851,6 +4856,7 @@ mod tests {
text: "turn 2 assistant".to_string(),
}],
end_turn: None,
phase: None,
},
];
sess.record_into_history(&turn_2, tc.as_ref()).await;
@@ -4883,6 +4889,7 @@ mod tests {
text: "turn 1 user".to_string(),
}],
end_turn: None,
phase: None,
}];
sess.record_into_history(&turn_1, tc.as_ref()).await;
@@ -5832,6 +5839,7 @@ mod tests {
text: "first user".to_string(),
}],
end_turn: None,
phase: None,
};
live_history.record_items(std::iter::once(&user1), turn_context.truncation_policy);
rollout_items.push(RolloutItem::ResponseItem(user1.clone()));
@@ -5843,6 +5851,7 @@ mod tests {
text: "assistant reply one".to_string(),
}],
end_turn: None,
phase: None,
};
live_history.record_items(std::iter::once(&assistant1), turn_context.truncation_policy);
rollout_items.push(RolloutItem::ResponseItem(assistant1.clone()));
@@ -5868,6 +5877,7 @@ mod tests {
text: "second user".to_string(),
}],
end_turn: None,
phase: None,
};
live_history.record_items(std::iter::once(&user2), turn_context.truncation_policy);
rollout_items.push(RolloutItem::ResponseItem(user2.clone()));
@@ -5879,6 +5889,7 @@ mod tests {
text: "assistant reply two".to_string(),
}],
end_turn: None,
phase: None,
};
live_history.record_items(std::iter::once(&assistant2), turn_context.truncation_policy);
rollout_items.push(RolloutItem::ResponseItem(assistant2.clone()));
@@ -5904,6 +5915,7 @@ mod tests {
text: "third user".to_string(),
}],
end_turn: None,
phase: None,
};
live_history.record_items(std::iter::once(&user3), turn_context.truncation_policy);
rollout_items.push(RolloutItem::ResponseItem(user3));
@@ -5915,6 +5927,7 @@ mod tests {
text: "assistant reply three".to_string(),
}],
end_turn: None,
phase: None,
};
live_history.record_items(std::iter::once(&assistant3), turn_context.truncation_policy);
rollout_items.push(RolloutItem::ResponseItem(assistant3));