Preserve Guardian user answers from current history (#41857)

## What changed

Match recorded user-input tool calls against both the current conversation and
retained review history when collecting Guardian review evidence. This keeps
answers available when their original tool call exists in either history.

GitOrigin-RevId: e511e2d252d31fa8658c34db19f0151699e9a34a
This commit is contained in:
jif
2026-08-31 14:54:13 +00:00
committed by copyberry
parent 9d19c7426e
commit 98a8425e22
@@ -95,14 +95,14 @@ impl GuardianReviewEvidence {
}
}
/// Returns bounded answers whose original, host-observed tool calls remain in review history.
/// Returns bounded answers whose original tool calls remain in current or retained history.
pub fn user_input_fragments(&self, history: &dyn ConversationHistorySnapshot) -> Vec<String> {
let state = self.0.lock().unwrap_or_else(PoisonError::into_inner);
state
.user_inputs
.iter()
.filter(|(recorded_call_id, _)| {
history.review_items().any(|item| {
history.items().chain(history.review_items()).any(|item| {
matches!(
item,
ResponseItem::FunctionCall { call_id, .. }