Skip to content

v3.1.3 — bounded MCP-watcher memory

Choose a tag to compare

@github-actions github-actions released this 23 Jul 20:15
· 227 commits to main since this release

cxpak 3.1.3 — bounded MCP-watcher memory

Highlights

Fixes a 57 GB (peak 64 GB) memory blow-up in cxpak serve --mcp. During a normal editing session the MCP freshness watcher climbed ~1 GB/min because it deep-cloned the entire CodebaseIndex twice per edit batch — copying every file's content (~44 GB MALLOC_SMALL) and the embedding Vec<f32> matrix (~16 GB MALLOC_LARGE). This release bounds both. (#48 · closes #47 · ADR-0205)

  • One clone per batch + Arc-shared embeddings. embedding_index is now Arc-shared, so cloning the index bumps a refcount instead of copying the embedding matrix — eliminates the ~16 GB class. The redundant second whole-index clone is gone.
  • Copy-on-write file storage. files is now Vec<Arc<IndexedFile>>: a per-batch clone copies O(delta) file contents, not O(codebase) — collapsing the ~44 GB growth. Unchanged files are shared by refcount, and a reader holding an old snapshot is never mutated in place.
  • Memory-ceiling proof. A new test drives 25 real-edit batches and asserts the shared Arc holder count returns to a fixed baseline every batch — no index-version accumulation.

Output is byte-identical (the delta-parity guard still passes), and the snapshot-then-swap reader-consistency and ADR-0200 6-signal-fallback invariants are preserved.

Also in this release

  • Encoded the Barnett Studios review & merge protocol into CONTRIBUTING.md — PR-only, green CI, ≥1 approving review, reviewer ≠ author.

Full Changelog: v3.1.2...v3.1.3