From 0cf6f6a4c5c75c736e6fe3b1c726ef80c0a6c802 Mon Sep 17 00:00:00 2001 From: soryu Date: Sat, 24 Jan 2026 04:31:20 +0000 Subject: feat: implement dependency-ordered task execution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add dependency tracking and validation for tasks to enforce execution order (schema changes → backend → UI) as specified in Section 1.3 of ralph-features-spec.md. Changes: - Add depends_on field to Task model (Vec) for explicit dependencies - Create database migration for depends_on column with GIN index - Add dependency_analysis.rs module with: - can_start_task() for checking if all dependencies are complete - Auto-detection of dependency patterns from file paths - Detection of schema/types/backend/UI categories - Warnings for potential dependency violations - Add DependencyOrderingConfig to daemon config with: - enabled: Enable/disable dependency checking - auto_detect: Auto-detect dependencies from file patterns - warn_on_violation: Warn on detected violations - Integrate dependency checks into task manager scheduling - Add depends_on to DaemonCommand::SpawnTask protocol The daemon performs dependency validation as a sanity check but defers to the server for authoritative scheduling decisions. Co-Authored-By: Claude Opus 4.5 --- makima/src/daemon/ws/protocol.rs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'makima/src/daemon/ws') diff --git a/makima/src/daemon/ws/protocol.rs b/makima/src/daemon/ws/protocol.rs index ec9b09e..7b0a0b4 100644 --- a/makima/src/daemon/ws/protocol.rs +++ b/makima/src/daemon/ws/protocol.rs @@ -60,6 +60,25 @@ pub enum DaemonMessage { error: Option, }, + /// Task recovery detected after daemon restart. + /// Sent when daemon finds orphaned tasks that can be recovered. + TaskRecoveryDetected { + #[serde(rename = "taskId")] + task_id: Uuid, + /// Previous state of the task before daemon restart. + #[serde(rename = "previousState")] + previous_state: String, + /// Whether the worktree is still intact. + #[serde(rename = "worktreeIntact")] + worktree_intact: bool, + /// Path to the worktree if available. + #[serde(rename = "worktreePath")] + worktree_path: Option, + /// Whether the task needs a checkpoint patch for recovery. + #[serde(rename = "needsPatch")] + needs_patch: bool, + }, + /// Register a tool key for orchestrator API access. RegisterToolKey { #[serde(rename = "taskId")] @@ -403,6 +422,10 @@ pub enum DaemonCommand { /// Commit SHA to apply the patch on top of. #[serde(rename = "patchBaseSha", default, skip_serializing_if = "Option::is_none")] patch_base_sha: Option, + /// Task IDs that must complete before this task can start. + /// Used for enforcing execution order: schema changes -> backend -> UI. + #[serde(rename = "dependsOn", default, skip_serializing_if = "Option::is_none")] + depends_on: Option>, }, /// Pause a running task. @@ -698,6 +721,23 @@ impl DaemonMessage { } } + /// Create a task recovery detected message. + pub fn task_recovery_detected( + task_id: Uuid, + previous_state: &str, + worktree_intact: bool, + worktree_path: Option, + needs_patch: bool, + ) -> Self { + Self::TaskRecoveryDetected { + task_id, + previous_state: previous_state.to_string(), + worktree_intact, + worktree_path, + needs_patch, + } + } + /// Create a register tool key message. pub fn register_tool_key(task_id: Uuid, key: String) -> Self { Self::RegisterToolKey { task_id, key } -- cgit v1.2.3