Skip to content

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

Rust

fix(admin): mark an expired page in the read-page response

Vinícius DS Andrade9262da693837
diff --git a/crates/ai-memory-mcp/src/admin.rs b/crates/ai-memory-mcp/src/admin.rs
index 89436b27..e22e689c 100644
--- a/crates/ai-memory-mcp/src/admin.rs
+++ b/crates/ai-memory-mcp/src/admin.rs
@@ -1829,6 +1829,10 @@ struct ReadPageResponse {
frontmatter: serde_json::Value,
#[serde(skip_serializing_if = "Option::is_none")]
served_from: Option<&'static str>,
+ /// Set when the page's `expires_at` TTL has passed: an exact-path read
+ /// still serves the page, which search no longer lists.
+ #[serde(skip_serializing_if = "std::ops::Not::not")]
+ expired: bool,
}
async fn handle_read_page(
@@ -1889,6 +1893,18 @@ async fn handle_read_page(
);
};
+ // An expired page is still served (a read is not a search) but says so:
+ // search and the listings leave it out, so this flag is how the caller
+ // learns the page is only waiting for the forget sweep. Omitted while live.
+ let expired = match state
+ .reader
+ .page_expired_by_ids(ws, proj, page_path.as_str())
+ .await
+ {
+ Ok(expired) => expired.unwrap_or(false),
+ Err(e) => return internal_err(e.to_string()),
+ };
+
match state.wiki.read_page(ws, proj, &page_path) {
Ok(md) => {
let title = md
@@ -1904,6 +1920,7 @@ async fn handle_read_page(
body: md.body,
frontmatter: md.frontmatter,
served_from: None,
+ expired,
};
(
StatusCode::OK,
@@ -1933,6 +1950,7 @@ async fn handle_read_page(
body: stored.body,
frontmatter,
served_from: Some("db-fallback"),
+ expired,
};
(
StatusCode::OK,