Use Role::System for agent step prompts

Step prompts in oneshot agents are instructions, not user messages —
use system_msg instead of user_msg.

Co-Authored-By: ProofOfConcept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-10 02:40:00 -04:00
parent 58cec97e57
commit 1aa60552bc

View file

@ -193,7 +193,7 @@ impl AutoAgent {
if next_step < self.steps.len() { if next_step < self.steps.len() {
backend.push_node( backend.push_node(
AstNode::user_msg(&self.steps[next_step].prompt)).await; AstNode::system_msg(&self.steps[next_step].prompt)).await;
next_step += 1; next_step += 1;
} }
@ -218,8 +218,8 @@ impl AutoAgent {
let text = result.text; let text = result.text;
if text.is_empty() { if text.is_empty() {
dbglog!("[auto] {} empty response, retrying", self.name); dbglog!("[auto] {} empty response, retrying", self.name);
backend.push_node(AstNode::user_msg( backend.push_node(AstNode::system_msg(
"[system] Your previous response was empty. \ "Your previous response was empty. \
Please respond with text or use a tool." Please respond with text or use a tool."
)).await; )).await;
continue; continue;
@ -234,7 +234,7 @@ impl AutoAgent {
} }
self.current_phase = self.steps[next_step].phase.clone(); self.current_phase = self.steps[next_step].phase.clone();
backend.push_node( backend.push_node(
AstNode::user_msg(&self.steps[next_step].prompt)).await; AstNode::system_msg(&self.steps[next_step].prompt)).await;
next_step += 1; next_step += 1;
dbglog!("[auto] {} step {}/{}", dbglog!("[auto] {} step {}/{}",
self.name, next_step, self.steps.len()); self.name, next_step, self.steps.len());