Handle partial answers consistently across agent workflows (#51249)

## Why

Partial answers contain answer fragments while a turn is still in progress. Treating them as final answers defers mailbox delivery and can count empty fragments as empty final responses; filtering them from forked histories and guardian transcripts loses answer content.

## What changed

- Allow mailbox preemption after `partial_answer` messages and keep mailbox delivery open.
- Preserve partial answers in forked agent histories and include them as protected assistant entries in guardian transcripts.
- Exclude empty partial answers from empty-final-response accounting for goals.

## Testing

Add regression coverage for partial-answer phases in live events, sampling continuations, follow-up requests, and forked child requests, plus mailbox preemption, goal accounting, and guardian transcript inclusion.

GitOrigin-RevId: 208c8933e211b42b6c2d0bec6952527b8c9c120e
This commit is contained in:
rb-oai
2026-10-06 03:27:04 +00:00
committed by copyberry
parent 8b6bb1c77d
commit 989c01a41a
16 changed files with 408 additions and 22 deletions
@@ -131,6 +131,15 @@ fn registered_transcript_filters_roles_and_preserves_node_repl_tool_attribution(
phase: None,
internal_chat_message_metadata_passthrough: None,
},
ResponseItem::Message {
id: None,
role: "assistant".to_string(),
content: vec![ContentItem::OutputText {
text: "The first result is ready.".to_string(),
}],
phase: Some(MessagePhase::PartialAnswer),
internal_chat_message_metadata_passthrough: None,
},
ResponseItem::Message {
id: None,
role: "assistant".to_string(),
@@ -187,6 +196,10 @@ fn registered_transcript_filters_roles_and_preserves_node_repl_tool_attribution(
"Inspect the workspace."
),
entry(ConversationTranscriptEntryKind::Developer, &approved_action),
entry(
ConversationTranscriptEntryKind::ProtectedAssistant,
"The first result is ready."
),
entry(
ConversationTranscriptEntryKind::ProtectedAssistant,
"Inspection complete."