Skip to content

feat: GEPA-style PR reflection feedback loop — increment 1 of #1584 - #1739

Open
Lexus2016 wants to merge 4 commits into
mainfrom
evolution/issue-1584-gepa-reflective
Open

feat: GEPA-style PR reflection feedback loop — increment 1 of #1584#1739
Lexus2016 wants to merge 4 commits into
mainfrom
evolution/issue-1584-gepa-reflective

Conversation

@Lexus2016

Copy link
Copy Markdown
Owner

First coherent slice of #1584: GEPA-style reflective prompt evolution for the evolution pipeline.

What this delivers

A deterministic feedback loop that mines recently closed PRs (merged AND rejected), extracts actionable patterns from reject reasons, and writes a pr-reflection.txt sidecar that the analysis stage reads to calibrate its next selection.

Files

  • scripts/evolution_pr_reflection.py — PR mining + classification + reflection + sidecar writer (273 lines)
  • tests/scripts/test_evolution_pr_reflection.py — 19 unit tests, all passing
  • cron/evolution/pr-reflection.yaml — daily cron job (07:35, no_agent)
  • skills/evolution/evolution-analysis/SKILL.md — new step 6d: read pr-reflection.txt sidecar

How it works

  1. Mine: gh pr list --state closed queries last 7 days of PRs
  2. Classify: merged (success) / rejected (evolution branch, no merge) / closed-other
  3. Reflect: compute merge_rate, detect repeat-rejection patterns (≥2 same reason)
  4. Sidecar: write [evolution-pr-reflection] closed=N merged=N rejected=N merge_rate=N% ... line
  5. Calibrate: analysis skill (6d) reads sidecar and adjusts selection bar

GEPA principle (arXiv:2507.19457)

"Read execution trace + metric feedback, reflect on failures, keep Pareto frontier."
This is the SMALLEST coherent increment — NOT the full multi-optimizer with DSPy.
Just the feedback-collection + reflection sidecar that closes the loop.

Checks

  • ruff check ✓ (all checks passed)
  • ruff format --check ✓ (new files formatted)
  • pytest tests/scripts/test_evolution_pr_reflection.py ✓ (19/19 passed)
  • evolution_skill_lint --skill-edit-budget ✓ (within budget)

Size note

517 lines total (273 script + 206 tests + 24 cron + 14 skill). Exceeds the 200-line
self-merge cap — this is a coherent slice that cannot be meaningfully split smaller
(script + tests are atomic). The merge gate will hold for human review.

Deferred (next increment)

  • Wire GEPA/DSPy as an offline optimizer on the 3-4 pipeline prompts (research-report, issue-creation, triage-rubric)
  • Pareto-frontier retention so no improvement is lost across cycles
  • Collect 20-100 labeled examples per prompt from pipeline history
  • Compare optimized prompts against Pareto baseline on held-out cycles

Add evolution_pr_reflection.py — a deterministic script that mines recently
closed PRs (merged AND rejected), classifies outcomes, extracts repeat-
rejection patterns, and writes a pr-reflection.txt sidecar. The analysis
skill reads this sidecar (new step 6d) to calibrate selection based on
actual merge/reject signals — a GEPA-style reflect-and-rewrite loop.

- scripts/evolution_pr_reflection.py: PR mining + reflection + sidecar writer
- tests/scripts/test_evolution_pr_reflection.py: 19 unit tests (all passing)
- cron/evolution/pr-reflection.yaml: daily cron job (07:35, no_agent)
- skills/evolution/evolution-analysis/SKILL.md: new step 6d reading sidecar

This is the smallest coherent increment of #1584 — NOT the full multi-
optimizer, just the feedback-collection + reflection loop.

Co-Authored-By: Hermes Evolution <evolution@hermes.ai>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 9d29473

❌ Job failures

Python tests / Run tests slice 1/8 · View job

Job Python tests / Run tests slice 1/8 failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant