claude-evolve 1.7.28 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/claude-evolve-worker +54 -19
- package/package.json +1 -1
package/bin/claude-evolve-worker
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
set -e
|
|
2
|
+
# Note: set -e removed - we handle errors explicitly with exit codes
|
|
3
3
|
|
|
4
4
|
# Source configuration
|
|
5
5
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
|
|
@@ -595,11 +595,8 @@ with EvolutionCSV('$FULL_CSV_PATH') as csv:
|
|
|
595
595
|
CURRENT_CANDIDATE_ID="$candidate_id"
|
|
596
596
|
|
|
597
597
|
# Process the candidate and capture exit code
|
|
598
|
-
# Use 'set +e' temporarily to prevent script exit on non-zero return
|
|
599
|
-
set +e
|
|
600
598
|
process_candidate "$candidate_id" "$parent_id" "$description"
|
|
601
599
|
process_exit_code=$?
|
|
602
|
-
set -e
|
|
603
600
|
|
|
604
601
|
if [[ $process_exit_code -eq 0 ]]; then
|
|
605
602
|
echo "[WORKER-$$] Successfully processed $candidate_id"
|
|
@@ -614,10 +611,9 @@ with EvolutionCSV('$FULL_CSV_PATH') as csv:
|
|
|
614
611
|
csv.update_candidate_status('$candidate_id', 'failed-ai-retry')
|
|
615
612
|
" 2>/dev/null || true
|
|
616
613
|
elif [[ $process_exit_code -eq 78 ]]; then
|
|
617
|
-
# Missing parent; mark child as failed and
|
|
614
|
+
# Missing parent; mark child as failed and immediately process parent
|
|
618
615
|
echo "[WORKER-$$] Parent '$parent_id' missing for $candidate_id"
|
|
619
616
|
echo "[WORKER-$$] Marking $candidate_id as failed-parent-missing"
|
|
620
|
-
echo "[WORKER-$$] Auto-recovering: marking parent '$parent_id' as pending"
|
|
621
617
|
|
|
622
618
|
"$PYTHON_CMD" -c "
|
|
623
619
|
import sys
|
|
@@ -626,21 +622,60 @@ from lib.evolution_csv import EvolutionCSV
|
|
|
626
622
|
with EvolutionCSV('$FULL_CSV_PATH') as csv:
|
|
627
623
|
# Mark child as failed
|
|
628
624
|
csv.update_candidate_status('$candidate_id', 'failed-parent-missing')
|
|
625
|
+
" 2>/dev/null || true
|
|
629
626
|
|
|
630
|
-
#
|
|
631
|
-
parent_info
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
627
|
+
# Get parent info to process it immediately
|
|
628
|
+
parent_info=$("$PYTHON_CMD" -c "
|
|
629
|
+
import sys
|
|
630
|
+
sys.path.insert(0, '$SCRIPT_DIR/..')
|
|
631
|
+
from lib.evolution_csv import EvolutionCSV
|
|
632
|
+
with EvolutionCSV('$FULL_CSV_PATH') as csv:
|
|
633
|
+
parent = csv.get_candidate_info('$parent_id')
|
|
634
|
+
if parent:
|
|
635
|
+
status = parent.get('status', '').lower()
|
|
636
|
+
parent_of_parent = parent.get('basedOnId', '')
|
|
637
|
+
description = parent.get('description', '')
|
|
638
|
+
# Output: status|parent_of_parent|description
|
|
639
|
+
print(f\"{status}|{parent_of_parent}|{description}\")
|
|
640
|
+
")
|
|
641
|
+
|
|
642
|
+
if [[ -n "$parent_info" ]]; then
|
|
643
|
+
IFS='|' read -r parent_status parent_of_parent parent_description <<< "$parent_info"
|
|
644
|
+
|
|
645
|
+
# Only process if parent needs processing
|
|
646
|
+
if [[ "$parent_status" == "" || "$parent_status" == "pending" || "$parent_status" == "skipped" || "$parent_status" == "failed-parent-missing" ]]; then
|
|
647
|
+
echo "[WORKER-$$] Immediately processing parent '$parent_id' (status: $parent_status)"
|
|
648
|
+
|
|
649
|
+
# Mark parent as running
|
|
650
|
+
"$PYTHON_CMD" -c "
|
|
651
|
+
import sys
|
|
652
|
+
sys.path.insert(0, '$SCRIPT_DIR/..')
|
|
653
|
+
from lib.evolution_csv import EvolutionCSV
|
|
654
|
+
with EvolutionCSV('$FULL_CSV_PATH') as csv:
|
|
655
|
+
csv.update_candidate_status('$parent_id', 'running')
|
|
656
|
+
" 2>/dev/null || true
|
|
657
|
+
|
|
658
|
+
# Clear current candidate (parent processing will set its own)
|
|
659
|
+
CURRENT_CANDIDATE_ID=""
|
|
660
|
+
|
|
661
|
+
# Process parent recursively
|
|
662
|
+
process_candidate "$parent_id" "$parent_of_parent" "$parent_description"
|
|
663
|
+
parent_exit_code=$?
|
|
664
|
+
|
|
665
|
+
if [[ $parent_exit_code -eq 0 ]]; then
|
|
666
|
+
echo "[WORKER-$$] Successfully processed parent '$parent_id'"
|
|
667
|
+
# Now the child can potentially be retried (user can reset failed-parent-missing later)
|
|
668
|
+
else
|
|
669
|
+
echo "[WORKER-$$] Failed to process parent '$parent_id' (exit code: $parent_exit_code)"
|
|
670
|
+
fi
|
|
671
|
+
else
|
|
672
|
+
echo "[WORKER-$$] Parent '$parent_id' has status '$parent_status' - not processing"
|
|
673
|
+
fi
|
|
674
|
+
else
|
|
675
|
+
echo "[WORKER-$$] Warning: parent '$parent_id' not found in CSV"
|
|
676
|
+
fi
|
|
642
677
|
|
|
643
|
-
# Clear current candidate and continue to next
|
|
678
|
+
# Clear current candidate and continue to next
|
|
644
679
|
CURRENT_CANDIDATE_ID=""
|
|
645
680
|
else
|
|
646
681
|
echo "[WORKER-$$] Failed to process $candidate_id"
|