fix: Robust brain health verification in setup and improved Lisp error logging
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 27s

This commit is contained in:
2026-04-17 17:00:53 -04:00
parent a78d9bb405
commit b562b25e9a
2 changed files with 62 additions and 10 deletions

View File

@@ -30,7 +30,7 @@ setup_system() {
echo -e "${BLUE}=== OpenCortex: Initializing System ===${NC}"
echo -e "${YELLOW}--- Installing System Dependencies ---${NC}"
if command_exists apt-get; then
sudo apt-get update && sudo apt-get install -y sbcl emacs-nox rlwrap netcat-openbsd curl git socat
sudo apt-get update && sudo apt-get install -y sbcl emacs-nox rlwrap netcat-openbsd curl git socat libssl-dev libncurses5-dev
fi
if [ ! -d "$HOME/quicklisp" ]; then
curl -O https://beta.quicklisp.org/quicklisp.lisp
@@ -98,7 +98,32 @@ setup_system() {
done
mkdir -p "$HOME/.local/bin"
ln -sf "$SCRIPT_DIR/opencortex.sh" "$HOME/.local/bin/opencortex"
echo -e "${GREEN}✓ Setup complete. You can now run 'opencortex tui'.${NC}"
echo -e "${YELLOW}--- Finalizing: Awakening the Brain for the first time ---${NC}"
# Nuke any existing brain logs
> "$SCRIPT_DIR/brain.log"
"$SCRIPT_DIR/opencortex.sh" --boot > "$SCRIPT_DIR/brain.log" 2>&1 &
local success=false
for i in {1..30}; do
if nc -z localhost $PORT 2>/dev/null; then
success=true
break
fi
sleep 2
echo -n "."
done
if [ "$success" = true ]; then
echo -e "\n${GREEN}✓ Brain is alive and responsive on port $PORT.${NC}"
echo -e "${GREEN}✓ Setup complete. You can now run 'opencortex tui'.${NC}"
else
echo -e "\n${RED}✗ Brain failed to wake up. Error Log from brain.log:${NC}"
cat "$SCRIPT_DIR/brain.log"
# Kill the background process if it exists
pkill -f "sbcl.*opencortex" || true
exit 1
fi
}
if [ ! -f "$SCRIPT_DIR/src/package.lisp" ] || [ ! -f "$SCRIPT_DIR/.env" ]; then
@@ -116,9 +141,10 @@ if [[ "$1" == "--boot" ]]; then
done < "$SCRIPT_DIR/.env"
fi
exec sbcl --non-interactive \
--eval "(load \"~/quicklisp/setup.lisp\")" \
--eval "(push \"$SCRIPT_DIR/\" asdf:*central-registry*)" \
--eval "(ql:quickload :opencortex)" \
--eval "(load (merge-pathnames \"quicklisp/setup.lisp\" (user-homedir-pathname)))" \
--eval "(setf *debugger-hook* (lambda (c h) (declare (ignore h)) (format t \"~a~%\" c) (uiop:quit 1)))" \
--eval "(push (truename \"$SCRIPT_DIR/\") asdf:*central-registry*)" \
--eval "(ql:quickload :opencortex :silent t)" \
--eval "(opencortex:main)"
fi

View File

@@ -21,7 +21,7 @@ setup_system() {
echo -e "${BLUE}=== OpenCortex: Initializing System ===${NC}"
echo -e "${YELLOW}--- Installing System Dependencies ---${NC}"
if command_exists apt-get; then
sudo apt-get update && sudo apt-get install -y sbcl emacs-nox rlwrap netcat-openbsd curl git socat
sudo apt-get update && sudo apt-get install -y sbcl emacs-nox rlwrap netcat-openbsd curl git socat libssl-dev libncurses5-dev
fi
if [ ! -d "$HOME/quicklisp" ]; then
curl -O https://beta.quicklisp.org/quicklisp.lisp
@@ -89,7 +89,32 @@ setup_system() {
done
mkdir -p "$HOME/.local/bin"
ln -sf "$SCRIPT_DIR/opencortex.sh" "$HOME/.local/bin/opencortex"
echo -e "${GREEN}✓ Setup complete. You can now run 'opencortex tui'.${NC}"
echo -e "${YELLOW}--- Finalizing: Awakening the Brain for the first time ---${NC}"
# Nuke any existing brain logs
> "$SCRIPT_DIR/brain.log"
"$SCRIPT_DIR/opencortex.sh" --boot > "$SCRIPT_DIR/brain.log" 2>&1 &
local success=false
for i in {1..30}; do
if nc -z localhost $PORT 2>/dev/null; then
success=true
break
fi
sleep 2
echo -n "."
done
if [ "$success" = true ]; then
echo -e "\n${GREEN}✓ Brain is alive and responsive on port $PORT.${NC}"
echo -e "${GREEN}✓ Setup complete. You can now run 'opencortex tui'.${NC}"
else
echo -e "\n${RED}✗ Brain failed to wake up. Error Log from brain.log:${NC}"
cat "$SCRIPT_DIR/brain.log"
# Kill the background process if it exists
pkill -f "sbcl.*opencortex" || true
exit 1
fi
}
if [ ! -f "$SCRIPT_DIR/src/package.lisp" ] || [ ! -f "$SCRIPT_DIR/.env" ]; then
@@ -107,9 +132,10 @@ if [[ "$1" == "--boot" ]]; then
done < "$SCRIPT_DIR/.env"
fi
exec sbcl --non-interactive \
--eval "(load \"~/quicklisp/setup.lisp\")" \
--eval "(push \"$SCRIPT_DIR/\" asdf:*central-registry*)" \
--eval "(ql:quickload :opencortex)" \
--eval "(load (merge-pathnames \"quicklisp/setup.lisp\" (user-homedir-pathname)))" \
--eval "(setf *debugger-hook* (lambda (c h) (declare (ignore h)) (format t \"~a~%\" c) (uiop:quit 1)))" \
--eval "(push (truename \"$SCRIPT_DIR/\") asdf:*central-registry*)" \
--eval "(ql:quickload :opencortex :silent t)" \
--eval "(opencortex:main)"
fi