diff --git a/crates/forge_app/src/hooks/title_generation.rs b/crates/forge_app/src/hooks/title_generation.rs index 262b35bdcf..5984ccab52 100644 --- a/crates/forge_app/src/hooks/title_generation.rs +++ b/crates/forge_app/src/hooks/title_generation.rs @@ -105,9 +105,14 @@ impl EventHandle> for TitleGenerationHand impl Drop for TitleGenerationHandler { fn drop(&mut self) { - // Clearing the map drops all `JoinHandle`s (aborting the spawned - // tasks) and `oneshot::Receiver`s. The tasks will observe a closed - // channel on `tx.send()` and exit gracefully. + // Explicitly abort every spawned task before clearing the map. + // Dropping a `JoinHandle` does *not* abort the underlying Tokio task — + // the task would keep running until completion. Calling `.abort()` + // ensures the tasks are cancelled immediately so the runtime can + // shut down cleanly without waiting for pending LLM calls. + for entry in self.title_tasks.iter() { + entry.handle.abort(); + } self.title_tasks.clear(); } }