From b0d0b4848b2fc8a44c2575e09a08b34aaf6e1484 Mon Sep 17 00:00:00 2001 From: soryu Date: Tue, 27 Jan 2026 01:25:29 +0000 Subject: Default to shared worktree and add worktree endpoint --- makima/src/server/handlers/mesh_supervisor.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'makima/src/server/handlers/mesh_supervisor.rs') diff --git a/makima/src/server/handlers/mesh_supervisor.rs b/makima/src/server/handlers/mesh_supervisor.rs index 24ba4bb..1a2e47f 100644 --- a/makima/src/server/handlers/mesh_supervisor.rs +++ b/makima/src/server/handlers/mesh_supervisor.rs @@ -36,6 +36,10 @@ pub struct SpawnTaskRequest { pub checkpoint_sha: Option, /// Repository URL for the task (optional - if not provided, will be looked up from contract). pub repository_url: Option, + /// If true, create a separate worktree for the task (requires merge after). + /// If false (default), the task shares the supervisor's worktree. + #[serde(default)] + pub use_own_worktree: bool, } /// Request to wait for task completion. @@ -406,6 +410,8 @@ pub async fn try_start_pending_task( patch_data, patch_base_sha, local_only: contract.local_only, + // For retried tasks, use their own worktree (they already have state from previous attempt) + supervisor_worktree_task_id: None, }; if let Err(e) = state.send_daemon_command(daemon.id, cmd).await { @@ -720,6 +726,8 @@ pub async fn spawn_task( patch_data: None, patch_base_sha: None, local_only: contract.local_only, + // Share supervisor's worktree by default; separate worktree only when explicitly requested + supervisor_worktree_task_id: if request.use_own_worktree { None } else { Some(supervisor_id) }, }; if let Err(e) = state.send_daemon_command(daemon.id, cmd).await { @@ -2248,6 +2256,7 @@ pub async fn resume_supervisor( patch_data, patch_base_sha, local_only: contract.local_only, + supervisor_worktree_task_id: None, // Supervisor uses its own worktree }; if let Err(e) = state.send_daemon_command(target_daemon_id, command).await { -- cgit v1.2.3