Skip to content

store: publish the manifest before pruning stale experts - #34

Closed
GroveMinting wants to merge 1 commit into
volotat:mainfrom
GroveMinting:fix/store-manifest-before-prune
Closed

GroveMinting wants to merge 1 commit into
volotat:mainfrom
GroveMinting:fix/store-manifest-before-prune

Conversation

@GroveMinting

Copy link
Copy Markdown

Problem

store.save deletes expert files that are no longer in the new manifest before it publishes that manifest. If the process dies between the deletion and the atomic manifest replace, the old manifest still names the deleted files and the checkpoint cannot be loaded.

This can happen on a prune, a shape-changing save, a crash, a SIGKILL, or ENOSPC.

Fix

Count stale expert files before publishing, then delete them only after the new manifest is durable. The deletion is placed after the existing manifest publication block, so this change is deliberately independent of the publication mechanism.

Stale extra files are harmless in the meantime: the loader reads only the files named in the manifest, and the next successful save removes them.

Compatibility with #32

This composes with #32, which adds a retrying _replace for Windows reader locks. It touches neither _savez nor the manifest replace call, and I verified the combined tree in both merge orders: tests.test_soak and tests.test_windows_runtime pass together (13 tests).

Files

  • minagi/store.py — defer stale-expert deletion until after manifest publication.
  • tests/test_soak.py — new regression tests for interrupted manifest publication, ENOSPC, retry, and prune ordering.

The manual fault-injection soak runner stays in my fork; it is not needed for this fix.

Validation

@GroveMinting

Copy link
Copy Markdown
Author

Moving this to the fork: upstream has not been merging community PRs. The prune-ordering fix and the #32 Windows retry changes are now carried on GroveMinting/mini-AGI main, where they can be tested together. Closing this upstream PR rather than leaving it waiting.

@GroveMinting
GroveMinting deleted the fix/store-manifest-before-prune branch October 22, 2026 04:11
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.

1 participant