Skip to content

fix: bootstrap corpus until --min-corpus-files is reached, not a fixed count - #886

Merged
devdanzin merged 1 commit into
mainfrom
fix/min-corpus-files-undershoot
Jul 2, 2026
Merged

devdanzin merged 1 commit into
mainfrom
fix/min-corpus-files-undershoot

Conversation

@devdanzin

Copy link
Copy Markdown
Owner

Summary

--min-corpus-files N produced a corpus with noticeably fewer than N entries.

Root cause: run_evolutionary_loop computed needed = N - current once and ran for _ in range(needed): generate_new_seed(...). But generate_new_seed only grows the corpus when a seed is interesting AND not a duplicate — every rejected/duplicate seed (the duplicate_rejected health events) was a wasted attempt, so the corpus undershot N.

Fix: loop until the corpus actually reaches min_corpus_files (re-checking each iteration), bounded by MIN_CORPUS_SEED_ATTEMPT_MULTIPLIER × deficit so a pathological duplicate rate can't spin forever; warn if the cap is hit before reaching N. A heartbeat is written each attempt so the bootstrap stays observable.

Test plan

  • test_bootstrap_retries_until_minimum_when_seeds_rejected — 50% accept rate reaches N (10 attempts for 5 files).
  • test_bootstrap_caps_attempts_when_seeds_never_accepted — stops at the cap and warns (no hang).
  • Existing bootstrap unit + integration tests updated to simulate corpus growth.
  • Full suite 2172 passed; mypy lafleur clean; ruff clean.

Closes #885

🤖 Generated with Claude Code

…d count

run_evolutionary_loop computed `needed = min_corpus_files - current` once and ran
`for _ in range(needed): generate_new_seed(...)`. But generate_new_seed only grows
the corpus when a seed is interesting AND not a duplicate, so every rejected or
duplicate seed was a wasted attempt and the corpus ended up smaller than N.

Loop until the corpus actually reaches min_corpus_files (re-checking size each
iteration), bounded by MIN_CORPUS_SEED_ATTEMPT_MULTIPLIER * deficit so a
pathological duplicate/rejection rate can't spin forever; warn if the cap is hit
before reaching N. Writes a heartbeat each attempt so the bootstrap stays
observable.

Closes #885

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@devdanzin
devdanzin merged commit a3a6ef7 into main Jul 2, 2026
2 checks passed
@devdanzin
devdanzin deleted the fix/min-corpus-files-undershoot branch July 2, 2026 13:28
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.

--min-corpus-files undershoots: bootstrap generates a fixed range(needed) instead of looping until the corpus reaches the minimum

1 participant