From 5f7de2eb5dca92be18e24feb455439fc18abd495 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 6 Jan 2025 18:00:13 -0500 Subject: [PATCH] assistant2: Clear all collections when clearing the `ThreadStore` (#22743) This PR adds some missing calls to clear the sub-collections in the `ThreadStore` when we call `ThreadStore::drain` or `ThreadStore::clear`. Release Notes: - N/A --- crates/assistant2/src/context_store.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/assistant2/src/context_store.rs b/crates/assistant2/src/context_store.rs index 9751103fd7..c744393792 100644 --- a/crates/assistant2/src/context_store.rs +++ b/crates/assistant2/src/context_store.rs @@ -37,15 +37,17 @@ impl ContextStore { } pub fn drain(&mut self) -> Vec { - self.files.clear(); - self.directories.clear(); - self.context.drain(..).collect() + let context = self.context.drain(..).collect(); + self.clear(); + context } pub fn clear(&mut self) { self.context.clear(); self.files.clear(); self.directories.clear(); + self.threads.clear(); + self.fetched_urls.clear(); } pub fn insert_file(&mut self, buffer: &Buffer) {