diff options
| author | soryu <soryu@soryu.co> | 2026-02-13 20:40:26 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-13 20:40:26 +0000 |
| commit | c2bad633593a8ec6ffa83d7ff10776560cf0f69f (patch) | |
| tree | 44db52e4b818b9298d8b0af172a281cc2faa80c5 /makima/src/server | |
| parent | ad5af0f7677c73fc159a3036b9479d1d847adf97 (diff) | |
| download | soryu-c2bad633593a8ec6ffa83d7ff10776560cf0f69f.tar.gz soryu-c2bad633593a8ec6ffa83d7ff10776560cf0f69f.zip | |
Rerun plan when directive goal is edited (#61)
When a directive's goal is updated, pending/ready/failed/skipped steps are
now automatically cleared so that replanning generates fresh steps aligned
with the new goal. The planning prompt is also improved to clearly categorize
existing steps by status and provide explicit instructions for re-evaluation.
Changes:
- Add clear_pending_directive_steps() repository function to remove
non-started steps when the goal changes
- Call step cleanup in the update_goal HTTP handler
- Restructure the planning prompt to categorize steps (completed, running,
pending, failed, skipped) with clear instructions for each category
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'makima/src/server')
| -rw-r--r-- | makima/src/server/handlers/directives.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/makima/src/server/handlers/directives.rs b/makima/src/server/handlers/directives.rs index 25b2dc4..929769c 100644 --- a/makima/src/server/handlers/directives.rs +++ b/makima/src/server/handlers/directives.rs @@ -824,7 +824,28 @@ pub async fn update_goal( }; match repository::update_directive_goal(pool, auth.owner_id, id, &req.goal).await { - Ok(Some(directive)) => Json(directive).into_response(), + Ok(Some(directive)) => { + // Clear non-started steps so replanning starts fresh + match repository::clear_pending_directive_steps(pool, id).await { + Ok(count) => { + if count > 0 { + tracing::info!( + directive_id = %id, + removed_steps = count, + "Cleared pending steps after goal update — replanning will generate new steps" + ); + } + } + Err(e) => { + tracing::warn!( + directive_id = %id, + error = %e, + "Failed to clear pending steps after goal update" + ); + } + } + Json(directive).into_response() + } Ok(None) => ( StatusCode::NOT_FOUND, Json(ApiError::new("NOT_FOUND", "Directive not found")), |
