Skip to content

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

Rust

feat(status): report HTTP exposure so an unauthenticated bind is pollable

Abhishek Sharma7633c8666311
diff --git a/crates/ai-memory-cli/src/commands/serve.rs b/crates/ai-memory-cli/src/commands/serve.rs
index 42f077c8..be489d74 100644
--- a/crates/ai-memory-cli/src/commands/serve.rs
+++ b/crates/ai-memory-cli/src/commands/serve.rs
@@ -636,6 +636,21 @@ fn exposure_banner(exposure: HttpExposure, local_addr: SocketAddr) -> Option<Str
}
}
+/// The `/admin/status` view of an exposure verdict.
+///
+/// Separate from [`exposure_banner`] because the two answer different
+/// questions: the banner is read once at startup, this is polled afterwards.
+/// They must not be able to disagree, so both derive from the same
+/// [`HttpExposure`] and a test pins that.
+fn exposure_report(exposure: HttpExposure) -> ai_memory_mcp::admin::HttpExposureReport {
+ use ai_memory_mcp::admin::HttpExposureReport as Report;
+ match exposure {
+ HttpExposure::Safe => Report::Safe,
+ HttpExposure::InsecureByOverride => Report::UnauthenticatedByOverride,
+ HttpExposure::UndeterminedInContainer => Report::UnauthenticatedInContainer,
+ }
+}
+
/// Validate the trusted proxy's least-privilege credential and optional stable
/// root identity before binding the server.
fn validate_trusted_proxy_auth(auth: &AuthSettings) -> Result<()> {
@@ -1337,6 +1352,11 @@ pub async fn run(config: &Config, args: ServeArgs) -> Result<()> {
sanitizer: sanitizer.clone(),
data_dir: config.data_dir.clone(),
});
+ // Shared with the post-bind exposure record below: the verdict needs
+ // the bound address, which is not known until the listener exists.
+ let http_exposure_cell: std::sync::Arc<
+ std::sync::OnceLock<ai_memory_mcp::admin::HttpExposureReport>,
+ > = std::sync::Arc::new(std::sync::OnceLock::new());
let admin = admin_router_with_sweep_tuning(
AdminState {
ingest_metrics: ingest_metrics.clone(),
@@ -1354,6 +1374,7 @@ pub async fn run(config: &Config, args: ServeArgs) -> Result<()> {
data_dir: config.data_dir.clone(),
db_path: store.db_path().to_path_buf(),
bind: bind.clone(),
+ http_exposure: http_exposure_cell.clone(),
home_dir: config.home_dir.clone(),
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: config
@@ -1557,6 +1578,9 @@ pub async fn run(config: &Config, args: ServeArgs) -> Result<()> {
body_limit_mb = MAX_BODY_BYTES / 1024 / 1024,
"MCP HTTP server ready (POST /mcp, POST /hook, Ctrl-C to stop)",
);
+ // Record the verdict for `/admin/status` before announcing it, so a
+ // poller and the startup banner cannot disagree (#902).
+ let _ = http_exposure_cell.set(exposure_report(exposure));
// Unconditional: see `exposure_banner` for why this does not ride
// on the tracing filter.
if let Some(banner) = exposure_banner(exposure, local_addr) {
@@ -3080,6 +3104,38 @@ mod tests {
assert_eq!(exposure_banner(authed, quick_start), None);
}
+ /// The polled verdict and the startup banner must not be able to disagree:
+ /// an operator seeing `safe` in `ai-memory status` while the banner said
+ /// otherwise would trust the wrong one.
+ #[test]
+ fn the_status_report_agrees_with_the_startup_banner() {
+ use ai_memory_mcp::admin::HttpExposureReport as Report;
+ let addr: SocketAddr = "0.0.0.0:49374".parse().expect("valid test address");
+
+ for exposure in [
+ HttpExposure::Safe,
+ HttpExposure::InsecureByOverride,
+ HttpExposure::UndeterminedInContainer,
+ ] {
+ let reported = exposure_report(exposure);
+ let banner = exposure_banner(exposure, addr);
+ assert_eq!(
+ reported == Report::Safe,
+ banner.is_none(),
+ "{exposure:?} reported {reported:?} but banner was {banner:?}"
+ );
+ }
+
+ assert_eq!(
+ exposure_report(HttpExposure::InsecureByOverride),
+ Report::UnauthenticatedByOverride
+ );
+ assert_eq!(
+ exposure_report(HttpExposure::UndeterminedInContainer),
+ Report::UnauthenticatedInContainer
+ );
+ }
+
/// Regression for #407. The published image binds `0.0.0.0` because that
/// is the only way `-p` publishing works, so the host-side rule above
/// refused every container started from the documented Quick Start and
diff --git a/crates/ai-memory-cli/src/commands/status.rs b/crates/ai-memory-cli/src/commands/status.rs
index 7a499e2d..ee905414 100644
--- a/crates/ai-memory-cli/src/commands/status.rs
+++ b/crates/ai-memory-cli/src/commands/status.rs
@@ -25,7 +25,31 @@ struct IngestReport {
last_persisted_ms: Option<u64>,
}
+/// A server that predates #902 sends no verdict. Reported as `unknown` rather
+/// than assumed safe — guessing here would be the failure this feature exists
+/// to prevent.
+fn unknown_exposure() -> ai_memory_mcp::admin::HttpExposureReport {
+ ai_memory_mcp::admin::HttpExposureReport::Unknown
+}
+
/// Server-shaped response. Mirrors `ai_memory_mcp::admin::StatusReport`.
+/// One line an operator can read without knowing the enum. The unauthenticated
+/// cases say what to do, because a status line that only names a state leaves
+/// the reader to go looking for the remedy.
+fn describe_exposure(exposure: ai_memory_mcp::admin::HttpExposureReport) -> &'static str {
+ use ai_memory_mcp::admin::HttpExposureReport as E;
+ match exposure {
+ E::Safe => "safe (loopback-only, or authenticated)",
+ E::UnauthenticatedByOverride => {
+ "UNAUTHENTICATED - started with --allow-insecure-no-auth; anyone who can reach the bind address can call destructive tools"
+ }
+ E::UnauthenticatedInContainer => {
+ "UNAUTHENTICATED - no AI_MEMORY_AUTH_TOKEN; reachability depends on the host publish spec. Run `ai-memory generate-auth-token` and set AI_MEMORY_AUTH_TOKEN"
+ }
+ E::Unknown => "unknown (server did not report one)",
+ }
+}
+
#[derive(Debug, Deserialize, Serialize)]
struct Report {
/// Server binary version.
@@ -34,6 +58,11 @@ struct Report {
data_dir: String,
/// Server bind address.
bind: String,
+ /// Whether that bind is reachable without a credential (#902).
+ /// `#[serde(default)]` so this CLI still renders the rest of the report
+ /// against a server old enough not to send the field.
+ #[serde(default = "unknown_exposure")]
+ http_exposure: ai_memory_mcp::admin::HttpExposureReport,
/// Server-side SQLite path.
db_path: String,
/// Lifetime counts.
@@ -215,6 +244,7 @@ pub async fn run(config: &Config, args: StatusArgs) -> Result<()> {
"version": report.version,
"data_dir": report.data_dir,
"bind": report.bind,
+ "http_exposure": report.http_exposure,
"db_path": report.db_path,
"counts": {
"pages_latest": report.counts.pages_latest,
@@ -237,6 +267,10 @@ pub async fn run(config: &Config, args: StatusArgs) -> Result<()> {
println!(" data-dir: {}", report.data_dir);
println!(" db: {}", report.db_path);
println!(" bind: {}", report.bind);
+ println!(
+ " exposure: {}",
+ describe_exposure(report.http_exposure)
+ );
println!(
" pages: {} (all versions: {})",
report.counts.pages_latest, report.counts.pages_all
@@ -647,4 +681,51 @@ mod tests {
assert_eq!(spool_age_line(Some(3_661_000)), "1h 1m");
assert_eq!(spool_age_line(Some(172_800_000)), "2d 0h");
}
+ /// A server predating #902 sends no `http_exposure`. The CLI must still
+ /// render the report, and must not read the absence as "safe" — that would
+ /// be the exact false reassurance this feature exists to prevent.
+ #[test]
+ fn an_older_server_without_the_field_reads_as_unknown_not_safe() {
+ use ai_memory_mcp::admin::HttpExposureReport as E;
+
+ let without: Report = serde_json::from_value(serde_json::json!({
+ "version": "2.3.0",
+ "data_dir": "/data",
+ "bind": "0.0.0.0:49374",
+ "db_path": "/data/ai-memory.db",
+ "counts": { "pages_latest": 0, "pages_all": 0, "sessions": 0, "observations": 0 },
+ }))
+ .expect("an older server's status must still deserialise");
+ assert_eq!(without.http_exposure, E::Unknown);
+ assert_ne!(without.http_exposure, E::Safe);
+
+ let with: Report = serde_json::from_value(serde_json::json!({
+ "version": "2.4.0",
+ "data_dir": "/data",
+ "bind": "0.0.0.0:49374",
+ "db_path": "/data/ai-memory.db",
+ "counts": { "pages_latest": 0, "pages_all": 0, "sessions": 0, "observations": 0 },
+ "http_exposure": "unauthenticated-in-container",
+ }))
+ .expect("a current server's status must deserialise");
+ assert_eq!(with.http_exposure, E::UnauthenticatedInContainer);
+ }
+
+ /// The unauthenticated lines have to carry the remedy: an operator reading
+ /// `ai-memory status` should not have to go looking for what to do.
+ #[test]
+ fn unauthenticated_states_are_described_with_their_remedy() {
+ use ai_memory_mcp::admin::HttpExposureReport as E;
+
+ assert!(describe_exposure(E::Safe).contains("safe"));
+ assert!(describe_exposure(E::Unknown).contains("unknown"));
+
+ let override_line = describe_exposure(E::UnauthenticatedByOverride);
+ assert!(override_line.contains("UNAUTHENTICATED"));
+ assert!(override_line.contains("--allow-insecure-no-auth"));
+
+ let container_line = describe_exposure(E::UnauthenticatedInContainer);
+ assert!(container_line.contains("UNAUTHENTICATED"));
+ assert!(container_line.contains("AI_MEMORY_AUTH_TOKEN"));
+ }
}
diff --git a/crates/ai-memory-mcp/src/admin.rs b/crates/ai-memory-mcp/src/admin.rs
index fa00baa1..60194333 100644
--- a/crates/ai-memory-mcp/src/admin.rs
+++ b/crates/ai-memory-mcp/src/admin.rs
@@ -97,6 +97,28 @@ struct SweepTuning {
compact_cold_episodic: bool,
}
+/// How the HTTP listener is exposed, as reported by `/admin/status`.
+///
+/// `serve` already refuses to start in the genuinely indefensible cases and
+/// prints a banner for the rest (#902). This carries the same verdict to a
+/// surface an operator can poll after deploy, which is the half that catches a
+/// `.env.production` where `AI_MEMORY_AUTH_TOKEN` was never filled in — nobody
+/// is watching the startup output of a container three weeks later.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub enum HttpExposureReport {
+ /// Loopback-only, or authenticated.
+ Safe,
+ /// Unauthenticated on a non-loopback address by explicit operator override.
+ UnauthenticatedByOverride,
+ /// Unauthenticated inside a container, where the bind address proves
+ /// nothing about reachability — the host publish spec decides.
+ UnauthenticatedInContainer,
+ /// The server never recorded a verdict. Reported rather than guessed: an
+ /// older server behind a newer CLI, or a transport that never binds HTTP.
+ Unknown,
+}
+
/// Shared state for the admin router.
#[derive(Clone)]
pub struct AdminState {
@@ -133,6 +155,11 @@ pub struct AdminState {
pub db_path: PathBuf,
/// Server's bind address — informational, surfaced in /admin/status.
pub bind: String,
+ /// HTTP exposure verdict, recorded by `serve` once the listener is bound.
+ /// A cell rather than a plain value because the verdict needs the *bound*
+ /// address, which is only known after `AdminState` is built. Unset reads as
+ /// [`HttpExposureReport::Unknown`].
+ pub http_exposure: Arc<std::sync::OnceLock<HttpExposureReport>>,
/// Server home directory resolved once at config load. Used to keep admin
/// audits consistent with the hook router's cwd-prefix guard.
pub home_dir: Option<String>,
@@ -1131,6 +1158,10 @@ pub struct StatusReport {
pub data_dir: String,
/// Bind address the HTTP transport is listening on.
pub bind: String,
+ /// Whether that bind is reachable without a credential (#902). Polled
+ /// after deploy, this catches the unauthenticated case that a startup-only
+ /// banner cannot.
+ pub http_exposure: HttpExposureReport,
/// Absolute SQLite path inside `data_dir`.
pub db_path: String,
/// Lifetime counts: pages_latest, pages_all, sessions, observations.
@@ -1202,6 +1233,11 @@ async fn handle_status(State(state): State<Arc<AdminState>>) -> impl IntoRespons
version: env!("CARGO_PKG_VERSION").to_string(),
data_dir: state.data_dir.display().to_string(),
bind: state.bind.clone(),
+ http_exposure: state
+ .http_exposure
+ .get()
+ .copied()
+ .unwrap_or(HttpExposureReport::Unknown),
db_path: state.db_path.display().to_string(),
counts,
derived,
@@ -7675,6 +7711,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -7742,6 +7779,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49376".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -7865,6 +7903,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49375".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -8099,6 +8138,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -8293,6 +8333,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -8473,6 +8514,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -8830,6 +8872,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -10318,6 +10361,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -10428,6 +10472,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -10531,6 +10576,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -10640,6 +10686,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -11188,6 +11235,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: Some(pepper),
@@ -11245,6 +11293,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: Some(pepper.clone()),
@@ -11681,6 +11730,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: Some(ai_memory_store::TokenPepper::new("test-pepper-admin")),
@@ -11813,6 +11863,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: Some(ai_memory_store::TokenPepper::new("test-pepper-admin")),
@@ -12244,6 +12295,7 @@ mod tests {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
diff --git a/crates/ai-memory-mcp/tests/suite/admin_audit_log.rs b/crates/ai-memory-mcp/tests/suite/admin_audit_log.rs
index 99ca92f6..af86ab7e 100644
--- a/crates/ai-memory-mcp/tests/suite/admin_audit_log.rs
+++ b/crates/ai-memory-mcp/tests/suite/admin_audit_log.rs
@@ -27,6 +27,7 @@ async fn make_admin_state(tmp: &TempDir) -> (AdminState, Store) {
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
diff --git a/crates/ai-memory-mcp/tests/suite/admin_backup.rs b/crates/ai-memory-mcp/tests/suite/admin_backup.rs
index bdb474e7..d1a7e5da 100644
--- a/crates/ai-memory-mcp/tests/suite/admin_backup.rs
+++ b/crates/ai-memory-mcp/tests/suite/admin_backup.rs
@@ -37,6 +37,7 @@ async fn make_state(tmp: &TempDir) -> (AdminState, Store) {
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
diff --git a/crates/ai-memory-mcp/tests/suite/admin_bootstrap.rs b/crates/ai-memory-mcp/tests/suite/admin_bootstrap.rs
index a7700657..eed010e4 100644
--- a/crates/ai-memory-mcp/tests/suite/admin_bootstrap.rs
+++ b/crates/ai-memory-mcp/tests/suite/admin_bootstrap.rs
@@ -34,6 +34,7 @@ async fn make_admin_state(tmp: &TempDir) -> AdminState {
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
diff --git a/crates/ai-memory-mcp/tests/suite/admin_move.rs b/crates/ai-memory-mcp/tests/suite/admin_move.rs
index 32cc65b0..141132aa 100644
--- a/crates/ai-memory-mcp/tests/suite/admin_move.rs
+++ b/crates/ai-memory-mcp/tests/suite/admin_move.rs
@@ -52,6 +52,7 @@ async fn make_state(tmp: &TempDir) -> (AdminState, Store) {
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -83,6 +84,7 @@ async fn make_state_with_chain(tmp: &TempDir, chain: AdmissionChain) -> (AdminSt
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -456,6 +458,7 @@ async fn move_project_carries_source_embedding() {
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -747,6 +750,7 @@ async fn true_move_notifies_admission_with_destination_names() {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -803,6 +807,7 @@ async fn make_state_with_embedder(tmp: &TempDir) -> (AdminState, Store) {
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -1032,6 +1037,7 @@ fn build_state(store: &Store, tmp: &TempDir) -> AdminState {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -1530,6 +1536,7 @@ async fn true_move_aborts_when_admission_rejects() {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -1627,6 +1634,7 @@ async fn copy_purge_purge_admission_runs_before_db_destruction() {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -1741,6 +1749,7 @@ async fn move_copy_skips_contributors_webhook_but_runs_others() {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
diff --git a/crates/ai-memory-mcp/tests/suite/admin_move_session.rs b/crates/ai-memory-mcp/tests/suite/admin_move_session.rs
index 6bb9994f..1dba81a8 100644
--- a/crates/ai-memory-mcp/tests/suite/admin_move_session.rs
+++ b/crates/ai-memory-mcp/tests/suite/admin_move_session.rs
@@ -44,6 +44,7 @@ async fn make_state(tmp: &TempDir) -> (AdminState, Store) {
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
diff --git a/crates/ai-memory-mcp/tests/suite/admin_phase3.rs b/crates/ai-memory-mcp/tests/suite/admin_phase3.rs
index 73c9f43c..61a85750 100644
--- a/crates/ai-memory-mcp/tests/suite/admin_phase3.rs
+++ b/crates/ai-memory-mcp/tests/suite/admin_phase3.rs
@@ -50,6 +50,7 @@ async fn make_state(tmp: &TempDir) -> (AdminState, Store) {
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
diff --git a/crates/ai-memory-mcp/tests/suite/admin_provider_error_logging.rs b/crates/ai-memory-mcp/tests/suite/admin_provider_error_logging.rs
index 12717403..4bd18841 100644
--- a/crates/ai-memory-mcp/tests/suite/admin_provider_error_logging.rs
+++ b/crates/ai-memory-mcp/tests/suite/admin_provider_error_logging.rs
@@ -105,6 +105,7 @@ async fn make_admin_state(tmp: &TempDir, llm: Option<Arc<dyn LlmProvider>>) -> A
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
diff --git a/crates/ai-memory-mcp/tests/suite/admin_purge.rs b/crates/ai-memory-mcp/tests/suite/admin_purge.rs
index 3ad4d5d3..1050e28f 100644
--- a/crates/ai-memory-mcp/tests/suite/admin_purge.rs
+++ b/crates/ai-memory-mcp/tests/suite/admin_purge.rs
@@ -52,6 +52,7 @@ async fn make_state_with_chain(
decay_params: DecayParams::default(),
data_dir: tmp.path().to_path_buf(),
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -662,6 +663,7 @@ async fn purge_project_rejecting_admission_leaves_source_intact() {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -765,6 +767,7 @@ async fn purge_project_idempotent_second_call_is_404() {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
diff --git a/crates/ai-memory-mcp/tests/suite/admin_read_page.rs b/crates/ai-memory-mcp/tests/suite/admin_read_page.rs
index 95d3c675..ae539f55 100644
--- a/crates/ai-memory-mcp/tests/suite/admin_read_page.rs
+++ b/crates/ai-memory-mcp/tests/suite/admin_read_page.rs
@@ -29,6 +29,7 @@ async fn make_state(tmp: &TempDir) -> (AdminState, Store) {
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
diff --git a/crates/ai-memory-mcp/tests/suite/admin_rename.rs b/crates/ai-memory-mcp/tests/suite/admin_rename.rs
index e14ee18e..9ea12be7 100644
--- a/crates/ai-memory-mcp/tests/suite/admin_rename.rs
+++ b/crates/ai-memory-mcp/tests/suite/admin_rename.rs
@@ -37,6 +37,7 @@ async fn make_state(tmp: &TempDir) -> (AdminState, Store) {
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -317,6 +318,7 @@ async fn rename_project_pages_still_searchable() {
data_dir: tmp.path().to_path_buf(),
db_path: store.db_path().to_path_buf(),
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
@@ -391,6 +393,7 @@ async fn rename_project_after_purge_returns_404_not_silent_200() {
data_dir: state.data_dir.clone(),
db_path: state.db_path.clone(),
bind: state.bind.clone(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: state.bootstrap_lock.clone(),
token_pepper: None,
diff --git a/crates/ai-memory-mcp/tests/suite/admin_status_search.rs b/crates/ai-memory-mcp/tests/suite/admin_status_search.rs
index 1e258882..a23a36b3 100644
--- a/crates/ai-memory-mcp/tests/suite/admin_status_search.rs
+++ b/crates/ai-memory-mcp/tests/suite/admin_status_search.rs
@@ -31,6 +31,7 @@ async fn make_admin_state(tmp: &TempDir) -> (AdminState, Store) {
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:49374".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,
diff --git a/crates/ai-memory-mcp/tests/suite/admin_write_page.rs b/crates/ai-memory-mcp/tests/suite/admin_write_page.rs
index ef5c58a9..044c4aae 100644
--- a/crates/ai-memory-mcp/tests/suite/admin_write_page.rs
+++ b/crates/ai-memory-mcp/tests/suite/admin_write_page.rs
@@ -31,6 +31,7 @@ async fn make_state(tmp: &TempDir) -> AdminState {
data_dir: tmp.path().to_path_buf(),
db_path,
bind: "127.0.0.1:0".to_string(),
+ http_exposure: std::sync::Arc::new(std::sync::OnceLock::new()),
home_dir: None,
bootstrap_lock: std::sync::Arc::new(tokio::sync::Mutex::new(())),
token_pepper: None,