claude-evolve 1.7.28 → 1.8.1

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.
@@ -989,6 +989,8 @@ generate_novel_ideas_direct() {
989
989
  # Generate the list of IDs this strategy should use
990
990
  local next_id_num
991
991
  next_id_num=$(echo "$next_id" | grep -o '[0-9]*$')
992
+ # Strip leading zeros to avoid octal interpretation in arithmetic
993
+ next_id_num=$((10#$next_id_num))
992
994
  local required_ids=()
993
995
  for ((i=0; i<count; i++)); do
994
996
  required_ids+=("$(printf "gen%s-%03d" "$CURRENT_GENERATION" $((next_id_num + i)))")
@@ -1121,6 +1123,8 @@ generate_hill_climbing_direct() {
1121
1123
  # Generate the list of IDs this strategy should use
1122
1124
  local next_id_num
1123
1125
  next_id_num=$(echo "$next_id" | grep -o '[0-9]*$')
1126
+ # Strip leading zeros to avoid octal interpretation in arithmetic
1127
+ next_id_num=$((10#$next_id_num))
1124
1128
  local required_ids=()
1125
1129
  for ((i=0; i<count; i++)); do
1126
1130
  required_ids+=("$(printf "gen%s-%03d" "$CURRENT_GENERATION" $((next_id_num + i)))")
@@ -1251,6 +1255,8 @@ generate_structural_mutation_direct() {
1251
1255
  # Generate the list of IDs this strategy should use
1252
1256
  local next_id_num
1253
1257
  next_id_num=$(echo "$next_id" | grep -o '[0-9]*$')
1258
+ # Strip leading zeros to avoid octal interpretation in arithmetic
1259
+ next_id_num=$((10#$next_id_num))
1254
1260
  local required_ids=()
1255
1261
  for ((i=0; i<count; i++)); do
1256
1262
  required_ids+=("$(printf "gen%s-%03d" "$CURRENT_GENERATION" $((next_id_num + i)))")
@@ -1371,6 +1377,8 @@ generate_crossover_direct() {
1371
1377
  # Generate the list of IDs this strategy should use
1372
1378
  local next_id_num
1373
1379
  next_id_num=$(echo "$next_id" | grep -o '[0-9]*$')
1380
+ # Strip leading zeros to avoid octal interpretation in arithmetic
1381
+ next_id_num=$((10#$next_id_num))
1374
1382
  local required_ids=()
1375
1383
  for ((i=0; i<count; i++)); do
1376
1384
  required_ids+=("$(printf "gen%s-%03d" "$CURRENT_GENERATION" $((next_id_num + i)))")
@@ -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 auto-recover parent
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
- # Auto-recover: mark parent as pending so it gets processed
631
- parent_info = csv.get_candidate_info('$parent_id')
632
- if parent_info:
633
- parent_status = parent_info.get('status', '').lower()
634
- if parent_status in ('', 'skipped', 'failed-parent-missing'):
635
- csv.update_candidate_status('$parent_id', 'pending')
636
- print(f'Auto-recovered parent $parent_id: {parent_status} -> pending', file=sys.stderr)
637
- else:
638
- print(f'Parent $parent_id has status: {parent_status} (not auto-recovering)', file=sys.stderr)
639
- else:
640
- print(f'Warning: parent $parent_id not found in CSV', file=sys.stderr)
641
- " 2>&1 | grep -E "Auto-recovered|Parent.*status|Warning" || true
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 (don't break)
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"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-evolve",
3
- "version": "1.7.28",
3
+ "version": "1.8.1",
4
4
  "bin": {
5
5
  "claude-evolve": "./bin/claude-evolve",
6
6
  "claude-evolve-main": "./bin/claude-evolve-main",