Preserve agent question answers and plan output
This commit is contained in:
@@ -807,7 +807,7 @@ fn build_system_prompt(
|
||||
match mode {
|
||||
RigRequestMode::Normal => {}
|
||||
RigRequestMode::Plan => prompt.push_str(
|
||||
"## Plan Mode\nInspect and produce an implementation-ready plan. Do not edit files or perform state-changing actions.\n\n",
|
||||
"## Plan Mode\nInspect and produce an implementation-ready plan. Do not edit files or perform state-changing actions. Research as needed, then finish by calling `create_plan` to write the plan with the built-in planning tools. If a plan document already exists for this task, call `edit_plan` instead. Do not return the plan only as prose, and do not claim completion until the plan tool succeeds.\n\n",
|
||||
),
|
||||
RigRequestMode::Orchestrate => prompt.push_str(
|
||||
"## Orchestration Mode\nDelegate only independent, bounded work where parallelism materially helps, then synthesize the results.\n\n",
|
||||
|
||||
@@ -200,6 +200,42 @@ fn normal_turn_advertises_plan_creation_and_corrects_false_unavailability_claims
|
||||
assert!(prompt.contains("do not implement it until they approve"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plan_turn_requires_a_plan_tool_result() {
|
||||
let mut params = RequestParams::new_for_test();
|
||||
let mut input = user_query("Design the implementation");
|
||||
let AIAgentInput::UserQuery {
|
||||
user_query_mode, ..
|
||||
} = &mut input
|
||||
else {
|
||||
unreachable!("user_query returns a user query input");
|
||||
};
|
||||
*user_query_mode = UserQueryMode::Plan;
|
||||
params.input = vec![input];
|
||||
|
||||
let prepared = prepare_rig_turn(
|
||||
&config(),
|
||||
params,
|
||||
vec![ToolType::CreateDocuments, ToolType::EditDocuments],
|
||||
Vec::new(),
|
||||
);
|
||||
let prompt = prepared.request.system_prompt.expect("system prompt");
|
||||
|
||||
assert!(prepared
|
||||
.request
|
||||
.tools
|
||||
.iter()
|
||||
.any(|tool| tool.name == "create_plan"));
|
||||
assert!(prepared
|
||||
.request
|
||||
.tools
|
||||
.iter()
|
||||
.any(|tool| tool.name == "edit_plan"));
|
||||
assert!(prompt.contains("finish by calling `create_plan`"));
|
||||
assert!(prompt.contains("call `edit_plan` instead"));
|
||||
assert!(prompt.contains("Do not return the plan only as prose"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_tools_turn_flattens_historical_tool_protocol_messages() {
|
||||
let mut params = RequestParams::new_for_test();
|
||||
|
||||
Reference in New Issue
Block a user