Simplify realtime final answer filtering

This commit is contained in:
Ahmed Ibrahim
2026-04-14 00:16:43 -07:00
parent 4d3a5dc799
commit 42aa5bc802
2 changed files with 6 additions and 23 deletions

View File

@@ -2936,14 +2936,10 @@ impl Session {
}
async fn maybe_clear_realtime_handoff_for_event(&self, msg: &EventMsg) {
let EventMsg::TurnComplete(event) = msg else {
if !matches!(msg, EventMsg::TurnComplete(_)) {
return;
};
if let Err(err) = self
.conversation
.handoff_complete(event.last_agent_message.clone())
.await
{
}
if let Err(err) = self.conversation.handoff_complete().await {
debug!("failed to finalize realtime handoff output: {err}");
}
self.conversation.clear_active_handoff().await;

View File

@@ -448,10 +448,7 @@ impl RealtimeConversationManager {
Ok(())
}
pub(crate) async fn handoff_complete(
&self,
final_output_text: Option<String>,
) -> CodexResult<()> {
pub(crate) async fn handoff_complete(&self) -> CodexResult<()> {
let handoff = {
let guard = self.state.lock().await;
guard.as_ref().map(|state| state.handoff.clone())
@@ -467,19 +464,9 @@ impl RealtimeConversationManager {
let Some(handoff_id) = handoff.active_handoff.lock().await.clone() else {
return Ok(());
};
let output_text = match final_output_text {
Some(output_text) => output_text,
None => {
let Some(output_text) = handoff.last_output_text.lock().await.clone() else {
return Ok(());
};
output_text
}
};
if output_text.is_empty() {
let Some(output_text) = handoff.last_output_text.lock().await.clone() else {
return Ok(());
}
};
handoff
.output_tx