From 35b2631ba67ea3df09555c8ab707f16b9855eb55 Mon Sep 17 00:00:00 2001 From: Louis Knight-Webb Date: Thu, 10 Jul 2025 15:45:38 +0100 Subject: [PATCH] Better notifications when task finishes (vibe-kanban) (#124) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Perfect! The implementation is complete and the code compiles successfully. Here's what I've improved: ## Enhanced Task Completion Notifications The notifications now include much more useful information: **Before:** - Title: "Task Complete" - Message: "Task execution completed successfully" or "Task execution failed" **After:** - Title: "Task Complete: [actual task title]" - Message: Includes task name, branch, executor, and visual indicators: - ✅ For success: `"✅ 'Task Name' completed successfully\nBranch: feature/task-123\nExecutor: claude-3-5-sonnet"` - ❌ For failure: `"❌ 'Task Name' execution failed\nBranch: feature/task-123\nExecutor: claude-3-5-sonnet"` The implementation maintains backward compatibility with proper fallbacks if task or task attempt details can't be retrieved. The notifications now provide meaningful context about which specific task completed, what branch it was working on, and which executor was used. * fmt --- backend/src/execution_monitor.rs | 48 ++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/backend/src/execution_monitor.rs b/backend/src/execution_monitor.rs index add1bd30..de17aba5 100644 --- a/backend/src/execution_monitor.rs +++ b/backend/src/execution_monitor.rs @@ -804,15 +804,53 @@ async fn handle_coding_agent_completion( }; let notification_service = NotificationService::new(notification_config); - let notification_title = "Task Complete"; - let notification_message = if success { - "Task execution completed successfully" + + // Get task attempt and task details for richer notification + let (notification_title, notification_message) = if let Ok(Some(task_attempt)) = + TaskAttempt::find_by_id(&app_state.db_pool, task_attempt_id).await + { + if let Ok(Some(task)) = Task::find_by_id(&app_state.db_pool, task_attempt.task_id).await + { + let title = format!("Task Complete: {}", task.title); + let message = if success { + format!( + "✅ '{}' completed successfully\nBranch: {}\nExecutor: {}", + task.title, + task_attempt.branch, + task_attempt.executor.as_deref().unwrap_or("default") + ) + } else { + format!( + "❌ '{}' execution failed\nBranch: {}\nExecutor: {}", + task.title, + task_attempt.branch, + task_attempt.executor.as_deref().unwrap_or("default") + ) + }; + (title, message) + } else { + // Fallback if task not found + let title = "Task Complete"; + let message = if success { + "Task execution completed successfully" + } else { + "Task execution failed" + }; + (title.to_string(), message.to_string()) + } } else { - "Task execution failed" + // Fallback if task attempt not found + let title = "Task Complete"; + let message = if success { + "Task execution completed successfully" + } else { + "Task execution failed" + }; + (title.to_string(), message.to_string()) }; notification_service - .notify(notification_title, notification_message, &sound_file) + .notify(¬ification_title, ¬ification_message, &sound_file) .await; }