Skip to content

fix(simple): validate source checkpoint and recipe before creating fork directory - #322

Merged
ryoari merged 2 commits into
AOSSIE-Org:mainfrom
tejasprasad2008-afk:fix/fork-validate-inputs-before-mkdir
Nov 15, 2026
Merged

ryoari merged 2 commits into
AOSSIE-Org:mainfrom
tejasprasad2008-afk:fix/fork-validate-inputs-before-mkdir

Conversation

@tejasprasad2008-afk

Copy link
Copy Markdown
Contributor

Description

In cmd_fork, out.mkdir(parents=True, exist_ok=False) was executed before verifying that the source boundary checkpoint ckpt-{k:05d}.pt and recipe.json exist. When either file was missing, torch.load failed with FileNotFoundError, leaving an abandoned output directory on disk that caused subsequent runs to fail with FileExistsError.

Changes

  • Validate that (src / f"ckpt-{k:05d}.pt").is_file() and (src / "recipe.json").is_file() before directory creation.
  • Added regression tests in tests/simple/test_ovl.py asserting no directory is created on missing files.

Reproduction & Verification

Reproduction Before Fix

Verification After Fix

  • pytest tests/simple/test_ovl.py passes (41 passed in 1.4s).
  • Full test suite passes: pytest tests/ (107 passed, 1 skipped).

AI Usage Disclosure

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.
  • I have used the following AI models and tools: Gemini for code review and test suite formulation.

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ryoari
ryoari marked this pull request as ready for review November 15, 2026 00:45

@ryoari ryoari left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. A missing checkpoint or recipe.json now stops fork before it creates the output folder, and the tests check that no folder is left behind. Merging.

@ryoari
ryoari merged commit 0f69273 into AOSSIE-Org:main Nov 15, 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.

2 participants