summaryrefslogtreecommitdiff
path: root/makima/src/bin
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-01-24 04:31:20 +0000
committersoryu <soryu@soryu.co>2026-01-24 04:31:20 +0000
commit0cf6f6a4c5c75c736e6fe3b1c726ef80c0a6c802 (patch)
tree8f08fa5421e13381c5955f52a5197379feb44c58 /makima/src/bin
parentf6f0790217d4098ffb6d2b3df08b0cf83ff61727 (diff)
downloadsoryu-0cf6f6a4c5c75c736e6fe3b1c726ef80c0a6c802.tar.gz
soryu-0cf6f6a4c5c75c736e6fe3b1c726ef80c0a6c802.zip
feat: implement dependency-ordered task execution
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<Uuid>) 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 <noreply@anthropic.com>
Diffstat (limited to 'makima/src/bin')
-rw-r--r--makima/src/bin/makima.rs29
1 files changed, 26 insertions, 3 deletions
diff --git a/makima/src/bin/makima.rs b/makima/src/bin/makima.rs
index 1a307d1..e2072da 100644
--- a/makima/src/bin/makima.rs
+++ b/makima/src/bin/makima.rs
@@ -165,7 +165,7 @@ async fn run_daemon(
"[3/5] Opening local database: {}",
config.local_db.path.display()
);
- let _local_db = LocalDb::open(&config.local_db.path)?;
+ let local_db = Arc::new(std::sync::Mutex::new(LocalDb::open(&config.local_db.path)?));
eprintln!(" Database opened");
// Initialize worktree directories
@@ -242,10 +242,17 @@ async fn run_daemon(
api_key: config.server.api_key.clone(),
heartbeat_commit_interval_secs: config.process.heartbeat_commit_interval_secs,
checkpoint_patches: config.process.checkpoint_patches.clone(),
+ dependency_ordering: config.dependency_ordering.clone(),
};
- // Create task manager
- let task_manager = Arc::new(TaskManager::new(task_config, ws_tx.clone()));
+ // Create task manager with local database for crash recovery
+ let task_manager = Arc::new(TaskManager::new(task_config, ws_tx.clone(), local_db));
+
+ // Recover any orphaned tasks from previous daemon run
+ let recovered = task_manager.recover_orphaned_tasks().await;
+ if !recovered.is_empty() {
+ eprintln!(" Recovered {} orphaned tasks with intact worktrees", recovered.len());
+ }
// Spawn command handler
let task_manager_clone = task_manager.clone();
@@ -260,6 +267,22 @@ async fn run_daemon(
tracing::info!("Command handler stopped");
});
+ // Spawn periodic worktree health check (every 60 seconds)
+ let health_check_manager = task_manager.clone();
+ tokio::spawn(async move {
+ let mut interval = tokio::time::interval(std::time::Duration::from_secs(60));
+ loop {
+ interval.tick().await;
+ let affected = health_check_manager.check_worktree_health().await;
+ if !affected.is_empty() {
+ tracing::info!(
+ count = affected.len(),
+ "Worktree health check detected missing worktrees - tasks marked for retry"
+ );
+ }
+ }
+ });
+
// Handle shutdown signals
let shutdown_signal = async {
tokio::signal::ctrl_c()