Skip to content

fix(cli): ignore non-checkpoint folders when reporting the latest checkpoint - #617

Merged
codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
xiao98:fix-cli-latest-checkpoint
Nov 25, 2026
Merged

codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
xiao98:fix-cli-latest-checkpoint

Conversation

@xiao98

@xiao98 xiao98 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Problem

After a run finishes, openevolve-run looks for the latest checkpoint to print the resume hint. It sorts every directory under checkpoints/ with:

key=lambda x: int(x.split("_")[-1]) if "_" in x else 0

x is the full path, and the default output folder (openevolve_output) already contains an underscore, so the "_" in x guard is always true. Any directory there that is not checkpoint_<n> raises ValueError, which the generic handler turns into a traceback and exit status 1, even though the evolution itself completed and the best program was saved.

Reproduce: keep a copy of a checkpoint next to the others (e.g. checkpoints/checkpoint_10_backup) or any other folder (checkpoints/notes), then run the CLI:

Error: invalid literal for int() with base 10: 'backup'
Traceback (most recent call last):
  File "openevolve/cli.py", line 210, in main_async
    latest_checkpoint = sorted(
ValueError: invalid literal for int() with base 10: 'backup'

Scripts and CI jobs that check the exit code see a successful run as failed.

Fix

Only directories named checkpoint_<iteration> are treated as checkpoints; the highest iteration is reported. Everything else in the folder is ignored.

Tests

tests/test_cli_latest_checkpoint.py runs main_async with a stubbed engine:

  • the highest-numbered checkpoint is reported (checkpoint_10 over checkpoint_9)
  • other directories are ignored (failed before with the ValueError above)
  • no numbered checkpoints: exits 0 without a resume hint (failed before)

…ckpoint

After a run, the CLI sorts every directory under checkpoints/ by
int(path.split("_")[-1]). Any directory that is not checkpoint_<n>, such
as a renamed copy (checkpoint_10_backup) or a notes folder, raises
ValueError there, so a run that finished successfully prints a traceback
and exits with status 1.

Only consider checkpoint_<iteration> directories.
@CLAassistant

CLAassistant commented Nov 25, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codelion
codelion merged commit bb4b1f3 into algorithmicsuperintelligence:main Nov 25, 2026
5 checks passed
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.

3 participants