Repository navigation
fix: validate checkpoint JSON before patching configs - #2
Merged
839390315 merged 2 commits intoOct 21, 2026
Merged
Conversation
Collaborator
|
Hi @YeDonS, thank you for the contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
policy_preprocessor.jsonorpolicy_postprocessor.jsonis malformed,so101_patch_model_config.pycan rewrite earlier checkpoint files and create backups before failing. A failed--mode infercommand can therefore leave the policy configuration and processors inconsistent. Valid JSON that is not an object has the same problem.Parse all three checkpoint JSON objects before invoking any patch helpers. This keeps JSON input failures ahead of config writes and backup creation, while retaining the existing patching and backup behavior.
Six standard-library unittest methods run the actual CLI against temporary copies of the patcher, the two checked-in LLM configs and synthetic checkpoint JSON. They cover:
exportandinfermodes, preserving the original bytes of all five config files.--no-backupand repeated mode switches.Validation on Python 3.10.20 and 3.12.13: before the fix, eight input-preservation subtests fail; after it, all six test methods pass. Compilation and the PR diff whitespace check also pass.
This addresses checkpoint JSON parsing and object-type failures. File writes remain sequential; disk errors, concurrent edits, process interruption and invalid LLM Python configs are outside this change. The tests require no vendor SDK, model weights or robot hardware.