Fix: push all responses to forked agent entries

The final assistant response in run_with_backend wasn't being pushed
to the backend — only intermediate step responses were. This meant
the subconscious debug screen only showed the prompt, not the full
conversation.

Now push assistant response immediately after receiving it, before
checking for next steps. Remove the duplicate push in the multi-step
path.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-07 17:38:23 -04:00
parent 1f873140ae
commit 74f8952399

View file

@ -249,12 +249,13 @@ impl AutoAgent {
dbglog!("[auto] {} response: {}",
self.name, &text[..text.len().min(200)]);
backend.push_message(Message::assistant(&text)).await;
if next_step < self.steps.len() {
if let Some(ref check) = bail_fn {
check(next_step)?;
}
self.current_phase = self.steps[next_step].phase.clone();
backend.push_message(Message::assistant(&text)).await;
backend.push_message(
Message::user(&self.steps[next_step].prompt)).await;
next_step += 1;