Don't play sound if process killed by user (vibe-kanban) (#503)

* Cleanup script changes for task attempt 265a9a86-f5d6-4794-91dd-61a562e72747

* Commit changes from coding agent for task attempt 265a9a86-f5d6-4794-91dd-61a562e72747
This commit is contained in:
Louis Knight-Webb
2025-08-15 18:07:49 +01:00
committed by GitHub
parent 805de837b4
commit 671ffc3799

View File

@@ -14,17 +14,26 @@ use crate::services::config::NotificationConfig;
static WSL_ROOT_PATH_CACHE: OnceLock<Option<String>> = OnceLock::new();
impl NotificationService {
pub async fn notify_execution_halted(config: NotificationConfig, ctx: &ExecutionContext) {
pub async fn notify_execution_halted(mut config: NotificationConfig, ctx: &ExecutionContext) {
// If the process was intentionally killed by user, suppress sound
if matches!(ctx.execution_process.status, ExecutionProcessStatus::Killed) {
config.sound_enabled = false;
}
let title = format!("Task Complete: {}", ctx.task.title);
let message = match ctx.execution_process.status {
ExecutionProcessStatus::Completed => format!(
"✅ '{}' completed successfully\nBranch: {:?}\nExecutor: {}",
ctx.task.title, ctx.task_attempt.branch, ctx.task_attempt.profile
),
ExecutionProcessStatus::Failed | ExecutionProcessStatus::Killed => format!(
ExecutionProcessStatus::Failed => format!(
"❌ '{}' execution failed\nBranch: {:?}\nExecutor: {}",
ctx.task.title, ctx.task_attempt.branch, ctx.task_attempt.profile
),
ExecutionProcessStatus::Killed => format!(
"🛑 '{}' execution cancelled by user\nBranch: {:?}\nExecutor: {}",
ctx.task.title, ctx.task_attempt.branch, ctx.task_attempt.profile
),
_ => {
tracing::warn!(
"Tried to notify attempt completion for {} but process is still running!",