fix: keep in-flight cleanup internal
This commit is contained in:
@@ -363,10 +363,6 @@ pub enum Event {
|
||||
max_attempts: u32,
|
||||
reason: String,
|
||||
},
|
||||
/// Any transient streaming blocks that were not committed to history were
|
||||
/// discarded at a run boundary. Clients should remove live in-flight lines
|
||||
/// without modifying persisted transcript entries.
|
||||
InFlightCleared,
|
||||
TextDelta {
|
||||
text: String,
|
||||
},
|
||||
|
||||
@@ -1030,12 +1030,6 @@ impl App {
|
||||
"LLM stream interrupted; continuing generation ({attempt}/{max_attempts}): {reason}"
|
||||
));
|
||||
}
|
||||
Event::InFlightCleared => {
|
||||
self.assistant_streaming = false;
|
||||
self.latest_llm_wait_event = None;
|
||||
self.mark_orphan_tool_calls_incomplete();
|
||||
self.current_tool = None;
|
||||
}
|
||||
Event::TextDelta { text } => {
|
||||
self.latest_llm_wait_event = None;
|
||||
self.append_assistant_text(&text);
|
||||
|
||||
@@ -202,13 +202,8 @@ impl InFlightEvents {
|
||||
}
|
||||
|
||||
pub(crate) fn clear(&self) {
|
||||
let cleared = {
|
||||
let mut inner = self.lock();
|
||||
inner.clear()
|
||||
};
|
||||
if cleared {
|
||||
let _ = self.event_tx.send(Event::InFlightCleared);
|
||||
}
|
||||
let mut inner = self.lock();
|
||||
inner.clear();
|
||||
}
|
||||
|
||||
fn lock(&self) -> MutexGuard<'_, InFlightInner> {
|
||||
@@ -589,7 +584,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clear_discards_uncommitted_blocks_and_notifies_clients() {
|
||||
fn clear_discards_uncommitted_blocks_without_protocol_event() {
|
||||
let (event_tx, _) = broadcast::channel(16);
|
||||
let mut rx = event_tx.subscribe();
|
||||
let in_flight = InFlightEvents::new(event_tx);
|
||||
@@ -615,7 +610,6 @@ mod tests {
|
||||
rx.try_recv().unwrap(),
|
||||
Event::ToolCallArgsDelta { .. }
|
||||
));
|
||||
assert!(matches!(rx.try_recv().unwrap(), Event::InFlightCleared));
|
||||
assert!(rx.try_recv().is_err());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user