Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

docs(serve): say what the interrupt path skips instead of implying parity (#699)

Samir Hanna Verzabd9a65171c13
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 02b6a245..dad67932 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,7 +25,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
it. `serve` now watches for Ctrl-C from before the `initialize` handshake, so
a server started by hand and never contacted by a client is interruptible
too, and exits instead of parking on the uncancellable blocking read of
- stdin. The HTTP transport already had this (#699).
+ stdin. That exit is abrupt — it drops whatever is still queued on the store
+ writer — which is what an interrupt already does to a server that is not
+ PID 1. The HTTP transport already had this (#699).
- The from-source AUR `PKGBUILD` now builds and tests on constrained AUR
builders. Release LTO was disabled (`options=('!debug' '!lto')`) so the
final link no longer gets OOM-killed on low-memory build hosts, and the
diff --git a/crates/ai-memory-cli/src/commands/serve.rs b/crates/ai-memory-cli/src/commands/serve.rs
index e047570c..f740d89a 100644
--- a/crates/ai-memory-cli/src/commands/serve.rs
+++ b/crates/ai-memory-cli/src/commands/serve.rs
@@ -931,11 +931,15 @@ pub async fn run(config: &Config, args: ServeArgs) -> Result<()> {
// stdin on a blocking thread that cannot be cancelled, and
// dropping the runtime waits for blocking tasks, so the
// process would sit there until the client closed the pipe.
- // Leaving here is exactly what the default disposition
- // already does for a server that is not PID 1 — the same
- // abruptness, now reachable inside the image too — and 0
- // matches the HTTP arm's exit for an operator-requested
- // stop.
+ // Exiting here skips what unwinding would run: the store
+ // writer's `Shutdown`-and-join and the runtime's own
+ // shutdown, so whatever is still queued on the writer is
+ // dropped. That is what the default disposition already
+ // does today for a server that is not PID 1 — the same
+ // abruptness, made reachable inside the image too, not a
+ // new one. Only the exit code matches the HTTP arm, which
+ // reaches its 0 by unwinding after
+ // `with_graceful_shutdown`.
std::process::exit(0);
}
}