Repository navigation
fix: never commit .brain/ into a vault, and write manifests atomically - #236
Merged
Merged
Conversation
A hard reboot of embark-brain (2026-10-29) left every vault's .gitignore empty. The next `git add -A` tracked .brain/index.db (118 MB), and from then on the cycle and every agent's vault-sync committed a fresh copy each run: the brain disk filled (38 GB of history from a 143 MB master), three manifests were cut off mid-write by ENOSPC, and every agent sync failed because `brain index` rewrites the tracked index between the commit and the pull. - holds.commit_vault_strays and deploy/agents-box/scripts/vault-sync exclude .brain/ by name and untrack it if it is tracked, instead of relying on .gitignore. - compiler.write_manifest writes a temp file and renames it into place, so an interrupted busy-key rewrite leaves the old manifest whole. Claude-Session: https://claude.ai/code/session_01LdXVKJurmhkcFxdUJBLKcr
This branch was successfully deployed
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.
Summary
.gitignoreempty.git add -Atracked.brain/index.db(118 MB), and both the cycle and every agent'svault-syncthen committed it every run. The brain disk filled (38 GB), three manifests were truncated by ENOSPC, and every agent sync failed (the live index changes between commit and pull). Repaired by hand on the live boxes; this makes it impossible to repeat.holds.commit_vault_straysandvault-sync: exclude.brain/by name, and untrack it if it is already tracked. They no longer trust.gitignore.compiler.write_manifest: temp file +os.replace, so a cut-short rewrite of the busy key leaves the old manifest whole.Test plan
tests/test_brain_dir_never_committed.py(4 tests, all failed before the fix): the cycle with no.gitignore, the cycle untracking a committed index (live file kept), a manifest write cut short at half (old bytes intact), andvault-syncend-to-end with a committed index and abrain indexthat rewrites it every run (pull and push succeed twice, the server never tracks.brain/, the agent keeps its index).ruff@0.16.0clean.https://claude.ai/code/session_01LdXVKJurmhkcFxdUJBLKcr