diff options
Diffstat (limited to 'makima')
| -rw-r--r-- | makima/src/db/repository.rs | 13 | ||||
| -rw-r--r-- | makima/src/server/handlers/contract_chat.rs | 16 | ||||
| -rw-r--r-- | makima/src/server/handlers/contracts.rs | 4 | ||||
| -rw-r--r-- | makima/src/server/handlers/mesh.rs | 12 | ||||
| -rw-r--r-- | makima/src/server/handlers/mesh_chat.rs | 4 | ||||
| -rw-r--r-- | makima/src/server/handlers/mesh_supervisor.rs | 4 | ||||
| -rw-r--r-- | makima/src/server/handlers/transcript_analysis.rs | 8 |
7 files changed, 44 insertions, 17 deletions
diff --git a/makima/src/db/repository.rs b/makima/src/db/repository.rs index 95b4d70..33e48a4 100644 --- a/makima/src/db/repository.rs +++ b/makima/src/db/repository.rs @@ -654,8 +654,8 @@ pub async fn create_task(pool: &PgPool, req: CreateTaskRequest) -> Result<Task, let new_depth = parent.depth + 1; - // Subtasks inherit contract_id from parent - let contract_id = parent.contract_id.unwrap_or(req.contract_id); + // Subtasks inherit contract_id from parent (or use request contract_id if parent has none) + let contract_id = parent.contract_id.or(req.contract_id); // Inherit repo settings if not provided let repo_url = req.repository_url.clone().or(parent.repository_url); @@ -669,7 +669,7 @@ pub async fn create_task(pool: &PgPool, req: CreateTaskRequest) -> Result<Task, (new_depth, contract_id, repo_url, base_branch, target_branch, merge_mode, target_repo_path, completion_action) } else { - // Top-level task: depth 0, use contract_id from request + // Top-level task: depth 0, use contract_id from request (may be None for branched tasks) ( 0, req.contract_id, @@ -689,9 +689,10 @@ pub async fn create_task(pool: &PgPool, req: CreateTaskRequest) -> Result<Task, INSERT INTO tasks ( contract_id, parent_task_id, depth, name, description, plan, priority, is_supervisor, repository_url, base_branch, target_branch, merge_mode, - target_repo_path, completion_action, continue_from_task_id, copy_files + target_repo_path, completion_action, continue_from_task_id, copy_files, + branched_from_task_id, conversation_state ) - VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16) + VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18) RETURNING * "#, ) @@ -711,6 +712,8 @@ pub async fn create_task(pool: &PgPool, req: CreateTaskRequest) -> Result<Task, .bind(&completion_action) .bind(&req.continue_from_task_id) .bind(©_files_json) + .bind(&req.branched_from_task_id) + .bind(&req.conversation_history) .fetch_one(pool) .await } diff --git a/makima/src/server/handlers/contract_chat.rs b/makima/src/server/handlers/contract_chat.rs index 0f794c1..c94538d 100644 --- a/makima/src/server/handlers/contract_chat.rs +++ b/makima/src/server/handlers/contract_chat.rs @@ -1356,7 +1356,7 @@ async fn handle_contract_request( }; let create_req = CreateTaskRequest { - contract_id, + contract_id: Some(contract_id), name: name.clone(), description: None, plan, @@ -1372,6 +1372,8 @@ async fn handle_contract_request( copy_files: None, is_supervisor: false, checkpoint_sha: None, + branched_from_task_id: None, + conversation_history: None, }; match repository::create_task_for_owner(pool, owner_id, create_req).await { @@ -1450,7 +1452,7 @@ async fn handle_contract_request( ); let create_req = CreateTaskRequest { - contract_id, + contract_id: Some(contract_id), name: task_name.clone(), description: Some(instruction.clone()), plan, @@ -1466,6 +1468,8 @@ async fn handle_contract_request( copy_files: None, is_supervisor: false, checkpoint_sha: None, + branched_from_task_id: None, + conversation_history: None, }; match repository::create_task_for_owner(pool, owner_id, create_req).await { @@ -2054,7 +2058,7 @@ async fn handle_contract_request( for task_def in &tasks { let create_req = CreateTaskRequest { - contract_id, + contract_id: Some(contract_id), name: task_def.name.clone(), description: None, plan: task_def.plan.clone(), @@ -2070,6 +2074,8 @@ async fn handle_contract_request( copy_files: None, is_supervisor: false, checkpoint_sha: None, + branched_from_task_id: None, + conversation_history: None, }; match repository::create_task_for_owner(pool, owner_id, create_req).await { @@ -2564,7 +2570,7 @@ async fn handle_contract_request( if include_action_items && !analysis.action_items.is_empty() { for item in &analysis.action_items { let task_req = CreateTaskRequest { - contract_id: contract.id, + contract_id: Some(contract.id), name: item.text.chars().take(100).collect(), description: Some(format!("Action item from: {}", item.speaker)), plan: item.text.clone(), @@ -2584,6 +2590,8 @@ async fn handle_contract_request( copy_files: None, is_supervisor: false, checkpoint_sha: None, + branched_from_task_id: None, + conversation_history: None, }; if repository::create_task_for_owner(pool, owner_id, task_req).await.is_ok() { diff --git a/makima/src/server/handlers/contracts.rs b/makima/src/server/handlers/contracts.rs index 11337f2..462b385 100644 --- a/makima/src/server/handlers/contracts.rs +++ b/makima/src/server/handlers/contracts.rs @@ -287,7 +287,7 @@ pub async fn create_contract( base_branch: None, target_branch: None, parent_task_id: None, - contract_id: contract.id, + contract_id: Some(contract.id), target_repo_path: None, completion_action: None, continue_from_task_id: None, @@ -296,6 +296,8 @@ pub async fn create_contract( checkpoint_sha: None, priority: 0, merge_mode: None, + branched_from_task_id: None, + conversation_history: None, }; match repository::create_task_for_owner(pool, auth.owner_id, supervisor_req).await { diff --git a/makima/src/server/handlers/mesh.rs b/makima/src/server/handlers/mesh.rs index b6eadf1..99c3d9d 100644 --- a/makima/src/server/handlers/mesh.rs +++ b/makima/src/server/handlers/mesh.rs @@ -2197,7 +2197,7 @@ pub async fn reassign_task( // Create a NEW task with the conversation context let create_req = CreateTaskRequest { - contract_id: task.contract_id.unwrap_or(Uuid::nil()), + contract_id: task.contract_id, name: format!("{} (resumed)", task.name), description: task.description.clone(), plan: updated_plan.clone(), @@ -2213,6 +2213,8 @@ pub async fn reassign_task( continue_from_task_id: Some(id), // Continue from the old task's worktree if possible copy_files: None, checkpoint_sha: task.last_checkpoint_sha.clone(), + branched_from_task_id: None, + conversation_history: None, }; let new_task = match repository::create_task_for_owner(pool, auth.owner_id, create_req).await { @@ -2914,7 +2916,7 @@ pub async fn fork_task( // Create the new forked task let create_req = CreateTaskRequest { - contract_id: task.contract_id.unwrap_or(Uuid::nil()), + contract_id: task.contract_id, name: req.new_task_name.clone(), description: task.description.clone(), plan: req.new_task_plan.clone(), @@ -2930,6 +2932,8 @@ pub async fn fork_task( continue_from_task_id: None, copy_files: None, checkpoint_sha: Some(checkpoint.commit_sha.clone()), + branched_from_task_id: None, + conversation_history: None, }; let new_task = match repository::create_task_for_owner(pool, auth.owner_id, create_req).await { @@ -3069,7 +3073,7 @@ pub async fn resume_from_checkpoint( }); let create_req = CreateTaskRequest { - contract_id: task.contract_id.unwrap_or(Uuid::nil()), + contract_id: task.contract_id, name: task_name, description: task.description.clone(), plan: req.plan, @@ -3085,6 +3089,8 @@ pub async fn resume_from_checkpoint( continue_from_task_id: Some(task_id), // Copy worktree from original task copy_files: None, checkpoint_sha: Some(checkpoint.commit_sha.clone()), + branched_from_task_id: None, + conversation_history: None, }; let new_task = match repository::create_task_for_owner(pool, auth.owner_id, create_req).await { diff --git a/makima/src/server/handlers/mesh_chat.rs b/makima/src/server/handlers/mesh_chat.rs index c468446..0fc5513 100644 --- a/makima/src/server/handlers/mesh_chat.rs +++ b/makima/src/server/handlers/mesh_chat.rs @@ -1002,7 +1002,7 @@ async fn handle_mesh_request( }; let create_req = CreateTaskRequest { - contract_id, + contract_id: Some(contract_id), name: name.clone(), description: None, plan, @@ -1018,6 +1018,8 @@ async fn handle_mesh_request( copy_files: None, is_supervisor: false, checkpoint_sha: None, + branched_from_task_id: None, + conversation_history: None, }; match repository::create_task_for_owner(pool, owner_id, create_req).await { diff --git a/makima/src/server/handlers/mesh_supervisor.rs b/makima/src/server/handlers/mesh_supervisor.rs index df8f77c..8f4cfc4 100644 --- a/makima/src/server/handlers/mesh_supervisor.rs +++ b/makima/src/server/handlers/mesh_supervisor.rs @@ -554,7 +554,7 @@ pub async fn spawn_task( description: None, plan: request.plan.clone(), repository_url: repo_url.clone(), - contract_id: request.contract_id, + contract_id: Some(request.contract_id), parent_task_id: request.parent_task_id, is_supervisor: false, checkpoint_sha: request.checkpoint_sha.clone(), @@ -566,6 +566,8 @@ pub async fn spawn_task( completion_action: None, continue_from_task_id: None, copy_files: None, + branched_from_task_id: None, + conversation_history: None, }; // Create task in DB diff --git a/makima/src/server/handlers/transcript_analysis.rs b/makima/src/server/handlers/transcript_analysis.rs index 99f9ea7..3b71eca 100644 --- a/makima/src/server/handlers/transcript_analysis.rs +++ b/makima/src/server/handlers/transcript_analysis.rs @@ -344,7 +344,7 @@ pub async fn create_contract_from_analysis( if request.include_action_items && !analysis.action_items.is_empty() { for item in &analysis.action_items { let task_req = models::CreateTaskRequest { - contract_id: contract.id, + contract_id: Some(contract.id), name: truncate_for_name(&item.text, 100), description: Some(format!("Action item from transcript (Speaker: {})", item.speaker)), plan: item.text.clone(), @@ -364,6 +364,8 @@ pub async fn create_contract_from_analysis( _ => 0, }, merge_mode: None, + branched_from_task_id: None, + conversation_history: None, }; if let Ok(t) = repository::create_task_for_owner(pool, auth.owner_id, task_req).await { @@ -515,7 +517,7 @@ pub async fn update_contract_from_analysis( if request.create_tasks && !analysis.action_items.is_empty() { for item in &analysis.action_items { let task_req = models::CreateTaskRequest { - contract_id: request.contract_id, + contract_id: Some(request.contract_id), name: truncate_for_name(&item.text, 100), description: Some(format!("Action item from {} (Speaker: {})", file.name, item.speaker)), plan: item.text.clone(), @@ -531,6 +533,8 @@ pub async fn update_contract_from_analysis( checkpoint_sha: None, priority: 0, merge_mode: None, + branched_from_task_id: None, + conversation_history: None, }; if let Ok(t) = repository::create_task_for_owner(pool, auth.owner_id, task_req).await { |
