From a3c2b0cec16828ad25560653fb889ac2ae7d80fc Mon Sep 17 00:00:00 2001 From: frankbria Date: Wed, 27 Aug 2025 16:08:17 -0700 Subject: [PATCH] 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 --- ralph_loop.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ralph_loop.sh b/ralph_loop.sh index e7d38ff..16534dd 100755 --- a/ralph_loop.sh +++ b/ralph_loop.sh @@ -223,15 +223,15 @@ wait_for_reset() { # Check if we should gracefully exit should_exit_gracefully() { - log_status "INFO" "DEBUG: Checking exit conditions..." + log_status "INFO" "DEBUG: Checking exit conditions..." >&2 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 fi 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 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_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