Fix silent exit bug: redirect debug logging to stderr

- The debug log_status calls in should_exit_gracefully() were being
  captured as stdout when called with
- This caused the debug messages to be treated as the exit reason
- Fixed by redirecting debug logging to stderr with >&2
- Ralph should now continue past the exit condition check properly
This commit is contained in:
frankbria 2025-08-27 16:08:17 -07:00
parent 6aa5e97436
commit a3c2b0cec1

View file

@ -223,15 +223,15 @@ wait_for_reset() {
# Check if we should gracefully exit # Check if we should gracefully exit
should_exit_gracefully() { should_exit_gracefully() {
log_status "INFO" "DEBUG: Checking exit conditions..." log_status "INFO" "DEBUG: Checking exit conditions..." >&2
if [[ ! -f "$EXIT_SIGNALS_FILE" ]]; then if [[ ! -f "$EXIT_SIGNALS_FILE" ]]; then
log_status "INFO" "DEBUG: No exit signals file found, continuing..." log_status "INFO" "DEBUG: No exit signals file found, continuing..." >&2
return 1 # Don't exit, file doesn't exist return 1 # Don't exit, file doesn't exist
fi fi
local signals=$(cat "$EXIT_SIGNALS_FILE") local signals=$(cat "$EXIT_SIGNALS_FILE")
log_status "INFO" "DEBUG: Exit signals content: $signals" log_status "INFO" "DEBUG: Exit signals content: $signals" >&2
# Count recent signals (last 5 loops) - with error handling # Count recent signals (last 5 loops) - with error handling
local recent_test_loops local recent_test_loops
@ -242,7 +242,7 @@ should_exit_gracefully() {
recent_done_signals=$(echo "$signals" | jq '.done_signals | length' 2>/dev/null || echo "0") recent_done_signals=$(echo "$signals" | jq '.done_signals | length' 2>/dev/null || echo "0")
recent_completion_indicators=$(echo "$signals" | jq '.completion_indicators | length' 2>/dev/null || echo "0") recent_completion_indicators=$(echo "$signals" | jq '.completion_indicators | length' 2>/dev/null || echo "0")
log_status "INFO" "DEBUG: Exit counts - test_loops:$recent_test_loops, done_signals:$recent_done_signals, completion:$recent_completion_indicators" log_status "INFO" "DEBUG: Exit counts - test_loops:$recent_test_loops, done_signals:$recent_done_signals, completion:$recent_completion_indicators" >&2
# Check for exit conditions # Check for exit conditions