Watch
0
0
Fork
You've already forked hyperhive
0

subagent: log the name reservation lifecycle (reserve, track, release, freed)

This commit is contained in:
damocles 2026-11-27 02:31:00 +01:00 • committed by mara
commit 8bd33a3482

View file

@ -687,6 +687,7 @@ impl State {
});
}
running.insert(name.to_owned(), Slot::Starting);
tracing::info!(name, "subagent name reserved");
Ok(())
}
@ -709,6 +710,7 @@ impl State {
let released = matches!(running.get(name), Some(Slot::Starting));
if released {
running.remove(name);
tracing::info!(name, "subagent reservation released: the spawn failed");
}
drop(running);
// Only alongside a reservation this actually released: a call that
@ -759,6 +761,7 @@ impl State {
.lock()
.unwrap_or_else(PoisonError::into_inner)
.remove(name);
tracing::info!(name, "subagent name freed: the run ended");
}
/// Tell the swarm `name`'s run began, with the model and effort `info`
@ -882,6 +885,7 @@ impl State {
.lock()
.unwrap_or_else(PoisonError::into_inner)
.insert(name.to_owned(), Slot::Running(stop));
tracing::info!(name, "subagent process tracked");
}
/// Drop `name`'s cancel handle but keep the name claimed — the moment
@ -896,6 +900,7 @@ impl State {
.lock()
.unwrap_or_else(PoisonError::into_inner)
.insert(name.to_owned(), Slot::Starting);
tracing::info!(name, "subagent name held between goal turns");
}
/// Set (or clear) `name`'s goal and start its turn budget over at turn
@ -2591,6 +2596,7 @@ pub fn interrupt(state: &State, name: &str) -> anyhow::Result<String> {
None => anyhow::bail!("no subagent named `{name}` is currently running"),
Some(Slot::Starting) => {
running.insert(name.to_owned(), Slot::Starting);
tracing::info!(name, "interrupt refused: no process is tracked yet");
return Err(still_starting(name));
}
Some(Slot::Stopping) => {