Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(windows): size the CLI dispatch stack
AkitaOnRailsc01b8ea48fae
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a8c973ca..63b5ba4d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,6 +12,11 @@ version in [`docs/changelog/`](docs/changelog/):## [Unreleased]### Fixed+- Prevented the Windows executable from overflowing its small default main+ thread stack as the async CLI command tree grows. The top-level dispatch now+ runs on an explicitly sized stack on Windows; the native Windows suite had+ reached the point where every integration test that launched `ai-memory`+ aborted before handling its command.- Fixed native hook events getting stranded forever when a harness killed theprocess after the spool file was synced but before its atomic rename. A laterdrain adopts complete, valid `*.json.tmp` entries after a five-minute gracediff --git a/crates/ai-memory-cli/src/main.rs b/crates/ai-memory-cli/src/main.rsindex 7e3c8758..560eaa00 100644--- a/crates/ai-memory-cli/src/main.rs+++ b/crates/ai-memory-cli/src/main.rs@@ -10,6 +10,26 @@ use std::time::Duration;use anyhow::Result;fn main() -> Result<()> {+ #[cfg(windows)]+ {+ // Windows executables start with a much smaller main-thread stack than+ // Unix processes. The CLI dispatch future contains every subcommand+ // branch and can outgrow that default as the command tree expands.+ // Keep the platform default for worker threads, but give the one+ // thread that owns the top-level future enough room to dispatch it.+ return std::thread::Builder::new()+ .name("ai-memory-main".to_owned())+ .stack_size(8 * 1024 * 1024)+ .spawn(run)?+ .join()+ .unwrap_or_else(|panic| std::panic::resume_unwind(panic));+ }++ #[cfg(not(windows))]+ run()+}++fn run() -> Result<()> {// The runtime is built by hand rather than with `#[tokio::main]` for the// sake of the `shutdown_timeout` below; the builder settings are the ones// that attribute would have used.