You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/src/planning/llm_planner.rs
+23-32Lines changed: 23 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -152,37 +152,18 @@ impl LlmPlanner {
152
152
Self::achievement_from_value(result.object)
153
153
}
154
154
155
-
/// Create a fallback plan using heuristic logic (no LLM required)
155
+
/// Create a minimal fallback plan when explicit planning cannot use the LLM.
156
+
///
157
+
/// The original request is the only honest executable step available here.
158
+
/// Fabricating numbered placeholder steps makes the task tracker look active
159
+
/// without conveying useful progress.
156
160
pubfnfallback_plan(prompt:&str) -> ExecutionPlan{
157
-
let complexity = if prompt.len() < 50{
158
-
Complexity::Simple
159
-
}elseif prompt.len() < 150{
160
-
Complexity::Medium
161
-
}elseif prompt.len() < 300{
162
-
Complexity::Complex
163
-
}else{
164
-
Complexity::VeryComplex
165
-
};
166
-
167
-
letmut plan = ExecutionPlan::new(prompt, complexity);
168
-
169
-
let step_count = match complexity {
170
-
Complexity::Simple => 2,
171
-
Complexity::Medium => 4,
172
-
Complexity::Complex => 7,
173
-
Complexity::VeryComplex => 10,
161
+
let content = match prompt.trim(){
162
+
"" => "Complete the requested task",
163
+
prompt => prompt,
174
164
};
175
-
176
-
for i in0..step_count {
177
-
let step = Task::new(
178
-
format!("step-{}", i + 1),
179
-
crate::prompts::render(
180
-
crate::prompts::PLAN_FALLBACK_STEP,
181
-
&[("step_num",&(i + 1).to_string())],
182
-
),
183
-
);
184
-
plan.add_step(step);
185
-
}
165
+
letmut plan = ExecutionPlan::new(content,Complexity::Simple);
166
+
plan.add_step(Task::new("step-1", content));
186
167
187
168
plan
188
169
}
@@ -579,13 +560,23 @@ mod tests {
579
560
let short_prompt = "Fix bug";
580
561
let plan = LlmPlanner::fallback_plan(short_prompt);
581
562
assert_eq!(plan.complexity,Complexity::Simple);
582
-
assert_eq!(plan.steps.len(),2);
563
+
assert_eq!(plan.steps.len(),1);
583
564
assert_eq!(plan.goal, short_prompt);
565
+
assert_eq!(plan.steps[0].content, short_prompt);
584
566
585
567
let long_prompt = "Implement a comprehensive authentication system with OAuth2 support, JWT tokens, refresh token rotation, multi-factor authentication, and role-based access control across all API endpoints with proper audit logging and session management capabilities for both web and mobile clients, including password reset flows, account lockout policies, and integration with external identity providers such as Google, GitHub, and SAML-based enterprise SSO systems";
586
568
let plan = LlmPlanner::fallback_plan(long_prompt);
0 commit comments