diff --git a/src/agent/mod.rs b/src/agent/mod.rs index 449c2eb..305721a 100644 --- a/src/agent/mod.rs +++ b/src/agent/mod.rs @@ -380,6 +380,8 @@ impl Agent { /// assistant entry if needed). Called by collect_stream per token batch. fn append_streaming(&mut self, text: &str) { if let Some(idx) = self.streaming_index() { + assert!(!self.context.conversation.entries()[idx].token_ids.is_empty(), + "streaming_index returned entry with empty token_ids at {}", idx); let mut msg = self.context.conversation.entries()[idx].entry.message().clone(); msg.append_content(text); self.context.conversation.set_message(idx, msg);