consciousness/src/subconscious/agents/bail-no-competing.sh
Kent Overstreet 70ee7abea5 Fix restore_from_log panic on Thinking entries, fix bail nullglob
restore_from_log called .message() on all entries including Thinking
entries, which panic. Filter them out alongside Log entries.

Also fix bail-no-competing.sh: without nullglob, when no pid-* files
exist the glob stays literal and always triggers a false bail.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
2026-04-08 10:39:07 -04:00

16 lines
278 B
Bash
Executable file

#!/bin/bash
# Bail if other agents are alive in the state dir.
# $1 = this agent's pid file name (e.g. pid-12345)
# cwd = state dir
#
# Exit 0 = continue, exit 1 = bail
shopt -s nullglob
my_pid_file="$1"
for f in pid-*; do
[[ $f != $my_pid_file ]] && exit 1
done
exit 0