diff options
Diffstat (limited to 'makima/src/server/handlers/mesh.rs')
| -rw-r--r-- | makima/src/server/handlers/mesh.rs | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/makima/src/server/handlers/mesh.rs b/makima/src/server/handlers/mesh.rs index 240e1f7..3d05f35 100644 --- a/makima/src/server/handlers/mesh.rs +++ b/makima/src/server/handlers/mesh.rs @@ -6,6 +6,7 @@ use axum::{ response::IntoResponse, Json, }; +use base64::Engine; use uuid::Uuid; use crate::db::models::{ @@ -2265,6 +2266,30 @@ pub async fn reassign_task( } }; + // Fetch latest checkpoint patch for worktree recovery during reassignment + let (patch_data, patch_base_sha) = match repository::get_latest_checkpoint_patch(pool, id).await { + Ok(Some(patch)) => { + tracing::info!( + old_task_id = %id, + new_task_id = %new_task.id, + patch_size = patch.patch_size_bytes, + base_sha = %patch.base_commit_sha, + files_count = patch.files_count, + "Including checkpoint patch for task reassignment recovery" + ); + let encoded = base64::engine::general_purpose::STANDARD.encode(&patch.patch_data); + (Some(encoded), Some(patch.base_commit_sha)) + } + Ok(None) => { + tracing::debug!(old_task_id = %id, "No checkpoint patch found for reassignment"); + (None, None) + } + Err(e) => { + tracing::warn!(old_task_id = %id, error = %e, "Failed to fetch checkpoint patch for reassignment"); + (None, None) + } + }; + // Send SpawnTask command to daemon for the new task let command = DaemonCommand::SpawnTask { task_id: new_task.id, @@ -2285,8 +2310,8 @@ pub async fn reassign_task( autonomous_loop: false, resume_session: false, conversation_history: None, - patch_data: None, - patch_base_sha: None, + patch_data, + patch_base_sha, }; tracing::info!( |
