diff --git a/tools/push3-evolution/evolution-daemon.sh b/tools/push3-evolution/evolution-daemon.sh index 9a24563..7dbf8cc 100755 --- a/tools/push3-evolution/evolution-daemon.sh +++ b/tools/push3-evolution/evolution-daemon.sh @@ -121,7 +121,9 @@ ts() { notify() { local msg="$*" if [ -n "$OPENCLAW_SSH_TARGET" ]; then - ssh "$OPENCLAW_SSH_TARGET" "openclaw system event '$msg'" 2>/dev/null || true + # Pass message via stdin to avoid shell-quoting issues with special characters. + printf '%s\n' "$msg" | \ + ssh "$OPENCLAW_SSH_TARGET" 'read -r _msg; openclaw system event "$_msg"' 2>/dev/null || true fi } @@ -190,7 +192,9 @@ while true; do PATCH_APPLIED=true log " Patches applied OK" else - log " WARNING: patch failed to apply — running without evolution-specific overrides" + log " ERROR: patch failed to apply — skipping run (evaluation semantics would differ from intended)" + log " Hint: evolution.patch may need regeneration if onchain/ files changed upstream." + continue fi else log "[2/7] No patch file — skipping" @@ -211,27 +215,24 @@ while true; do log "[4/7] Starting evolve.sh…" - DIVERSE_FLAG="" - [ "$DIVERSE_SEEDS" = "true" ] && DIVERSE_FLAG="--diverse-seeds" + # Build argument array — avoids unquoted variable word-splitting. + EVOLVE_ARGS=( + --seed "$SEED" + --population "$POPULATION" + --generations "$GENERATIONS" + --mutation-rate "$MUTATION_RATE" + --elites "$ELITES" + --output "$OUTPUT_DIR" + ) + [ "$DIVERSE_SEEDS" = "true" ] && EVOLVE_ARGS+=(--diverse-seeds) + # Stream evolve.sh output directly — do NOT buffer via $(...). + # A full run can take tens of minutes; buffering would make the daemon + # appear hung with no generation-level progress visible. EVOLVE_EC=0 - EVOLVE_OUT="" - EVOLVE_OUT=$( - EVAL_MODE="$EVAL_MODE" \ - BASE_RPC_URL="$BASE_RPC_URL" \ - bash "$EVOLVE_SH" \ - --seed "$SEED" \ - --population "$POPULATION" \ - --generations "$GENERATIONS" \ - --mutation-rate "$MUTATION_RATE" \ - --elites "$ELITES" \ - --output "$OUTPUT_DIR" \ - $DIVERSE_FLAG \ - 2>&1 - ) || EVOLVE_EC=$? - - # Always print evolve.sh output for visibility. - printf '%s\n' "$EVOLVE_OUT" >&2 + EVAL_MODE="$EVAL_MODE" \ + BASE_RPC_URL="$BASE_RPC_URL" \ + bash "$EVOLVE_SH" "${EVOLVE_ARGS[@]}" || EVOLVE_EC=$? if [ "$EVOLVE_EC" -ne 0 ]; then log " WARNING: evolve.sh exited $EVOLVE_EC — results may be incomplete" @@ -293,7 +294,7 @@ PYEOF # ── Steps 6 (seed admission already done by evolve.sh) ────────────────────── # evolve.sh step 5 handles pool admission automatically. - # ── Step 7: Write summary report ──────────────────────────────────────────── + # ── Step 6: Write summary report ──────────────────────────────────────────── RUN_END="$(date +%s)" DURATION=$(( RUN_END - RUN_START )) diff --git a/tools/push3-evolution/evolution.conf b/tools/push3-evolution/evolution.conf index 52239e9..e76ec90 100644 --- a/tools/push3-evolution/evolution.conf +++ b/tools/push3-evolution/evolution.conf @@ -17,14 +17,15 @@ MUTATION_RATE=1 ELITES=2 DIVERSE_SEEDS=true -# ── Evolution-specific overrides (applied via evolution.patch) ────────────────── -# GAS_LIMIT: production cap is 200 000; evolution uses 500 000 to allow larger -# programs that are still worth exploring before gas optimisation. -GAS_LIMIT=500000 - -# ANCHOR_WIDTH_UNBOUNDED: removes the MAX_ANCHOR_WIDTH=100 production cap so -# programs can explore the full uint24 tick-width space. -ANCHOR_WIDTH_UNBOUNDED=true +# ── Evolution-specific overrides — DOCUMENTATION ONLY ────────────────────────── +# These two variables are NOT read by evolution-daemon.sh at runtime. +# They document the semantic intent of evolution.patch, which is the actual +# mechanism that changes the compiled Solidity constants before each run. +# Editing these values here has NO runtime effect; to change the overrides, +# regenerate evolution.patch (see the patch file for instructions). +# +# GAS_LIMIT=500000 (patch raises CALCULATE_PARAMS_GAS_LIMIT 200k→500k) +# ANCHOR_WIDTH_UNBOUNDED=true (patch sets MAX_ANCHOR_WIDTH to type(uint24).max) # ── Notification (openclaw) ───────────────────────────────────────────────────── # SSH target for `openclaw system event` notifications.