From b28345d15730ffbefe81244d06c06fe13c30b0ea Mon Sep 17 00:00:00 2001 From: soryu Date: Tue, 27 Jan 2026 01:22:11 +0000 Subject: Fix supervisor merge and PR commands (#36) * Task completion checkpoint * Task completion checkpoint * Task completion checkpoint * Fix supervisor merge for completed tasks and make PR command synchronous ## Issue 1: makima supervisor merge doesn't work for completed tasks When a task completes, the daemon removes it from in-memory task tracking. This caused merge operations to fail with "Task not found". Fixed by updating handle_merge_task_to_target() to use get_task_worktree_path() which scans the worktrees directory as a fallback when the task is not in memory. Also updated handle_create_pr() with the same pattern for consistency. ## Issue 2: makima supervisor pr returns immediately without result The create_pr handler was asynchronous - it sent the CreatePR command to the daemon and immediately returned without waiting for the result. Fixed by: 1. Adding PrResultNotification struct and pr_results broadcast channel to AppState 2. Updating mesh_daemon.rs to broadcast PRCreated results to the channel 3. Updating create_pr() handler to subscribe to pr_results and wait for the result with a 60-second timeout (matching the merge command pattern) Now the PR command returns the actual pr_url and pr_number from the daemon. Co-Authored-By: Claude Opus 4.5 --------- Co-authored-by: Claude Opus 4.5 --- makima/src/server/handlers/mesh_daemon.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'makima/src/server/handlers/mesh_daemon.rs') diff --git a/makima/src/server/handlers/mesh_daemon.rs b/makima/src/server/handlers/mesh_daemon.rs index 0aea40e..f7fe49f 100644 --- a/makima/src/server/handlers/mesh_daemon.rs +++ b/makima/src/server/handlers/mesh_daemon.rs @@ -1734,15 +1734,25 @@ async fn handle_daemon_connection(socket: WebSocket, state: SharedState, auth_re success, message, pr_url, - pr_number: _, + pr_number, }) => { tracing::info!( task_id = %task_id, success = success, pr_url = ?pr_url, + pr_number = ?pr_number, "PR created result received" ); + // Broadcast the PR result for waiting handlers + state.broadcast_pr_result(crate::server::state::PrResultNotification { + task_id, + success, + message: message.clone(), + pr_url: pr_url.clone(), + pr_number, + }); + // On successful PR creation, notify supervisor of next steps if success { if let Some(pool) = state.db_pool.as_ref() { -- cgit v1.2.3