oneshot: simplify API surface

Kill 5 wrapper functions (run_and_apply chain, run_one_agent_excluded),
drop dead llm_tag parameter, clean up scan_pid_files parsing.

Public API: run_one_agent, run_one_agent_with_keys, spawn_agent,
scan_pid_files.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-04 17:33:36 -04:00 committed by Kent Overstreet
parent 0f4ca9e2f2
commit a1fb3fe557
4 changed files with 136 additions and 224 deletions

View file

@ -74,8 +74,8 @@ pub fn consolidate_full_with_progress(
*store = Store::load()?;
}
match oneshot::run_and_apply(store, agent_type, *count, "consolidate") {
Ok(()) => {
match oneshot::run_one_agent(store, agent_type, *count, None, &|_| {}) {
Ok(_) => {
let msg = " Done".to_string();
log_line(&mut log_buf, &msg);
on_progress(&msg);

View file

@ -123,8 +123,8 @@ fn job_targeted_agent(
ctx.log_line(msg);
log_event(&job_name, "progress", msg);
};
crate::agent::oneshot::run_one_agent_with_keys(
&mut store, &agent, std::slice::from_ref(&key), 5, "daemon", &log,
crate::agent::oneshot::run_one_agent(
&mut store, &agent, 5, Some(std::slice::from_ref(&key)), &log,
)?;
ctx.log_line("done");
Ok(())
@ -208,8 +208,8 @@ fn job_consolidation_agent(
};
// 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_with_keys(
&mut store, &agent, &claimed_keys, batch, "consolidate", &log,
let result = crate::agent::oneshot::run_one_agent(
&mut store, &agent, batch, Some(&claimed_keys), &log,
).map(|_| ());
// Release all claimed keys (seeds + neighbors)
@ -239,7 +239,7 @@ fn job_rename_agent(
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, "consolidate", &log)?;
let result = crate::agent::oneshot::run_one_agent(&mut store, "rename", batch, None, &log)?;
// Parse RENAME actions from response (rename uses its own format, not WRITE_NODE/LINK/REFINE)
let mut applied = 0;