fix(analyzer): respect explicit EXIT_SIGNAL:false with STATUS:COMPLETE#147
fix(analyzer): respect explicit EXIT_SIGNAL:false with STATUS:COMPLETE#147linuxkd wants to merge 1 commit into
Conversation
WalkthroughThis PR ensures explicit Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Respect explicit
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@lib/response_analyzer.sh`:
- Around line 139-146: The STATUS-based inference currently unconditionally sets
exit_signal="true" when embedded_status=="COMPLETE" even if an explicit
EXIT_SIGNAL:false was provided elsewhere; change the logic in
lib/response_analyzer.sh so that you only set exit_signal from STATUS when no
explicit EXIT_SIGNAL was provided. Concretely, ensure you track whether an
explicit EXIT_SIGNAL was found (e.g., introduce/use a flag alongside
embedded_exit_sig) and modify the block that inspects embedded_status (the code
referencing embedded_status, embedded_exit_sig, and exit_signal) to only assign
exit_signal="true" when the explicit-exit flag is unset/empty; preserve the
DEBUG echo behavior when you infer the signal.
frankbria#146) When Claude outputs STATUS: COMPLETE with EXIT_SIGNAL: false, it means "this task is complete, but there are more tasks to do". The previous code incorrectly treated STATUS: COMPLETE as overriding EXIT_SIGNAL. Root cause: Two locations in parse_json_response() could override an explicit EXIT_SIGNAL:false: 1. Lines 139-146: STATUS:COMPLETE fallback logic 2. Lines 199-205: Normalize values block Fix: Introduce `explicit_exit_signal_found` flag to track whether an EXIT_SIGNAL was explicitly provided. Only use STATUS/completion_status as fallback when no explicit EXIT_SIGNAL was found. Changes: - lib/response_analyzer.sh: Track explicit EXIT_SIGNAL, respect it in both the RALPH_STATUS extraction and normalization blocks - tests/unit/test_json_parsing.bats: Add 2 tests for the fix (53, 54) Also fixes SC2155 shellcheck warning by separating declare and assign. Test count: 54 tests in test_json_parsing.bats (100% pass rate)
91c4b80 to
afec773
Compare
|
Updated based on CodeRabbit's review feedback:
All 94 tests passing (54 json_parsing + 40 exit_detection). |
|
Thank you @linuxkd for this excellent fix! 🙏 Applied in commit 43bba1b. The fix properly tracks whether ...it correctly continues working ("task complete, but more tasks remain") instead of exiting prematurely. This closes issue #146. Credit given in the commit message! |
When Claude outputs STATUS: COMPLETE with EXIT_SIGNAL: false, it means "this task is complete, but there are more tasks to do". Previously, STATUS: COMPLETE incorrectly overrode EXIT_SIGNAL, causing premature exit. The fix: - Track whether EXIT_SIGNAL was explicitly provided (vs inferred) - Only use STATUS: COMPLETE as fallback when no EXIT_SIGNAL was specified - Explicit EXIT_SIGNAL: false is now respected (continues working) Fixes #146 Credit: @linuxkd (PR #147)
Summary
Fixes #146
When Claude outputs
STATUS: COMPLETEwithEXIT_SIGNAL: false, it means "this task is complete, but there are more tasks to do". The previous code incorrectly treatedSTATUS: COMPLETEas overridingEXIT_SIGNAL, causing Ralph to prematurely exit after completing a single task.Problem
In
lib/response_analyzer.shlines 139-146, the condition:Was TRUE when
exit_signalis "false" (not equal to "true"), so it overrode Claude's explicitEXIT_SIGNAL: falseand setexit_signal="true".The condition
$exit_signal != "true"doesn't distinguish between:Solution
Change the condition to
-z "$embedded_exit_sig"which only triggers when EXIT_SIGNAL was not extracted from the RALPH_STATUS block at all:Test Plan
exit_signalstays false when Claude explicitly setsEXIT_SIGNAL: falsewithSTATUS: COMPLETESTATUS: COMPLETEis still used as fallback whenEXIT_SIGNALis absenttest_json_parsing.batspasstest_exit_detection.batspassSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.