diff options
Diffstat (limited to 'makima')
| -rw-r--r-- | makima/src/server/handlers/mesh_supervisor.rs | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/makima/src/server/handlers/mesh_supervisor.rs b/makima/src/server/handlers/mesh_supervisor.rs index 0bb58ed..57f3f2f 100644 --- a/makima/src/server/handlers/mesh_supervisor.rs +++ b/makima/src/server/handlers/mesh_supervisor.rs @@ -1925,13 +1925,27 @@ pub async fn resume_supervisor( } }; - // Check if already running + // Check if already running - but only if daemon is actually connected + // (daemon disconnect handler may not have updated status yet) if supervisor_task.status == "running" { - return ( - StatusCode::CONFLICT, - Json(ApiError::new("ALREADY_RUNNING", "Supervisor is already running")), - ) - .into_response(); + let daemon_connected = supervisor_task + .daemon_id + .map(|d| state.is_daemon_connected(d)) + .unwrap_or(false); + + if daemon_connected { + return ( + StatusCode::CONFLICT, + Json(ApiError::new("ALREADY_RUNNING", "Supervisor is already running")), + ) + .into_response(); + } + // Daemon not connected - allow resume (treat as interrupted) + tracing::info!( + supervisor_task_id = %supervisor_task.id, + daemon_id = ?supervisor_task.daemon_id, + "Supervisor status is 'running' but daemon is not connected, allowing resume" + ); } // Calculate message count from conversation history |
