Better notifications when task finishes (vibe-kanban) (#124)
* 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
This commit is contained in:
committed by
GitHub
parent
3ab9b3ee4d
commit
35b2631ba6
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user