Merge pull request 'fix: fix: evolution formula must commit results via PR before closing (#1047)' (#1088) from fix/issue-1047 into master

This commit is contained in:
johba 2026-03-22 02:26:02 +01:00
commit 8d6dab197f
2 changed files with 67 additions and 16 deletions

View file

@ -51,3 +51,5 @@
- [2026-03-20] Adoption milestone state ambiguity in MEMORY.md (#1068) - [2026-03-20] Adoption milestone state ambiguity in MEMORY.md (#1068)
- [2026-03-20] OptimizerV3Push3 as IOptimizer always returns bear defaults — integration risk (#1063) - [2026-03-20] OptimizerV3Push3 as IOptimizer always returns bear defaults — integration risk (#1063)
- [2026-03-20] implement evidence/resources and evidence/protocol logging (#1059): formulas/run-resources.toml (disk/RAM/API/CI sense formula, daily cron 06:00 UTC) and formulas/run-protocol.toml (TVL/fees/positions/rebalances sense formula, daily cron 07:00 UTC); evidence/resources/ and evidence/protocol/ directories; schemas in evidence/README.md - [2026-03-20] implement evidence/resources and evidence/protocol logging (#1059): formulas/run-resources.toml (disk/RAM/API/CI sense formula, daily cron 06:00 UTC) and formulas/run-protocol.toml (TVL/fees/positions/rebalances sense formula, daily cron 07:00 UTC); evidence/resources/ and evidence/protocol/ directories; schemas in evidence/README.md
- [2026-03-21] Optimizer and OptimizerV3 lack _disableInitializers() in constructor (#1055)
- [2026-03-21] evolution formula must commit results via PR before closing (#1047)

View file

@ -196,36 +196,83 @@ the run; "no_improvement" otherwise.
output = "evidence/evolution/{date}.json" output = "evidence/evolution/{date}.json"
schema = "evidence/README.md" 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]] [[steps]]
id = "deliver" id = "deliver"
description = """ 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. 1. CLEAN GIT STATE
Run `git checkout -- .` to discard any working-tree modifications that are
2. Open a Codeberg PR targeting main containing: 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 - tools/push3-evolution/seeds/evo_run{NNN}_champion.push3
(copied from tmp/evolution/run_NNN/best.push3) - tools/push3-evolution/seeds/manifest.jsonl
- Updated tools/push3-evolution/seeds/manifest.jsonl Verify `git diff --check` passes before committing.
(with newly admitted candidates and fresh fitness scores)
PR title: "evo: run{NNN} champion — fitness={best_fitness}" 2. COMMIT TO BRANCH
PR body: generation-by-generation table (gen, best, mean, worst fitness), 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 top-3 admitted candidates with fitness scores, constant diff vs
seed (from diff.txt), link to evidence file. 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). - Verdict (improved / no_improvement).
- Best fitness achieved and which generation it was found in. - Best fitness achieved and which generation it was found in.
- Admission count: N candidates added to seed pool. - Admission count: N candidates added to seed pool.
- Link to champion PR (if new best found) and evidence file. - Link to the champion PR (required do not post without it).
- If no_improvement: include best fitness achieved and seed pool size. - 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 ───────────────────────────────────────────────────────────────────
[products.evidence_file] [products.evidence_file]
path = "evidence/evolution/{date}.json" 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 schema = "evidence/README.md" # see ## Schema: evolution/YYYY-MM-DD.json
[products.champion_files] [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." note = "Updated with newly admitted entries and fitness scores from evaluate-seeds."
[products.issue_comment] [products.issue_comment]
delivery = "post to originating issue" 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 and evidence file" content = "verdict (improved/no_improvement), best fitness, generation found, admission count, link to champion PR (mandatory), link to evidence file"
on_failure = "include best fitness achieved, last generation completed, full log available in tmp/evolution/run_NNN/evolution.log" 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 ────────────────────────────────────────────────────────────────── # ── Resources ──────────────────────────────────────────────────────────────────