From 5aa3fafb4acfa89c7d04e84abf7861607733e8ce Mon Sep 17 00:00:00 2001 From: soryu Date: Tue, 28 Apr 2026 00:55:25 +0100 Subject: fix: resolve compilation error and warnings in Rust backend (#95) * fix: resolve compilation error and warnings in Rust backend - Fix syntax error in directive.rs phase_replanning (bad merge created duplicate code blocks with broken `.await {` syntax) - Remove unused imports: WorktreeError, DaemonReauthStatus, ratatui::prelude - Prefix unused variables with underscore: claude_command, content, owner_id - Suppress unused_assignments warning on final_exit_code - Add #[allow(unused_imports)] for cfg(unix) CommandExt imports Co-Authored-By: Claude Opus 4.6 (1M context) * WIP: heartbeat checkpoint * fix: suppress remaining compiler warnings for clean build - Add #[allow(dead_code)] for unused but intentionally kept functions - Remove useless self-assignments in listen handler - Fixes: truncate_string, checkout_commit, handle_get_worktree_diff, default_max_retries, STREAM_CHUNK_MS, listen(), MessageResponse.role Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) --- makima/src/orchestration/directive.rs | 77 +++++++++++------------------------ 1 file changed, 23 insertions(+), 54 deletions(-) (limited to 'makima/src/orchestration/directive.rs') diff --git a/makima/src/orchestration/directive.rs b/makima/src/orchestration/directive.rs index 19077c9..b9ff3fe 100644 --- a/makima/src/orchestration/directive.rs +++ b/makima/src/orchestration/directive.rs @@ -448,6 +448,27 @@ impl DirectiveOrchestrator { "Directive goal updated — spawning re-planning task" ); + // If directive already has a PR, remove completed steps that were included in it + if directive.pr_url.is_some() || directive.pr_branch.is_some() { + match remove_already_merged_steps(&self.pool, directive.id).await { + Ok(count) if count > 0 => { + tracing::info!( + directive_id = %directive.id, + removed = count, + "Auto-removed completed steps already included in PR before replanning" + ); + } + Err(e) => { + tracing::warn!( + directive_id = %directive.id, + error = %e, + "Failed to auto-remove merged steps before replanning" + ); + } + _ => {} + } + } + let existing_steps = repository::list_directive_steps(&self.pool, directive.id).await?; let generation = @@ -471,61 +492,9 @@ impl DirectiveOrchestrator { { tracing::warn!( directive_id = %directive.id, - title = %directive.title, - "Directive goal updated — spawning re-planning task" + error = %e, + "Failed to spawn re-planning task" ); - - // If directive already has a PR, remove completed steps that were included in it - if directive.pr_url.is_some() || directive.pr_branch.is_some() { - match remove_already_merged_steps(&self.pool, directive.id).await { - Ok(count) if count > 0 => { - tracing::info!( - directive_id = %directive.id, - removed = count, - "Auto-removed completed steps already included in PR before replanning" - ); - } - Err(e) => { - tracing::warn!( - directive_id = %directive.id, - error = %e, - "Failed to auto-remove merged steps before replanning" - ); - } - _ => {} - } - } - - let existing_steps = - repository::list_directive_steps(&self.pool, directive.id).await?; - let generation = - repository::get_directive_max_generation(&self.pool, directive.id).await? + 1; - let goal_history = - repository::get_directive_goal_history(&self.pool, directive.id, 3).await?; - - let plan = - build_planning_prompt(&directive, &existing_steps, generation, &goal_history); - - if let Err(e) = self - .spawn_orchestrator_task( - directive.id, - directive.owner_id, - format!("Re-plan: {}", directive.title), - plan, - directive.repository_url.as_deref(), - directive.base_branch.as_deref(), - ) - .await - { - tracing::warn!( - directive_id = %directive.id, - error = %e, - "Failed to spawn re-planning task" - ); - } - Ok::<(), anyhow::Error>(()) - }.await { - tracing::warn!(directive_id = %directive.id, error = %e, "Error in re-planning directive — continuing"); } } Ok(()) -- cgit v1.2.3