Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
test(wiki): bound append commit contention
AkitaOnRails2058dcb20c77
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 20d4a0db..6a0cee56 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -13,6 +13,10 @@ version in [`docs/changelog/`](docs/changelog/):### Fixed+- Bounded the wiki append-versus-commit concurrency regression so filesystem+ scheduling cannot turn its background writers into an unbounded fsync+ workload on macOS, while every round still contends with a commit (#1850).+- Fixed false command timeouts in the macOS menu app when CLI output ordiagnostics exceeded a pipe buffer (#1845).diff --git a/crates/ai-memory-wiki/src/git.rs b/crates/ai-memory-wiki/src/git.rsindex 1479aaba..e49abe50 100644--- a/crates/ai-memory-wiki/src/git.rs+++ b/crates/ai-memory-wiki/src/git.rs@@ -2526,32 +2526,42 @@ mod tests {fn concurrent_appends_do_not_fail_a_commit() {let (_tmp, root, adapter) = committed(&[("ws/proj/log.md", "")]);let ledger = root.join("ws/proj/log.md");- let stop = Arc::new(std::sync::atomic::AtomicBool::new(false));+ const ROUNDS: usize = 8;+ const WRITERS: usize = 3;+ // Two barrier waits per round make every append race a commit attempt,+ // while bounding the fsync-heavy work independently of mutex fairness.+ let round = Arc::new(std::sync::Barrier::new(WRITERS + 1));let writers: Vec<_> = (0..3).map(|_| {let adapter = adapter.clone();let ledger = ledger.clone();- let stop = Arc::clone(&stop);+ let round = Arc::clone(&round);std::thread::spawn(move || {- while !stop.load(std::sync::atomic::Ordering::Relaxed) {- adapter- .append(&ledger, b"2026-09-08T00:00:00Z stop x\n")- .unwrap();+ let mut results = Vec::with_capacity(ROUNDS);+ for _ in 0..ROUNDS {+ round.wait();+ results.push(adapter.append(&ledger, b"2026-09-08T00:00:00Z stop x\n"));+ round.wait();+ }+ for result in results {+ result.unwrap();}})}).collect();- for i in 0..30 {- std::thread::sleep(Duration::from_millis(2));+ let mut commits = Vec::with_capacity(ROUNDS);+ for i in 0..ROUNDS {+ round.wait();adapter.mark_written(&ledger);- adapter- .commit_all(&format!("session {i}"))- .unwrap_or_else(|e| panic!("commit {i} failed: {e}"));+ commits.push((i, adapter.commit_all(&format!("session {i}"))));+ round.wait();}- stop.store(true, std::sync::atomic::Ordering::Relaxed);for w in writers {w.join().unwrap();}+ for (i, result) in commits {+ result.unwrap_or_else(|e| panic!("commit {i} failed: {e}"));+ }assert!(adapter.commit_count() >= 2);}