Log completed assistant node after parser finishes

The parser mutates the AST directly but doesn't write to the
conversation log. The turn loop now logs the completed assistant
branch after the parser handle resolves successfully.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-08 16:58:05 -04:00
parent 5f5a8a807c
commit 88ac5e10ce

View file

@ -362,7 +362,15 @@ impl Agent {
return Err(e);
}
Err(e) => return Err(anyhow::anyhow!("parser task panicked: {}", e)),
Ok(Ok(())) => {}
Ok(Ok(())) => {
let node = agent.context.lock().await.conversation()[branch_idx].clone();
let st = agent.state.lock().await;
if let Some(ref log) = st.conversation_log {
if let Err(e) = log.append_node(&node) {
eprintln!("warning: failed to log assistant response: {:#}", e);
}
}
}
}
// Empty response — nudge and retry