claude-evolve 1.8.0 → 1.8.2

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)))")
@@ -221,24 +221,50 @@ process_candidate() {
221
221
  parent_id=""
222
222
  echo "[WORKER-$$] Parent ID 'baseline-000' treated as baseline (empty parent)"
223
223
  fi
224
-
224
+
225
+ # Handle multi-parent IDs - extract first valid parent
226
+ # Use global variable so caller can access resolved parent for recursive processing
227
+ RESOLVED_PARENT_ID=""
228
+ if [[ -n "$parent_id" ]]; then
229
+ # Split by comma or space and try each parent in order
230
+ IFS=$',; ' read -ra parent_candidates <<< "$parent_id"
231
+ for candidate_parent in "${parent_candidates[@]}"; do
232
+ # Trim whitespace
233
+ candidate_parent="${candidate_parent// /}"
234
+ if [[ -z "$candidate_parent" ]]; then
235
+ continue
236
+ fi
237
+
238
+ # Check if this parent file exists
239
+ local test_file="$FULL_OUTPUT_DIR/evolution_${candidate_parent}.py"
240
+ if [[ -f "$test_file" ]]; then
241
+ RESOLVED_PARENT_ID="$candidate_parent"
242
+ echo "[WORKER-$$] Resolved multi-parent '$parent_id' -> '$RESOLVED_PARENT_ID'"
243
+ break
244
+ fi
245
+ done
246
+
247
+ # If no valid parent found, fail
248
+ if [[ -z "$RESOLVED_PARENT_ID" ]]; then
249
+ echo "[WORKER-$$] ERROR: None of the parent algorithms found for: $parent_id" >&2
250
+ echo "[WORKER-$$] Attempted parents: ${parent_candidates[*]}" >&2
251
+ return 78 # Exit code for missing parent
252
+ fi
253
+ fi
254
+
225
255
  # Determine source algorithm
226
256
  local source_file
227
- if [[ -z "$parent_id" ]]; then
257
+ if [[ -z "$RESOLVED_PARENT_ID" ]]; then
228
258
  echo "[WORKER-$$] Using base algorithm"
229
259
  source_file="$FULL_ALGORITHM_PATH"
230
260
  else
231
- echo "[WORKER-$$] Using parent algorithm: $parent_id"
232
- source_file="$FULL_OUTPUT_DIR/evolution_${parent_id}.py"
233
- if [[ ! -f "$source_file" ]]; then
234
- echo "[WORKER-$$] ERROR: Parent algorithm not found: $source_file" >&2
235
- return 78 # New exit code for missing parent
236
- fi
261
+ echo "[WORKER-$$] Using parent algorithm: $RESOLVED_PARENT_ID"
262
+ source_file="$FULL_OUTPUT_DIR/evolution_${RESOLVED_PARENT_ID}.py"
237
263
  fi
238
-
264
+
239
265
  # Check if this is a baseline candidate (no parent and specific ID pattern)
240
266
  local is_baseline=false
241
- if [[ -z "$parent_id" ]] && [[ "$candidate_id" =~ ^(baseline|baseline-000|000|0|gen00-000)$ ]]; then
267
+ if [[ -z "$RESOLVED_PARENT_ID" ]] && [[ "$candidate_id" =~ ^(baseline|baseline-000|000|0|gen00-000)$ ]]; then
242
268
  is_baseline=true
243
269
  echo "[WORKER-$$] Detected baseline candidate - will run algorithm.py directly"
244
270
  fi
@@ -612,7 +638,10 @@ with EvolutionCSV('$FULL_CSV_PATH') as csv:
612
638
  " 2>/dev/null || true
613
639
  elif [[ $process_exit_code -eq 78 ]]; then
614
640
  # Missing parent; mark child as failed and immediately process parent
615
- echo "[WORKER-$$] Parent '$parent_id' missing for $candidate_id"
641
+ # Use RESOLVED_PARENT_ID which was set by process_candidate
642
+ local actual_parent_id="${RESOLVED_PARENT_ID:-$parent_id}"
643
+
644
+ echo "[WORKER-$$] Parent '$actual_parent_id' missing for $candidate_id"
616
645
  echo "[WORKER-$$] Marking $candidate_id as failed-parent-missing"
617
646
 
618
647
  "$PYTHON_CMD" -c "
@@ -630,7 +659,7 @@ import sys
630
659
  sys.path.insert(0, '$SCRIPT_DIR/..')
631
660
  from lib.evolution_csv import EvolutionCSV
632
661
  with EvolutionCSV('$FULL_CSV_PATH') as csv:
633
- parent = csv.get_candidate_info('$parent_id')
662
+ parent = csv.get_candidate_info('$actual_parent_id')
634
663
  if parent:
635
664
  status = parent.get('status', '').lower()
636
665
  parent_of_parent = parent.get('basedOnId', '')
@@ -644,7 +673,7 @@ with EvolutionCSV('$FULL_CSV_PATH') as csv:
644
673
 
645
674
  # Only process if parent needs processing
646
675
  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)"
676
+ echo "[WORKER-$$] Immediately processing parent '$actual_parent_id' (status: $parent_status)"
648
677
 
649
678
  # Mark parent as running
650
679
  "$PYTHON_CMD" -c "
@@ -652,27 +681,27 @@ import sys
652
681
  sys.path.insert(0, '$SCRIPT_DIR/..')
653
682
  from lib.evolution_csv import EvolutionCSV
654
683
  with EvolutionCSV('$FULL_CSV_PATH') as csv:
655
- csv.update_candidate_status('$parent_id', 'running')
684
+ csv.update_candidate_status('$actual_parent_id', 'running')
656
685
  " 2>/dev/null || true
657
686
 
658
687
  # Clear current candidate (parent processing will set its own)
659
688
  CURRENT_CANDIDATE_ID=""
660
689
 
661
690
  # Process parent recursively
662
- process_candidate "$parent_id" "$parent_of_parent" "$parent_description"
691
+ process_candidate "$actual_parent_id" "$parent_of_parent" "$parent_description"
663
692
  parent_exit_code=$?
664
693
 
665
694
  if [[ $parent_exit_code -eq 0 ]]; then
666
- echo "[WORKER-$$] Successfully processed parent '$parent_id'"
695
+ echo "[WORKER-$$] Successfully processed parent '$actual_parent_id'"
667
696
  # Now the child can potentially be retried (user can reset failed-parent-missing later)
668
697
  else
669
- echo "[WORKER-$$] Failed to process parent '$parent_id' (exit code: $parent_exit_code)"
698
+ echo "[WORKER-$$] Failed to process parent '$actual_parent_id' (exit code: $parent_exit_code)"
670
699
  fi
671
700
  else
672
- echo "[WORKER-$$] Parent '$parent_id' has status '$parent_status' - not processing"
701
+ echo "[WORKER-$$] Parent '$actual_parent_id' has status '$parent_status' - not processing"
673
702
  fi
674
703
  else
675
- echo "[WORKER-$$] Warning: parent '$parent_id' not found in CSV"
704
+ echo "[WORKER-$$] Warning: parent '$actual_parent_id' not found in CSV"
676
705
  fi
677
706
 
678
707
  # Clear current candidate and continue to next
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-evolve",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "bin": {
5
5
  "claude-evolve": "./bin/claude-evolve",
6
6
  "claude-evolve-main": "./bin/claude-evolve-main",