summaryrefslogtreecommitdiff
path: root/makima/src/server/handlers/mesh.rs
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-01-23 23:52:35 +0000
committersoryu <soryu@soryu.co>2026-01-23 23:52:35 +0000
commit579c983d3efb8f1414ffb45b9e031f741cce5f76 (patch)
tree1a0060f19a4f4eea8fb9cff9eb52a46cedcdc152 /makima/src/server/handlers/mesh.rs
parentf6f0790217d4098ffb6d2b3df08b0cf83ff61727 (diff)
downloadsoryu-579c983d3efb8f1414ffb45b9e031f741cce5f76.tar.gz
soryu-579c983d3efb8f1414ffb45b9e031f741cce5f76.zip
Add resume to daemon tasks
Diffstat (limited to 'makima/src/server/handlers/mesh.rs')
-rw-r--r--makima/src/server/handlers/mesh.rs29
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!(