kick_agent: use per-recipient state path

manager keeps /state (legacy mount); sub-agents see their state at
/agents/<name>/state. wake message hardcoded /state/ for everyone,
which is wrong for sub-agents post-refactor — they get a path they
can't ls. switch on MANAGER_NAME and format the right path.
This commit is contained in:
müde 2026-05-17 01:43:03 +02:00
parent 6ba4241a45
commit 90f5162076

View file

@ -178,15 +178,25 @@ impl Coordinator {
/// Drop a system message into the given agent's inbox. Wakes the /// Drop a system message into the given agent's inbox. Wakes the
/// turn loop with a "you were just (re)started" hint — operator /// turn loop with a "you were just (re)started" hint — operator
/// caused the transition, agent picks up where it left off /// caused the transition, agent picks up where it left off
/// (notes are in /state/, last turn is in --continue's session). /// (notes are in the bind-mounted state dir, last turn is in
/// Best-effort; broker errors are logged but don't propagate. /// --continue's session). Best-effort; broker errors are logged
/// but don't propagate.
pub fn kick_agent(&self, name: &str, reason: &str) { pub fn kick_agent(&self, name: &str, reason: &str) {
// Manager keeps the legacy `/state` mount; sub-agents see
// their state at `/agents/<name>/state` (see lifecycle.rs's
// `notes_mount`). Tell each agent the path it can actually
// ls without translating.
let state_path = if name == crate::lifecycle::MANAGER_NAME {
"/state/".to_owned()
} else {
format!("/agents/{name}/state/")
};
let body = format!( let body = format!(
"{reason}\n\nYou were just (re)started by the operator. \ "{reason}\n\nYou were just (re)started by the operator. \
If you were mid-task, check `/state/` for your notes \ If you were mid-task, check `{state_path}` for your \
and pick up where you left off. claude's `--continue` \ notes and pick up where you left off. claude's \
session is intact, so prior context is still in your \ `--continue` session is intact, so prior context is \
window." still in your window."
); );
if let Err(e) = self.broker.send(&hive_sh4re::Message { if let Err(e) = self.broker.send(&hive_sh4re::Message {
from: hive_sh4re::SYSTEM_SENDER.to_owned(), from: hive_sh4re::SYSTEM_SENDER.to_owned(),