diff options
Diffstat (limited to 'makima/src/daemon/task')
| -rw-r--r-- | makima/src/daemon/task/manager.rs | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/makima/src/daemon/task/manager.rs b/makima/src/daemon/task/manager.rs index 1e05978..dd133a2 100644 --- a/makima/src/daemon/task/manager.rs +++ b/makima/src/daemon/task/manager.rs @@ -2021,7 +2021,7 @@ impl TaskManager { tracing::info!( task_id = %task_id, title = %title, - base_branch = %base_branch, + base_branch = ?base_branch, branch = %branch, "Creating pull request" ); @@ -3136,7 +3136,7 @@ impl TaskManager { task_id: Uuid, title: String, body: Option<String>, - base_branch: String, + base_branch: Option<String>, branch: String, ) -> Result<(), DaemonError> { // Get worktree path - this works even for completed tasks by scanning worktrees directory @@ -3156,6 +3156,31 @@ impl TaskManager { } }; + // Detect base branch if not provided + let base_branch = match base_branch { + Some(b) => b, + None => { + match self.worktree_manager.detect_default_branch(&worktree_path).await { + Ok(detected) => { + tracing::info!(task_id = %task_id, detected_branch = %detected, "Auto-detected base branch"); + detected + } + Err(e) => { + tracing::error!(task_id = %task_id, error = %e, "Failed to detect default branch"); + let msg = DaemonMessage::PRCreated { + task_id, + success: false, + message: format!("Failed to detect default branch: {}", e), + pr_url: None, + pr_number: None, + }; + let _ = self.ws_tx.send(msg).await; + return Ok(()); + } + } + } + }; + tracing::info!( task_id = %task_id, base_branch = %base_branch, |
