claude-evolve 1.6.15 → 1.6.17
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-run +29 -9
- package/bin/claude-evolve-worker +0 -1
- package/package.json +1 -1
package/bin/claude-evolve-run
CHANGED
|
@@ -356,8 +356,12 @@ if [[ -f "$FULL_CSV_PATH" ]]; then
|
|
|
356
356
|
if ! "$PYTHON_CMD" -c "
|
|
357
357
|
import csv
|
|
358
358
|
import sys
|
|
359
|
+
import os
|
|
360
|
+
from pathlib import Path
|
|
359
361
|
|
|
360
362
|
csv_file = '$FULL_CSV_PATH'
|
|
363
|
+
full_output_dir = '$FULL_OUTPUT_DIR' # Pass FULL_OUTPUT_DIR to Python script
|
|
364
|
+
script_dir = '$SCRIPT_DIR' # Pass SCRIPT_DIR for sys.path.append
|
|
361
365
|
|
|
362
366
|
try:
|
|
363
367
|
# Read CSV - let Python's csv module handle all the complexity
|
|
@@ -376,26 +380,42 @@ try:
|
|
|
376
380
|
if len(rows) == 1:
|
|
377
381
|
print('[INFO] CSV has no data rows (only header)')
|
|
378
382
|
|
|
383
|
+
changed_count = 0
|
|
384
|
+
|
|
379
385
|
# Clean up any stuck 'running' statuses
|
|
380
|
-
changed = 0
|
|
381
386
|
for i in range(1, len(rows)):
|
|
382
387
|
if len(rows[i]) > 4 and rows[i][4] == 'running':
|
|
383
388
|
rows[i][4] = ''
|
|
384
|
-
|
|
389
|
+
changed_count += 1
|
|
390
|
+
|
|
391
|
+
# Check for missing Python files for completed/failed candidates
|
|
392
|
+
for i in range(1, len(rows)):
|
|
393
|
+
if len(rows[i]) > 4:
|
|
394
|
+
candidate_id = rows[i][0]
|
|
395
|
+
status = rows[i][4]
|
|
396
|
+
|
|
397
|
+
# Only check if status implies a file should exist
|
|
398
|
+
if status in ['complete', 'failed', 'failed-ai-retry', 'failed-retry1', 'failed-retry2', 'failed-retry3']:
|
|
399
|
+
expected_file = Path(full_output_dir) / f'evolution_{candidate_id}.py'
|
|
400
|
+
if not expected_file.is_file():
|
|
401
|
+
print(f'[INFO] Detected missing file for {candidate_id} (status: {status}). Resetting to pending.')
|
|
402
|
+
rows[i][4] = 'pending' # Reset status to pending
|
|
403
|
+
# Clear performance and other fields if desired, for a clean retry
|
|
404
|
+
if len(rows[i]) > 3: rows[i][3] = '' # Performance
|
|
405
|
+
if len(rows[i]) > 5: rows[i][5] = '' # LLM used for run
|
|
406
|
+
changed_count += 1
|
|
385
407
|
|
|
386
|
-
if
|
|
408
|
+
if changed_count > 0:
|
|
387
409
|
# Write back
|
|
388
410
|
with open(csv_file + '.tmp', 'w', newline='') as f:
|
|
389
411
|
writer = csv.writer(f)
|
|
390
412
|
writer.writerows(rows)
|
|
391
|
-
import os
|
|
392
413
|
os.rename(csv_file + '.tmp', csv_file)
|
|
393
|
-
print(f'[INFO] Reset {
|
|
414
|
+
print(f'[INFO] Reset {changed_count} candidates (stuck running or missing files) to pending')
|
|
394
415
|
|
|
395
416
|
# Count pending candidates using UNIFIED logic
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
from evolution_csv import EvolutionCSV
|
|
417
|
+
sys.path.append(script_dir + '/..')
|
|
418
|
+
from lib.evolution_csv import EvolutionCSV
|
|
399
419
|
|
|
400
420
|
with EvolutionCSV(csv_file) as csv_ops:
|
|
401
421
|
pending = csv_ops.count_pending_candidates()
|
|
@@ -409,7 +429,7 @@ except csv.Error as e:
|
|
|
409
429
|
except Exception as e:
|
|
410
430
|
print(f'[ERROR] Failed to read CSV: {e}')
|
|
411
431
|
sys.exit(1)
|
|
412
|
-
"; then
|
|
432
|
+
" 2>&1; then
|
|
413
433
|
echo "[ERROR] CSV validation failed. Please check the error message above."
|
|
414
434
|
exit 1
|
|
415
435
|
fi
|
package/bin/claude-evolve-worker
CHANGED
|
@@ -37,7 +37,6 @@ csv = EvolutionCSV('$FULL_CSV_PATH')
|
|
|
37
37
|
info = csv.get_candidate_info('$CURRENT_CANDIDATE_ID')
|
|
38
38
|
if info and info.get('status', '').lower() != 'complete':
|
|
39
39
|
csv.update_candidate_status('$CURRENT_CANDIDATE_ID', 'pending')
|
|
40
|
-
print('reset')
|
|
41
40
|
sys.exit(0)
|
|
42
41
|
else:
|
|
43
42
|
# No reset needed
|