summaryrefslogtreecommitdiff
path: root/makima/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/db')
-rw-r--r--makima/src/db/repository.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/makima/src/db/repository.rs b/makima/src/db/repository.rs
index ca07d92..cec9a82 100644
--- a/makima/src/db/repository.rs
+++ b/makima/src/db/repository.rs
@@ -5625,8 +5625,12 @@ pub async fn check_directive_idle(
}
/// Update a directive's goal and bump goal_updated_at.
-/// Reactivates idle/paused directives and clears any stale orchestrator task
-/// so that replanning triggers on the next tick.
+/// Reactivates draft/idle/paused directives and clears any stale orchestrator
+/// task so that planning/replanning triggers on the next reconciler tick.
+///
+/// `draft` is included in the flip set because the document-mode UI treats
+/// the first goal save as the implicit "start" — without this, a brand-new
+/// directive's goal save would persist but never spawn a planner.
pub async fn update_directive_goal(
pool: &PgPool,
owner_id: Uuid,
@@ -5638,7 +5642,7 @@ pub async fn update_directive_goal(
UPDATE directives
SET goal = $3,
goal_updated_at = NOW(),
- status = CASE WHEN status IN ('idle', 'paused') THEN 'active' ELSE status END,
+ status = CASE WHEN status IN ('draft', 'idle', 'paused') THEN 'active' ELSE status END,
orchestrator_task_id = NULL,
updated_at = NOW(),
version = version + 1