Data root and fail-fast
This page documents Orleans.Lattice.Api.Mcp.RepoContext, which is unreleased, in the documentation for Orleans.Lattice 10.5.0 (release line 10.5), built 2026-12-05. It is also published as markdown, with every table and list, at data-root-and-fail-fast.md, and llms.txt lists every page.Part of Container quickstart.
All durable local state - the file WAL directory and, in the local profile, the SQLite database - lives under LATTICE_DATA_ROOT (default /data), which must be a bind mount or named volume. The host fails fast at startup if the file WAL directory (when the file WAL is selected) or the directory holding the SQLite database (when a SQLite store is selected) cannot be created or is not writable by its non-root UID. Both sit under that root unless LATTICE_WAL_DIR or LATTICE_SQLITE_PATH moves them, so a misconfigured mount - read-only, or owned by another UID - surfaces immediately instead of silently losing durability; a profile that selects neither, such as the azure defaults, leaves the guard nothing to probe. A missing directory is created rather than refused, so the guard cannot tell a real mount from a directory inside the container.
That includes the agent memory tree, which sits under the same root as the rebuildable index and cannot be moved off it - so a gesture that destroys the data volume, docker compose down -v above all, destroys authored memory alongside a code index that would have rebuilt itself in minutes. repocontext_reset_index exists for the index case and loses nothing. See Memory durability for why the two cannot be split across volumes, and for the opt-in memory archive that makes the destructive gesture survivable.
Reclaiming SQLite space
By default SQLite never gives deleted space back: freed pages stay on its internal freelist and the file keeps its high-water size, so an index reset or a large prune leaves a multi-gigabyte repocontext.db that is mostly empty. The host therefore runs the database with auto_vacuum=INCREMENTAL (LATTICE_SQLITE_AUTO_VACUUM, default incremental) and a paced background reclaimer that returns at most 4096 freed pages (16 MiB at the default page size) per minute, each step one short write transaction. Incremental is the default rather than full because full relocates and truncates pages inside every commit, which every grain-state write would pay for; incremental adds nothing to a commit and spreads a large give-back over time instead of competing with foreground writes. none restores SQLite's default of never shrinking.
Running locally: the first start after upgrading converts the existing file once. SQLite can only switch an existing database's auto_vacuum mode by rewriting it, so a start that finds a different recorded mode runs a single VACUUM before the host accepts work. Expect, once:
- startup to take longer before
/health/liveanswers - the rewrite is proportional to live data, not file size, because freelist pages are not copied; - temporary disk use of about the live-data size, in the container's temp directory and the database's WAL beside it;
- a log line
SQLite database converted from auto_vacuum=None to auto_vacuum=Incremental ...naming the before and after file sizes.
Later starts find the mode already recorded and do nothing. To defer the conversion, set LATTICE_SQLITE_AUTO_VACUUM=none; the file then never shrinks, exactly as before. A new data volume adopts the mode for free.
Sweeping stranded snapshot storage
auto_vacuum returns the pages of rows that have been deleted. It cannot help with rows that are still present but that nothing will ever read. Builds before issues #4383 and #4419 left exactly that behind whenever a leaf was removed: its leaf-snapshot manifest and leaf-snapshot-segment rows, and sometimes a leaf row written back with no tree id after the leaf was cleared. Those rows belong to leaves that no longer exist, so nothing in the library knows their keys and nothing deletes them. On one long-running host they were about 2.7 GB of a 3.6 GB database.
LATTICE_SQLITE_SNAPSHOT_SWEEP runs a one-off sweep for them, before the silo starts and so while nothing else has the database open:
off(the default) does nothing.reportclassifies the rows and logs what it would delete, and deletes nothing.deletedeletes them in batches, then returns the freed pages to the filesystem at once (under the defaultincrementalmode) rather than leaving them to the paced reclaimer.
A leaf's rows are kept when any live row refers to the leaf - a shard root, an internal node, a materialiser pin, a cursor or any other grain's row, or the row of a live sibling leaf - by its key in any encoding. Everything else is deleted. A snapshot whose leaf row is missing but which a shard still routes to is kept, because it may hold the only copy of that leaf's data. Rows that are not leaf or snapshot rows are never deleted.
Run report first and read the SQLite snapshot sweep line in the startup log, then delete, then set it back to off. A second delete finds nothing, but still scans every row, which adds to startup. The sweep only applies when grain state is stored in SQLite. It does not remove a superseded segment generation that a live leaf's manifest no longer references, which needs the manifest decoded; those are rare and small.