Fix agent log path: only set state on spawn, not scan
Agent state (pid, phase, log_path) only updates when we spawn an agent. The scan_pid_files path no longer calls update_agent — it just logs. This prevents the scan path from clearing log_path with None on subsequent triggers. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
a90bd4fd47
commit
54ea7824d8
1 changed files with 2 additions and 9 deletions
|
|
@ -192,9 +192,7 @@ impl AgentCycleState {
|
|||
if let Some(agent) = self.agents.iter_mut().find(|a| a.name == name) {
|
||||
agent.pid = pid;
|
||||
agent.phase = phase;
|
||||
if log_path.is_some() {
|
||||
agent.log_path = log_path;
|
||||
}
|
||||
agent.log_path = log_path;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -271,11 +269,8 @@ impl AgentCycleState {
|
|||
.unwrap_or(300) as u64;
|
||||
|
||||
let live = crate::agents::knowledge::scan_pid_files(&state_dir, timeout);
|
||||
if let Some((phase, pid)) = live.first() {
|
||||
self.update_agent("surface-observe", Some(*pid), Some(phase.clone()), None);
|
||||
for (phase, pid) in &live {
|
||||
self.log(format_args!("alive pid-{}: phase={}\n", pid, phase));
|
||||
} else {
|
||||
self.update_agent("surface-observe", None, None, None);
|
||||
}
|
||||
|
||||
// Read surfaced keys
|
||||
|
|
@ -360,7 +355,6 @@ impl AgentCycleState {
|
|||
|
||||
let live = crate::agents::knowledge::scan_pid_files(&state_dir, 300);
|
||||
if let Some((phase, pid)) = live.first() {
|
||||
self.update_agent("reflect", Some(*pid), Some(phase.clone()), None);
|
||||
self.log(format_args!("reflect: already running pid {}\n", pid));
|
||||
return None;
|
||||
}
|
||||
|
|
@ -406,7 +400,6 @@ impl AgentCycleState {
|
|||
|
||||
let live = crate::agents::knowledge::scan_pid_files(&state_dir, 300);
|
||||
if let Some((phase, pid)) = live.first() {
|
||||
self.update_agent("journal", Some(*pid), Some(phase.clone()), None);
|
||||
self.log(format_args!("journal: already running pid {}\n", pid));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue