From 0676468e3e69ff36f1e509d775f191dd41f6080b Mon Sep 17 00:00:00 2001 From: soryu Date: Mon, 16 Feb 2026 01:24:19 +0000 Subject: Ensure directives replan on goal change --- makima/src/orchestration/directive.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'makima/src/orchestration/directive.rs') diff --git a/makima/src/orchestration/directive.rs b/makima/src/orchestration/directive.rs index 92aacde..9113fd4 100644 --- a/makima/src/orchestration/directive.rs +++ b/makima/src/orchestration/directive.rs @@ -382,6 +382,17 @@ impl DirectiveOrchestrator { repository::assign_orchestrator_task(&self.pool, directive_id, task.id).await?; + // Cancel any old planning tasks for this directive (superseded by the new one) + let cancelled = + repository::cancel_old_planning_tasks(&self.pool, directive_id, task.id).await?; + if cancelled > 0 { + tracing::info!( + directive_id = %directive_id, + cancelled_count = cancelled, + "Cancelled old planning tasks superseded by new plan" + ); + } + // Try to dispatch to a daemon self.try_dispatch_task(task.id, owner_id, &task.name, &task.plan, task.version).await; -- cgit v1.2.3