Kill log callback — use ConversationEntry::Log for debug traces

Add Log variant to ConversationEntry that serializes to the
conversation log but is filtered out on read-back and API calls.
AutoAgent writes debug/status info (turns, tokens, tool calls)
through the conversation log instead of a callback parameter.

Removes the log callback from run_one_agent, call_api_with_tools,
and all callers.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-07 01:23:22 -04:00
parent 7c0d8b79d9
commit b37b6d7495
8 changed files with 74 additions and 73 deletions

View file

@ -119,12 +119,8 @@ fn job_targeted_agent(
run_job(ctx, &job_name, || {
let mut store = crate::store::Store::load()?;
ctx.log_line(format!("targeting: {}", key));
let log = |msg: &str| {
ctx.log_line(msg);
log_event(&job_name, "progress", msg);
};
crate::agent::oneshot::run_one_agent(
&mut store, &agent, 5, Some(std::slice::from_ref(&key)), &log,
&mut store, &agent, 5, Some(std::slice::from_ref(&key)),
)?;
ctx.log_line("done");
Ok(())
@ -202,14 +198,10 @@ fn job_consolidation_agent(
}
// in_flight lock released — run LLM without holding it
let log = |msg: &str| {
ctx.log_line(msg);
log_event(&job_name, "progress", msg);
};
// Use run_one_agent_with_keys — we already selected seeds above,
// no need to re-run the query.
let result = crate::agent::oneshot::run_one_agent(
&mut store, &agent, batch, Some(&claimed_keys), &log,
&mut store, &agent, batch, Some(&claimed_keys),
).map(|_| ());
// Release all claimed keys (seeds + neighbors)
@ -238,8 +230,7 @@ fn job_rename_agent(
let batch = if batch_size == 0 { 10 } else { batch_size };
ctx.log_line(format!("running rename agent (batch={})", batch));
let log = |msg: &str| ctx.log_line(msg);
let result = crate::agent::oneshot::run_one_agent(&mut store, "rename", batch, None, &log)?;
let result = crate::agent::oneshot::run_one_agent(&mut store, "rename", batch, None)?;
// Parse RENAME actions from response (rename uses its own format, not WRITE_NODE/LINK/REFINE)
let mut applied = 0;