Fix bail script: pass own pid file so it can exclude itself
The bail-no-competing.sh script expects $1 to be the path to the current agent's pid file so it can skip it when checking for competing processes. But the runner wasn't passing any arguments, so $1 was empty and the script treated every pid file (including the agent's own) as a competing process — bailing every time. This caused surface-observe to always bail at step 2, preventing all memory graph maintenance (organize, observe phases) from running. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
6ce3f78e0a
commit
06176201da
1 changed files with 4 additions and 0 deletions
|
|
@ -474,9 +474,13 @@ pub fn run_one_agent(
|
|||
// Bail check: if the agent defines a bail script, run it between steps.
|
||||
let bail_script = def.bail.as_ref().map(|name| defs::agents_dir().join(name));
|
||||
let state_dir_for_bail = state_dir.clone();
|
||||
// Find our own pid file so we can pass it to the bail script
|
||||
let our_pid = std::process::id();
|
||||
let our_pid_file = format!("pid-{}", our_pid);
|
||||
let bail_fn = move |step_idx: usize| -> Result<(), String> {
|
||||
if let Some(ref script) = bail_script {
|
||||
let status = std::process::Command::new(script)
|
||||
.arg(&our_pid_file)
|
||||
.current_dir(&state_dir_for_bail)
|
||||
.status()
|
||||
.map_err(|e| format!("bail script {:?} failed: {}", script, e))?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue