Skip to content

fix(parallel): checkpoint on the interval even when that iteration fails - #622

Open
shaojunying wants to merge 1 commit into
algorithmicsuperintelligence:mainfrom
shaojunying:fix/checkpoint-on-failed-iterations
Open

shaojunying wants to merge 1 commit into
algorithmicsuperintelligence:mainfrom
shaojunying:fix/checkpoint-on-failed-iterations

Conversation

@shaojunying

Copy link
Copy Markdown

Fixes #621

Problem

run_evolution() checks checkpoint_interval only after a successful iteration or a rejected candidate. When the iteration on the interval returns an error or its future raises, no checkpoint is written for that interval.

Change

  • Each completed iteration now gets exactly one checkpoint check, whatever its outcome.
  • The success path keeps its call (it passes is_new_best for checkpoint_on_improvement) and marks the check as done.
  • After the try/except block, the loop calls _checkpoint_if_due() if the success path did not. This covers error results, rejected candidates, timeouts and exceptions.
  • The separate call in the _CandidateRejected handler is removed, because the new call covers it.
  • An exception from the checkpoint callback is logged as before, and strategy errors are still re-raised.

Verification

  • New tests in tests/test_process_parallel.py:
    • the interval iteration returns an error result: checkpoint at 5;
    • the interval iteration's future raises: checkpoint at 5;
    • all iterations succeed: exactly one checkpoint at 5 (no double call).
      The first two fail on main.
  • python -m pytest tests --ignore=tests/integration --ignore=tests/alphaevolve_upstream on Windows, Python 3.12: 29 failed, 1108 passed, 8 skipped. The same 29 tests fail on main on this machine (POSIX path assumptions, os.kill on Windows, locale encoding). No new failures.
  • black --check passes on the changed files.

The checkpoint_interval check ran only after a successful or rejected
iteration. When the iteration on the interval returned an error (no
valid diff, LLM failure) or its future raised, no checkpoint was
written for that interval. Run the check once for every completed
iteration, whatever its outcome.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
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.

Checkpoint is skipped when the iteration on checkpoint_interval fails

2 participants