diff --git a/formulas/run-evolution.toml b/formulas/run-evolution.toml index db4ce45..549c615 100644 --- a/formulas/run-evolution.toml +++ b/formulas/run-evolution.toml @@ -196,36 +196,83 @@ the run; "no_improvement" otherwise. output = "evidence/evolution/{date}.json" schema = "evidence/README.md" +[[steps]] +id = "cleanup" +description = """ +Remove intermediate per-generation candidate files that are not part of the +final results. Only the following files are retained after this step: + + tmp/evolution/run_NNN/best.push3 global champion + tmp/evolution/run_NNN/diff.txt constant delta vs seed + tmp/evolution/run_NNN/evolution.log full run transcript + tools/push3-evolution/seeds/run{NNN}_*.push3 + top-N newly admitted seeds + (≤ elites per generation) + +Files removed: + tmp/evolution/run_NNN/generation_*.jsonl per-candidate fitness records + (already aggregated into evidence) + tmp/evolution/run_NNN/candidate_*.push3 intermediate per-generation + candidates that are not elites + +Rationale: the evolution box reached 91% disk utilisation in run #1025 because +these intermediate files were never cleaned up. Aggregated fitness data is +preserved in evidence/evolution/{date}.json; the per-candidate .push3 files for +non-elite generations are not needed once the evidence file is written. +""" + [[steps]] id = "deliver" description = """ -Commit evidence and champion files, open PR, post summary comment. +Commit results to a branch, push, open PR, then post summary comment. +ORDERING IS MANDATORY — each sub-step must complete before the next begins. +Do NOT post to the issue before the PR URL is available. -1. Commit evidence/evolution/{date}.json to main. - -2. Open a Codeberg PR targeting main containing: +1. CLEAN GIT STATE + Run `git checkout -- .` to discard any working-tree modifications that are + NOT part of the evolution results (e.g. .sol files left over from a prior + session, scratch files). Only stage files that belong to this run: + - evidence/evolution/{date}.json - tools/push3-evolution/seeds/evo_run{NNN}_champion.push3 - (copied from tmp/evolution/run_NNN/best.push3) - - Updated tools/push3-evolution/seeds/manifest.jsonl - (with newly admitted candidates and fresh fitness scores) - PR title: "evo: run{NNN} champion — fitness={best_fitness}" - PR body: generation-by-generation table (gen, best, mean, worst fitness), + - tools/push3-evolution/seeds/manifest.jsonl + Verify `git diff --check` passes before committing. + +2. COMMIT TO BRANCH + Create branch evidence/evolution-run-{run_id} from master. + Commit the staged result files with message: + "evo: run{NNN} results — fitness={best_fitness}" + The commit MUST include all three files above. + +3. PUSH AND CREATE PR + Push the branch to origin. + Open a Codeberg PR targeting master: + Title: "evo: run{NNN} champion — fitness={best_fitness}" + Body: generation-by-generation table (gen, best, mean, worst fitness), top-3 admitted candidates with fitness scores, constant diff vs seed (from diff.txt), link to evidence file. + If `git push` or PR creation fails: + a. Post an error comment to the originating issue with the failure reason + and the path of the local evidence file. + b. Leave the issue OPEN. + c. Exit with a non-zero status — do NOT proceed to step 4. -3. Post summary comment to originating issue: +4. POST SUMMARY COMMENT (only after PR URL is confirmed) + Post a comment to the originating issue containing: - Verdict (improved / no_improvement). - Best fitness achieved and which generation it was found in. - Admission count: N candidates added to seed pool. - - Link to champion PR (if new best found) and evidence file. - - If no_improvement: include best fitness achieved and seed pool size. + - Link to the champion PR (required — do not post without it). + - Link to evidence file committed in the PR. + - If no_improvement: best fitness achieved and seed pool size. + Do NOT close the issue in this step; closing is the orchestrator's + responsibility once the PR is merged. """ # ── Products ─────────────────────────────────────────────────────────────────── [products.evidence_file] path = "evidence/evolution/{date}.json" -delivery = "commit to main" +delivery = "PR to main (same PR as champion_files, on branch evidence/evolution-run-{run_id})" schema = "evidence/README.md" # see ## Schema: evolution/YYYY-MM-DD.json [products.champion_files] @@ -240,9 +287,11 @@ delivery = "PR to main (same PR as champion_files)" note = "Updated with newly admitted entries and fitness scores from evaluate-seeds." [products.issue_comment] -delivery = "post to originating issue" -content = "verdict (improved/no_improvement), best fitness, generation found, admission count, link to champion PR and evidence file" -on_failure = "include best fitness achieved, last generation completed, full log available in tmp/evolution/run_NNN/evolution.log" +delivery = "post to originating issue AFTER PR is created and URL is confirmed" +content = "verdict (improved/no_improvement), best fitness, generation found, admission count, link to champion PR (mandatory), link to evidence file" +on_pr_failure = "post error comment with failure reason and local evidence path; leave issue OPEN; do not close" +on_run_failure = "include best fitness achieved, last generation completed, full log available in tmp/evolution/run_NNN/evolution.log; do not close issue" +ordering_note = "The comment MUST NOT be posted before the PR URL exists. Closing the issue is the orchestrator's responsibility after PR merge, not this formula's." # ── Resources ──────────────────────────────────────────────────────────────────