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; }