fix(orchestration): wire plan_with_cache into handle_plan_goal (#2070)#2074
Merged
fix(orchestration): wire plan_with_cache into handle_plan_goal (#2070)#2074
Conversation
Integrate PlanCache into the planning path so orchestration.plan_cache.enabled actually takes effect. Previously handle_plan_goal() called LlmPlanner::new().plan() directly, bypassing plan_with_cache() and leaving the plan_cache table unpopulated. Changes: - OrchestrationState: add plan_cache (lazy) and pending_goal_embedding fields - Agent: extract init_plan_cache_if_needed() and goal_embedding_for_cache() helpers - handle_plan_goal: lazy-init PlanCache, embed normalized goal, call plan_with_cache() - finalize_plan_execution: cache completed plan template via cache_plan() - handle_plan_cancel: clear pending_goal_embedding to prevent state leak (IMP-2) - normalize goal before embedding for consistent cache hit quality (IMP-1) - log EmbedUnsupported at DEBUG instead of WARN to reduce noise (SUG-2) - Box::pin Agent builder futures in acp.rs and daemon.rs to satisfy large_futures lint
…an status In finalize_plan_execution, Canceled and the catch-all arm now call pending_goal_embedding.take() so the embedding does not linger when a plan ends in a non-retryable state. Also added clarifying comments in the Failed and Paused arms explaining why the embedding is intentionally retained there: retry/resume goes through finalize_plan_execution again, reusing the same embedding, and a new /plan goal cannot be issued while pending_graph is Some.
c885bea to
572ee74
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wire the incomplete plan_with_cache infrastructure from PR #2068 into the actual planning code path. When
orchestration.plan_cache.enabled = true, goals are now embedded, cached plans are found via similarity, and completed plans are stored in the cache.Changes
plan_cacheandpending_goal_embeddingfields toOrchestrationStatehandle_plan_goal()to:plan_with_cache()plan_with_cache()instead of directplanner.plan()finalize_plan_execution()to store completed plans in cachehandle_plan_cancel()to clear pending embeddingclippy::large_futuresin acp.rs/daemon.rs via Box::pinTest Results
Validation
Follow-ups (file after merge)
Closes #2070