diff options
Diffstat (limited to 'makima/src/server/handlers/mesh.rs')
| -rw-r--r-- | makima/src/server/handlers/mesh.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/makima/src/server/handlers/mesh.rs b/makima/src/server/handlers/mesh.rs index 545d1ea..19958e7 100644 --- a/makima/src/server/handlers/mesh.rs +++ b/makima/src/server/handlers/mesh.rs @@ -599,6 +599,16 @@ pub async fn start_task( .into_response(); } + // Get local_only flag from contract if task has one + let local_only = if let Some(contract_id) = task.contract_id { + match repository::get_contract_for_owner(pool, contract_id, auth.owner_id).await { + Ok(Some(contract)) => contract.local_only, + _ => false, + } + } else { + false + }; + // Get list of daemons that have previously failed this task let mut exclude_daemon_ids: Vec<Uuid> = task.failed_daemon_ids.clone().unwrap_or_default(); @@ -694,6 +704,7 @@ pub async fn start_task( conversation_history: None, patch_data: None, patch_base_sha: None, + local_only, }; tracing::info!( @@ -746,6 +757,7 @@ pub async fn start_task( conversation_history: None, patch_data: None, patch_base_sha: None, + local_only, }; if state.send_daemon_command(alt_daemon_id, alt_command).await.is_ok() { @@ -1128,6 +1140,16 @@ pub async fn send_message( }; if let Ok(Some(updated_task)) = repository::update_task_for_owner(pool, id, auth.owner_id, update_req).await { + // Get local_only from contract if task has one + let local_only = if let Some(contract_id) = updated_task.contract_id { + match repository::get_contract_for_owner(pool, contract_id, auth.owner_id).await { + Ok(Some(contract)) => contract.local_only, + _ => false, + } + } else { + false + }; + // Send spawn command to new daemon let spawn_cmd = DaemonCommand::SpawnTask { task_id: id, @@ -1150,6 +1172,7 @@ pub async fn send_message( conversation_history: None, patch_data: None, patch_base_sha: None, + local_only, }; if state.send_daemon_command(new_daemon_id, spawn_cmd).await.is_ok() { @@ -2293,6 +2316,16 @@ pub async fn reassign_task( } }; + // Get local_only from contract if task has one + let local_only = if let Some(contract_id) = task.contract_id { + match repository::get_contract_for_owner(pool, contract_id, auth.owner_id).await { + Ok(Some(contract)) => contract.local_only, + _ => false, + } + } else { + false + }; + // Send SpawnTask command to daemon for the new task let command = DaemonCommand::SpawnTask { task_id: new_task.id, @@ -2315,6 +2348,7 @@ pub async fn reassign_task( conversation_history: None, patch_data, patch_base_sha, + local_only, }; tracing::info!( @@ -2620,6 +2654,16 @@ pub async fn continue_task( }; let is_orchestrator = task.depth == 0 && subtask_count > 0; + // Get local_only from contract if task has one + let local_only = if let Some(contract_id) = task.contract_id { + match repository::get_contract_for_owner(pool, contract_id, auth.owner_id).await { + Ok(Some(contract)) => contract.local_only, + _ => false, + } + } else { + false + }; + // Send SpawnTask command to daemon let command = DaemonCommand::SpawnTask { task_id: id, @@ -2642,6 +2686,7 @@ pub async fn continue_task( conversation_history: None, patch_data: None, patch_base_sha: None, + local_only, }; tracing::info!( @@ -3562,6 +3607,7 @@ pub async fn branch_task( conversation_history: updated_task.conversation_state.clone(), patch_data, patch_base_sha, + local_only: false, // No contract, so not local_only }; if let Err(e) = state.send_daemon_command(target_daemon_id, command).await { |
