diff --git a/server/src/session/claude.rs b/server/src/session/claude.rs index a036f2a..138a013 100644 --- a/server/src/session/claude.rs +++ b/server/src/session/claude.rs @@ -150,10 +150,22 @@ impl Queue { /// Reported rather than dropped. These are messages somebody typed /// that never reached the session and never reached the transcript, so /// this is the only place they can be mentioned at all. + /// + /// Each one is also *resolved*, with the same `MessageDropped` that a + /// phone tapping the bubble produces. Without it the bubble sat there + /// for good: a message drawn as waiting to be read, by a session that + /// no longer exists, with the only thing that ever clears it -- the + /// `UserMessage` -- exactly what is not coming. The error says what + /// happened and the drop is what ends it, which is the same division + /// of labour as everywhere else here. fn close(&mut self, sink: &EventSink, why: &str) { self.closed = true; self.running = false; - let lost: Vec = self.awaiting.drain(..).map(|(_, text, _)| text).collect(); + let lost: Vec<(String, String)> = self + .awaiting + .drain(..) + .map(|(id, text, _)| (id, text)) + .collect(); if lost.is_empty() { return; } @@ -165,9 +177,15 @@ impl Queue { } else { format!("{} queued messages", lost.len()) }, - lost.join(" / ") + lost.iter() + .map(|(_, text)| text.as_str()) + .collect::>() + .join(" / ") ), }); + for (id, _) in lost { + let _ = sink.send(Event::MessageDropped { id }); + } } }