From 052ad7ac1c6e4320540bf748f166bc8ce212623a Mon Sep 17 00:00:00 2001 From: johba Date: Thu, 19 Mar 2026 07:33:23 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20bundled=20dust=20cleanup=20=E2=80=94=20p?= =?UTF-8?q?ush3-evolution/evolve.sh=20(#210)=20(#987)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Bundled dust cleanup for `push3-evolution/evolve.sh` subsystem: - **#716**: Fix null-fitness crash in generation JSONL parsing — `int(d.get('fitness', 0))` → `int(d.get('fitness') or 0)` (avoids `TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'` when fitness is JSON `null`) - **#944**: Add `processExecIf_fix` to `ZERO_RATED_FLAGS` so inflated scores from that flag are zero-rated during pool admission/eviction - **#945**: `fitness_flags` is comma-separated in practice — update `manifest.schema.json` description from 'Space-separated' to 'Comma-separated' and use `flags.split(',')` in `effective_fitness` instead of substring match - Fix pre-existing SC2086: quote `$i` in `printf` argument (ShellCheck) ## Test plan - [ ] ShellCheck passes on `tools/push3-evolution/evolve.sh` - [ ] CI passes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: openhands Reviewed-on: https://codeberg.org/johba/harb/pulls/987 Reviewed-by: Disinto_bot --- tools/push3-evolution/evolve.sh | 7 ++++--- tools/push3-evolution/seeds/manifest.schema.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/push3-evolution/evolve.sh b/tools/push3-evolution/evolve.sh index 536edf0..6b771b8 100755 --- a/tools/push3-evolution/evolve.sh +++ b/tools/push3-evolution/evolve.sh @@ -423,7 +423,7 @@ PYEOF else # --- Default mode: N copies of the seed, each independently mutated --- for i in $(seq 0 $((POPULATION - 1))); do - CAND_FILE="$GEN_DIR/candidate_$(printf '%03d' $i).push3" + CAND_FILE="$GEN_DIR/candidate_$(printf '%03d' "$i").push3" MUTATED=$(run_mutate_cli mutate "$SEED" "$MUTATION_RATE") \ || fail "Failed to mutate seed for initial candidate $i" printf '%s\n' "$MUTATED" > "$CAND_FILE" @@ -814,7 +814,7 @@ for fname in sorted(os.listdir(output_dir)): try: d = json.loads(line) cid = d.get('candidate_id', '') - fitness = int(d.get('fitness', 0)) + fitness = int(d.get('fitness') or 0) if fitness < threshold: continue # Canonical CID format is "candidate_XXX" (zero-padded numeric suffix, @@ -889,11 +889,12 @@ if not new_items: # Add new inflation/distortion flags here; no other code change is required. ZERO_RATED_FLAGS = { 'token_value_inflation', + 'processExecIf_fix', } def effective_fitness(entry): flags = entry.get('fitness_flags') or '' - if any(flag in flags for flag in ZERO_RATED_FLAGS): + if any(flag in flags.split(',') for flag in ZERO_RATED_FLAGS): return 0 return int(entry.get('fitness') or 0) diff --git a/tools/push3-evolution/seeds/manifest.schema.json b/tools/push3-evolution/seeds/manifest.schema.json index a90e5fb..4c42ae2 100644 --- a/tools/push3-evolution/seeds/manifest.schema.json +++ b/tools/push3-evolution/seeds/manifest.schema.json @@ -17,7 +17,7 @@ }, "fitness_flags": { "type": ["string", "null"], - "description": "Space-separated flags that qualify or invalidate the fitness value (e.g. token_value_inflation). null when no flags apply." + "description": "Comma-separated flags that qualify or invalidate the fitness value (e.g. token_value_inflation). null when no flags apply." }, "origin": { "type": "string",