Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(archivist): recover segments a failed recap left unsummarised

Shanu4aad97005662
diff --git a/.github/workflows/ci-full.yml b/.github/workflows/ci-full.yml
index 2a648f6926..772c5dc03f 100644
--- a/.github/workflows/ci-full.yml
+++ b/.github/workflows/ci-full.yml
@@ -132,8 +132,8 @@ jobs:
# and leave a stale digest that only fails after the download. Both values
# are the ubuntu-22.04-x86_64 row of `src/openhuman/modules/registry.rs`,
# which is the authoritative pin — copy them from there, never recompute.
- memory_version="1.15.3"
- memory_sha256="5f50715abdc1b48745282db4718027159a292b5336d4bbd258cc471bb037b78e"
+ memory_version="1.16.0"
+ memory_sha256="f3ba06867ec89b8374a405f8a8569f5cecf88490609354ae4a6c1faa6e55b425"
module_root="/opt/openhuman-test-modules/${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
memory_dir="$module_root/tinymemory"
juice_dir="$module_root/tinyjuice"
diff --git a/.github/workflows/ci-lite.yml b/.github/workflows/ci-lite.yml
index e15253c654..640ff34f7f 100644
--- a/.github/workflows/ci-lite.yml
+++ b/.github/workflows/ci-lite.yml
@@ -831,8 +831,8 @@ jobs:
# and leave a stale digest that only fails after the download. Both values
# are the ubuntu-22.04-x86_64 row of `src/openhuman/modules/registry.rs`,
# which is the authoritative pin — copy them from there, never recompute.
- memory_version="1.15.3"
- memory_sha256="5f50715abdc1b48745282db4718027159a292b5336d4bbd258cc471bb037b78e"
+ memory_version="1.16.0"
+ memory_sha256="f3ba06867ec89b8374a405f8a8569f5cecf88490609354ae4a6c1faa6e55b425"
module_root="/opt/openhuman-test-modules/${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
memory_dir="$module_root/tinymemory"
juice_dir="$module_root/tinyjuice"
diff --git a/.github/workflows/e2e-reusable.yml b/.github/workflows/e2e-reusable.yml
index 1b440b9513..70831b260f 100644
--- a/.github/workflows/e2e-reusable.yml
+++ b/.github/workflows/e2e-reusable.yml
@@ -168,8 +168,8 @@ jobs:
# and leave a stale digest that only fails after the download. Both values
# are the ubuntu-22.04-x86_64 row of `src/openhuman/modules/registry.rs`,
# which is the authoritative pin — copy them from there, never recompute.
- memory_version="1.15.3"
- memory_sha256="5f50715abdc1b48745282db4718027159a292b5336d4bbd258cc471bb037b78e"
+ memory_version="1.16.0"
+ memory_sha256="f3ba06867ec89b8374a405f8a8569f5cecf88490609354ae4a6c1faa6e55b425"
module_root="/opt/openhuman-test-modules/${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
memory_dir="$module_root/tinymemory"
memory_archive="$memory_dir/tinymemory-module-${memory_version}-ubuntu-22.04-x86_64.tar.gz"
@@ -374,8 +374,8 @@ jobs:
# and leave a stale digest that only fails after the download. Both values
# are the ubuntu-22.04-x86_64 row of `src/openhuman/modules/registry.rs`,
# which is the authoritative pin — copy them from there, never recompute.
- memory_version="1.15.3"
- memory_sha256="5f50715abdc1b48745282db4718027159a292b5336d4bbd258cc471bb037b78e"
+ memory_version="1.16.0"
+ memory_sha256="f3ba06867ec89b8374a405f8a8569f5cecf88490609354ae4a6c1faa6e55b425"
module_root="/opt/openhuman-test-modules/${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
memory_dir="$module_root/tinymemory"
memory_archive="$memory_dir/tinymemory-module-${memory_version}-ubuntu-22.04-x86_64.tar.gz"
diff --git a/src/openhuman/agent/harness/archivist/hook_impl.rs b/src/openhuman/agent/harness/archivist/hook_impl.rs
index 6b3e0a01ea..4c7e1bf23c 100644
--- a/src/openhuman/agent/harness/archivist/hook_impl.rs
+++ b/src/openhuman/agent/harness/archivist/hook_impl.rs
@@ -159,6 +159,18 @@ impl PostTurnHook for ArchivistHook {
if let Some(ref segment) = closed_segment {
let now = Self::now_timestamp();
self.on_segment_closed(segment, session_id, now).await;
+ // Recover segments an earlier failed recap left unsummarised
+ // (#6186). Driven from here rather than from a timer because a
+ // close that just happened is first-hand evidence that the
+ // summariser is answering *now* — a scheduler would have to guess,
+ // and would spend its budget against a provider that is still down.
+ //
+ // Deliberately not called from `flush_open_segment`, the other
+ // caller of `on_segment_closed`: that one is awaited unbounded at
+ // session wind-down, and opportunistic recovery must never be
+ // charged to how long the app takes to close. This path is a
+ // detached post-turn hook, so the time is invisible.
+ self.resummarise_pending(now).await;
}
tracing::debug!("[archivist] turn indexed successfully: session={session_id}");
diff --git a/src/openhuman/agent/harness/archivist/lifecycle_tests.rs b/src/openhuman/agent/harness/archivist/lifecycle_tests.rs
index 6604b56dbc..e9fc0e3477 100644
--- a/src/openhuman/agent/harness/archivist/lifecycle_tests.rs
+++ b/src/openhuman/agent/harness/archivist/lifecycle_tests.rs
@@ -10,6 +10,7 @@
//! model is built, resolved or called anywhere in these tests.
use super::*;
+use crate::openhuman::memory::api::provider::SegmentStatus;
use crate::openhuman::memory::guard::test_support::RecordingProvider;
const SESSION: &str = "lifecycle-6156";
@@ -48,6 +49,9 @@ fn segment() -> ConversationSegment {
summary: None,
embedding: None,
open: false,
+ // #6186: the lifecycle marker the contract now carries. `Closed`
+ // is what a segment whose recap failed is left as.
+ status: Some(SegmentStatus::Closed),
start_seq: None,
end_seq: None,
}
diff --git a/src/openhuman/agent/harness/archivist/mod.rs b/src/openhuman/agent/harness/archivist/mod.rs
index 4499cbd8a0..19b9c10924 100644
--- a/src/openhuman/agent/harness/archivist/mod.rs
+++ b/src/openhuman/agent/harness/archivist/mod.rs
@@ -22,6 +22,7 @@ pub(crate) mod helpers;
mod hook_impl;
mod lifecycle;
mod recap;
+mod resummarise;
// The md-backed per-turn capture store the hook dual-writes into. It lives
// here rather than behind the memory engine because nothing but this hook ever
// called it — see the module's own docs for the round trip and for why the
diff --git a/src/openhuman/agent/harness/archivist/recap_tests.rs b/src/openhuman/agent/harness/archivist/recap_tests.rs
index 50551d1e25..6f842dfba8 100644
--- a/src/openhuman/agent/harness/archivist/recap_tests.rs
+++ b/src/openhuman/agent/harness/archivist/recap_tests.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::openhuman::memory::api::provider::SegmentStatus;
fn segment() -> ConversationSegment {
ConversationSegment {
@@ -13,6 +14,9 @@ fn segment() -> ConversationSegment {
summary: None,
embedding: None,
open: false,
+ // #6186: the lifecycle marker the contract now carries. `Closed`
+ // is what a segment whose recap failed is left as.
+ status: Some(SegmentStatus::Closed),
start_seq: Some(10),
end_seq: Some(14),
}
diff --git a/src/openhuman/agent/harness/archivist/resummarise.rs b/src/openhuman/agent/harness/archivist/resummarise.rs
new file mode 100644
index 0000000000..e3755be913
--- /dev/null
+++ b/src/openhuman/agent/harness/archivist/resummarise.rs
@@ -0,0 +1,190 @@
+//! Recovering segments a failed recap left unsummarised (#6186).
+//!
+//! #6156 stopped the archivist persisting a heuristic bookend when the
+//! summariser fails, which leaves the segment `status='closed'` with a `NULL`
+//! summary. That is deliberately the `needs_resummary` marker — it is what
+//! `SegmentsPendingSummary` selects on — but a marker nothing reads is only a
+//! tidier way to lose the summary. This is the pass that reads it.
+//!
+//! **What triggers it.** Not a timer. The pass runs immediately after a recap
+//! that *succeeded*, because that success is the only first-hand evidence the
+//! app ever gets that the summariser is answering right now. A scheduler would
+//! have to guess, and would spend its budget hammering a provider that is still
+//! down; this cannot run at all while recaps are failing, which is exactly the
+//! behaviour a backoff would be approximating.
+//!
+//! **Why it is bounded twice.** `SegmentsPendingSummary` orders oldest-first,
+//! so a segment nothing can ever summarise sits at the head of the queue
+//! forever. Draining `limit` rows every time would re-attempt that same head
+//! on every segment close and never reach the rest — the head-of-queue trap.
+//! So there is a per-process attempt ledger as well as a batch cap: a segment
+//! that has already been tried [`MAX_ATTEMPTS_PER_SEGMENT`] times in this
+//! process is skipped, and the pass moves on to segments behind it.
+
+use std::collections::HashMap;
+use std::sync::Mutex;
+
+use super::lifecycle::recap_is_usable;
+use super::ArchivistHook;
+use crate::openhuman::memory::api::provider::episodic::EpisodicTurn;
+
+/// Segments re-summarised in one pass.
+///
+/// Small on purpose. The pass runs after *every* successful segment close, so
+/// the queue drains across many passes rather than in one long stall; a large
+/// batch would put a run of inference calls behind a single close, and
+/// `flush_open_segment` is awaited at session wind-down.
+const RESUMMARISE_BATCH: u32 = 3;
+
+/// How many times one segment may be attempted before this process gives up on
+/// it.
+///
+/// Bounds the head-of-queue trap described in the module docs. Deliberately
+/// per-process rather than persisted: a restart usually means new config or a
+/// new build, which is the one thing likely to change the answer, so a fresh
+/// process earns each segment one more look.
+const MAX_ATTEMPTS_PER_SEGMENT: u32 = 2;
+
+/// Attempts spent per segment id, for this process.
+static ATTEMPTS: Mutex<Option<HashMap<String, u32>>> = Mutex::new(None);
+
+/// Record an attempt against `segment_id` and report whether it should be
+/// skipped as already exhausted.
+fn exhausted(segment_id: &str) -> bool {
+ let mut guard = match ATTEMPTS.lock() {
+ Ok(guard) => guard,
+ // A poisoned ledger means some other pass panicked mid-update. The
+ // ledger is an optimisation, not a correctness invariant, so the honest
+ // response is to let this segment through rather than to stop
+ // recovering summaries for the rest of the process's life.
+ Err(poisoned) => poisoned.into_inner(),
+ };
+ let ledger = guard.get_or_insert_with(HashMap::new);
+ let seen = ledger.entry(segment_id.to_string()).or_insert(0);
+ if *seen >= MAX_ATTEMPTS_PER_SEGMENT {
+ return true;
+ }
+ *seen += 1;
+ false
+}
+
+impl ArchivistHook {
+ /// Re-summarise up to [`RESUMMARISE_BATCH`] segments whose recap failed
+ /// earlier.
+ ///
+ /// Uses the same [`ArchivistHook::summarize_entries`] the finalize path
+ /// uses — not a second summariser. That is the whole reason the pass lives
+ /// here rather than inside the engine: a differently-prompted summary
+ /// sitting beside the originals would be indistinguishable from them and
+ /// impossible to audit later.
+ ///
+ /// Writes only on a usable recap, by the same [`recap_is_usable`] rule as
+ /// finalize. A segment whose recap fails again is left exactly as it was,
+ /// still carrying the marker.
+ ///
+ /// Never returns `Err`: every failure is logged and the pass moves to the
+ /// next segment. It is opportunistic work, and a failure here must not
+ /// affect the close that triggered it.
+ pub(super) async fn resummarise_pending(&self, now: f64) {
+ let Some(episodic) = self.episodic() else {
+ return;
+ };
+
+ let pending = match episodic.segments_pending_summary(RESUMMARISE_BATCH).await {
+ Ok(pending) => pending,
+ Err(e) => {
+ tracing::debug!("[archivist] resummarise: cannot read the pending queue: {e}");
+ return;
+ }
+ };
+ if pending.is_empty() {
+ return;
+ }
+
+ tracing::debug!(
+ "[archivist] resummarise: {} segment(s) pending",
+ pending.len()
+ );
+
+ for segment in pending {
+ if exhausted(&segment.segment_id) {
+ tracing::debug!(
+ "[archivist] resummarise: segment={} already attempted {} times in this \
+ process — skipping so the queue behind it can drain",
+ segment.segment_id,
+ MAX_ATTEMPTS_PER_SEGMENT
+ );
+ continue;
+ }
+
+ // Read per segment rather than once for the batch: turns are
+ // addressed by session, and two pending segments are usually from
+ // different sessions.
+ //
+ // `read_session_entries` + `is_in_segment` is the same pair the
+ // finalize path uses, and reusing it is not incidental — a turn
+ // belongs to a segment by stable per-session sequence or row id,
+ // not by timestamp, because the md store rounds to milliseconds and
+ // can sort a fast turn just before its own segment's start.
+ let entries = self.read_session_entries(&segment.session_id).await;
+ let segment_entries: Vec<&EpisodicTurn> = entries
+ .iter()
+ .filter(|record| record.is_in_segment(&segment))
+ .map(|record| &record.turn)
+ .collect();
+ if segment_entries.is_empty() {
+ // Nothing to fold. Not an error and not worth a warning: the
+ // segment is a real row whose turns have since been pruned, and
+ // there is no recap that could be produced for it.
+ tracing::debug!(
+ "[archivist] resummarise: segment={} has no turns left — nothing to fold",
+ segment.segment_id
+ );
+ continue;
+ }
+
+ let (summary, from_llm) = self
+ .summarize_entries(&segment_entries, &segment.segment_id, segment.turn_count)
+ .await;
+ if !recap_is_usable(from_llm, &summary) {
+ tracing::debug!(
+ "[archivist] resummarise: segment={} still has no LLM recap — left \
+ unsummarised",
+ segment.segment_id
+ );
+ continue;
+ }
+
+ match episodic
+ .set_segment_summary(&segment.segment_id, &summary, now)
+ .await
+ {
+ Ok(()) => {
+ tracing::info!(
+ "[archivist] resummarise: recovered segment={} ({} turns, {} chars)",
+ segment.segment_id,
+ segment.turn_count,
+ summary.len()
+ );
+ // Embedded here for the same reason finalize embeds: the
+ // summary is only in the index if something puts it there,
+ // and a recovered segment that is durable but unindexed is
+ // a second, quieter version of the same gap.
+ self.embed_segment_recap(&segment.segment_id, &summary, now)
+ .await;
+ }
+ Err(e) => {
+ tracing::warn!(
+ "[archivist] resummarise: failed to persist the recovered recap for \
+ segment={}: {e}",
+ segment.segment_id
+ );
+ }
+ }
+ }
+ }
+}
+
+#[cfg(test)]
+#[path = "resummarise_tests.rs"]
+mod tests;
diff --git a/src/openhuman/agent/harness/archivist/resummarise_tests.rs b/src/openhuman/agent/harness/archivist/resummarise_tests.rs
new file mode 100644
index 0000000000..c3fe803086
--- /dev/null
+++ b/src/openhuman/agent/harness/archivist/resummarise_tests.rs
@@ -0,0 +1,216 @@
+//! Recovery-pass tests (#6186).
+//!
+//! Driven through the **contract** like the finalize-path tests beside them: a
+//! `RecordingProvider` serves every family and records what reached it, so
+//! "nothing was written" is asserted against the driver's call log rather than
+//! inferred from an empty store.
+//!
+//! `ArchivistHook::new` leaves `summariser_available == false`, so
+//! `summarize_entries` takes its heuristic arm deterministically — no chat
+//! model is built, resolved or called anywhere here. That makes the *write*
+//! assertions negative by construction, which is the right shape: the pass must
+//! be provably incapable of persisting a recap it did not get from a model,
+//! and that is the same rule finalize is held to.
+
+use std::sync::Arc;
+
+use super::*;
+use crate::openhuman::memory::api::provider::{ConversationSegment, MemoryProvider, SegmentStatus};
+use crate::openhuman::memory::guard::test_support::RecordingProvider;
+
+const SESSION: &str = "resummarise-6186";
+
+fn turn(id: i64, role: &str, content: &str) -> EpisodicTurn {
+ EpisodicTurn {
+ id: Some(id),
+ session_id: SESSION.into(),
+ timestamp: 100.0 + id as f64,
+ role: role.into(),
+ content: content.into(),
+ lesson: None,
+ tool_calls_json: None,
+ cost_microdollars: 0,
+ }
+}
+
+/// A pending segment. `segment_id` is a parameter because the attempt ledger
+/// that bounds the head-of-queue trap is **per process**, so two tests sharing
+/// an id would share its budget and run order would decide which one passed.
+fn pending(segment_id: &str) -> ConversationSegment {
+ ConversationSegment {
+ segment_id: segment_id.into(),
+ session_id: SESSION.into(),
+ namespace: "global".into(),
+ start_episodic_id: 1,
+ end_episodic_id: Some(2),
+ start_timestamp: 100.0,
+ end_timestamp: Some(103.0),
+ turn_count: 2,
+ summary: None,
+ embedding: None,
+ open: false,
+ status: Some(SegmentStatus::Closed),
+ start_seq: None,
+ end_seq: None,
+ }
+}
+
+fn turns() -> Vec<EpisodicTurn> {
+ vec![
+ turn(1, "user", "How do I pin a submodule?"),
+ turn(2, "assistant", "Record the gitlink at the commit you want."),
+ ]
+}
+
+fn methods(recording: &RecordingProvider) -> Vec<String> {
+ recording.calls().into_iter().map(|c| c.method).collect()
+}
+
+fn hook_over(recording: &Arc<RecordingProvider>) -> ArchivistHook {
+ let provider: Arc<dyn MemoryProvider> = recording.clone();
+ ArchivistHook::new(provider, true)
+}
+
+/// The pass reads the queue and the pending segment's turns — it does not stop
+/// at the query.
+///
+/// The positive half of the assertion is the point. Without it this would also
+/// pass if `resummarise_pending` had returned straight after
+/// `segments_pending_summary`, which is the failure mode a purely negative test
+/// cannot see.
+#[tokio::test]
+async fn a_pending_segment_is_read_and_recapped() {
+ let recording = Arc::new(
+ RecordingProvider::new()
+ .with_session_turns(turns())
+ .with_pending_segments(vec![pending("seg-read")]),
+ );
+ let hook = hook_over(&recording);
+
+ hook.resummarise_pending(300.0).await;
+
+ let methods = methods(&recording);
+ assert!(
+ methods
+ .iter()
+ .any(|m| m == "episodic.segments_pending_summary"),
+ "the pending queue was never read: {methods:?}"
+ );
+ assert!(
+ methods.iter().any(|m| m == "episodic.session_turns"),
+ "the segment's turns were never read: {methods:?}"
+ );
+}
+
+/// A recap that fails again writes nothing, and leaves the marker in place.
+///
+/// Same rule as finalize (#6156): the heuristic bookend is not a summary, and
+/// persisting it would flip the row to `summarised` and remove it from the very
+/// queue this pass selects on — turning a recoverable segment into a
+/// permanently degraded one. A recovery pass that did that would be worse than
+/// no recovery pass.
+#[tokio::test]
+async fn a_still_failing_recap_is_not_persisted_or_embedded() {
+ let recording = Arc::new(
+ RecordingProvider::new()
+ .with_session_turns(turns())
+ .with_pending_segments(vec![pending("seg-still-failing")]),
+ );
+ let hook = hook_over(&recording);
+
+ hook.resummarise_pending(300.0).await;
+
+ let methods = methods(&recording);
+ for forbidden in [
+ "episodic.set_segment_summary",
+ "episodic.upsert_segment_embedding",
+ "scoring.embed_text",
+ "scoring.embedder_slug",
+ ] {
+ assert!(
+ !methods.iter().any(|m| m == forbidden),
+ "`{forbidden}` ran on a heuristic recap: {methods:?}"
+ );
+ }
+}
+
+/// An empty queue costs one call and stops.
+///
+/// Pins the early return: the pass runs after every mid-session segment close,
+/// so the healthy steady state must not read turns or build a corpus for
+/// segments that do not exist.
+#[tokio::test]
+async fn an_empty_queue_reads_nothing_else() {
+ let recording = Arc::new(RecordingProvider::new().with_session_turns(turns()));
+ let hook = hook_over(&recording);
+
+ hook.resummarise_pending(300.0).await;
+
+ let methods = methods(&recording);
+ assert_eq!(
+ methods,
+ vec!["episodic.segments_pending_summary".to_string()],
+ "an empty queue did more than query: {methods:?}"
+ );
+}
+
+/// A segment that keeps failing is dropped from the pass, so the queue behind
+/// it can drain.
+///
+/// This is the head-of-queue trap, and it is not hypothetical: the driver
+/// orders oldest-first, and a segment nothing can ever summarise stays at the
+/// head. Without the ledger the pass would re-attempt that same segment after
+/// every close and never reach the ones behind it — the same shape as the
+/// head-500 loop in #6051.
+#[tokio::test]
+async fn a_repeatedly_failing_segment_stops_being_attempted() {
+ let recording = Arc::new(
+ RecordingProvider::new()
+ .with_session_turns(turns())
+ .with_pending_segments(vec![pending("seg-exhausts")]),
+ );
+ let hook = hook_over(&recording);
+
+ // Two attempts are the budget; the third pass must skip it.
+ hook.resummarise_pending(300.0).await;
+ hook.resummarise_pending(301.0).await;
+ let before = methods(&recording)
+ .iter()
+ .filter(|m| *m == "episodic.session_turns")
+ .count();
+
+ hook.resummarise_pending(302.0).await;
+
+ let after = methods(&recording)
+ .iter()
+ .filter(|m| *m == "episodic.session_turns")
+ .count();
+ assert_eq!(
+ before, 2,
+ "the first two passes should each have attempted the segment"
+ );
+ assert_eq!(
+ after, before,
+ "the third pass attempted an exhausted segment instead of skipping it"
+ );
+}
+
+/// A segment whose turns are gone is skipped without a write.
+///
+/// The row can outlive its turns, and the honest answer is to leave it alone:
+/// there is no recap that could be produced, and writing an empty summary would
+/// seal it as if there were.
+#[tokio::test]
+async fn a_segment_with_no_turns_left_is_skipped() {
+ let recording =
+ Arc::new(RecordingProvider::new().with_pending_segments(vec![pending("seg-no-turns")]));
+ let hook = hook_over(&recording);
+
+ hook.resummarise_pending(300.0).await;
+
+ let methods = methods(&recording);
+ assert!(
+ !methods.iter().any(|m| m == "episodic.set_segment_summary"),
+ "a segment with no turns was summarised anyway: {methods:?}"
+ );
+}
diff --git a/src/openhuman/memory/guard/families_part_03.rs b/src/openhuman/memory/guard/families_part_03.rs
index b3dee6411d..0c2bc19279 100644
--- a/src/openhuman/memory/guard/families_part_03.rs
+++ b/src/openhuman/memory/guard/families_part_03.rs
@@ -298,6 +298,23 @@ impl MemoryEpisodic for GuardedEpisodic {
.await
}
+ /// A read: it selects rows, it changes none. Admitted as one so a
+ /// read-only policy can still drive the re-summarisation pass (#6186) —
+ /// the write it leads to is `set_segment_summary`, which is admitted
+ /// separately on its own terms.
+ async fn segments_pending_summary(
+ &self,
+ limit: u32,
+ ) -> Result<Vec<ConversationSegment>, MemoryError> {
+ self.policy.admit_read(
+ Capability::Episodic,
+ "episodic.segments_pending_summary",
+ NO_NAMESPACE,
+ false,
+ )?;
+ self.family()?.segments_pending_summary(limit).await
+ }
+
async fn upsert_segment_embedding(
&self,
segment_id: &str,
diff --git a/src/openhuman/memory/guard/test_support_part_01.rs b/src/openhuman/memory/guard/test_support_part_01.rs
index 4b0f4fc355..26b567a8f2 100644
--- a/src/openhuman/memory/guard/test_support_part_01.rs
+++ b/src/openhuman/memory/guard/test_support_part_01.rs
@@ -21,8 +21,9 @@ use crate::openhuman::memory::api::provider::types::{
MaintenanceReport, SnapshotRef, SourceItem, SourceScope,
};
use crate::openhuman::memory::api::provider::{
- AddressBookSeedOutcome, ChunkDetail, ChunkEmbedding, ChunkQuery, CoverWindowQuery, EntityMatch,
- EpisodicEvent, EpisodicTurn, FacetType, FastRetrieveQuery, MemoryChunks, MemoryCodingSessions,
+ AddressBookSeedOutcome, ChunkDetail, ChunkEmbedding, ChunkQuery, ConversationSegment,
+ CoverWindowQuery, EntityMatch, EpisodicEvent, EpisodicTurn, FacetType, FastRetrieveQuery,
+ MemoryChunks, MemoryCodingSessions,
MemoryCore,
MemoryDiff, MemoryDocuments, MemoryEntities, MemoryEpisodic, MemoryGoals, MemoryGraph,
MemoryIngest, MemoryMaintenance, MemoryPeople, MemoryPortability, MemoryProfile,
@@ -90,6 +91,9 @@ pub struct RecordingProvider {
/// What `session_turns` returns, so the archivist's finalize path can be
/// driven past its empty-entries early return without an engine behind it.
session_turns: Mutex<Vec<EpisodicTurn>>,
+ /// What `segments_pending_summary` returns, so the re-summarisation pass
+ /// (#6186) can be driven over a known queue.
+ pending_segments: Mutex<Vec<ConversationSegment>>,
}
impl Default for RecordingProvider {
diff --git a/src/openhuman/memory/guard/test_support_part_02.rs b/src/openhuman/memory/guard/test_support_part_02.rs
index 08240b2506..8d67770a18 100644
--- a/src/openhuman/memory/guard/test_support_part_02.rs
+++ b/src/openhuman/memory/guard/test_support_part_02.rs
@@ -261,6 +261,17 @@ impl MemoryEpisodic for RecordingProvider {
Ok(None)
}
+ async fn segments_pending_summary(
+ &self,
+ _limit: u32,
+ ) -> Result<
+ Vec<crate::openhuman::memory::api::provider::episodic::ConversationSegment>,
+ MemoryError,
+ > {
+ self.record(Call::plain("episodic.segments_pending_summary"));
+ Ok(self.pending_segments.lock().unwrap().clone())
+ }
+
async fn create_segment(
&self,
_segment_id: &str,
diff --git a/src/openhuman/memory/guard/test_support_part_03.rs b/src/openhuman/memory/guard/test_support_part_03.rs
index 43a6d867ad..3c14e179c0 100644
--- a/src/openhuman/memory/guard/test_support_part_03.rs
+++ b/src/openhuman/memory/guard/test_support_part_03.rs
@@ -15,6 +15,7 @@ impl RecordingProvider {
namespace_hits: Mutex::new(Vec::new()),
namespace_summaries: Mutex::new(Vec::new()),
session_turns: Mutex::new(Vec::new()),
+ pending_segments: Mutex::new(Vec::new()),
}
}
@@ -53,6 +54,14 @@ impl RecordingProvider {
self
}
+ /// Seed the re-summarisation queue (#6186). The default is empty, so a
+ /// test that does not set this drives the pass over nothing — which is
+ /// the state a healthy store is in.
+ pub fn with_pending_segments(self, segments: Vec<ConversationSegment>) -> Self {
+ *self.pending_segments.lock().unwrap() = segments;
+ self
+ }
+
/// Append one call to the log. Every family impl funnels through this.
fn record(&self, call: Call) {
self.calls.lock().unwrap().push(call);
diff --git a/src/openhuman/modules/memory_part_01.rs b/src/openhuman/modules/memory_part_01.rs
index b923388a81..dce546c206 100644
--- a/src/openhuman/modules/memory_part_01.rs
+++ b/src/openhuman/modules/memory_part_01.rs
@@ -8,7 +8,7 @@ use tinymemory_api::capabilities::{Capabilities, Capability};
/// Checked against the registry pin by `the_capability_list_matches_the_pinned_release`,
/// so bumping the pin without re-reading the list is a red test rather than a
/// silent over-claim.
-pub(crate) const ARTIFACT_CAPABILITIES_PIN: &str = "1.15.3";
+pub(crate) const ARTIFACT_CAPABILITIES_PIN: &str = "1.16.0";
/// The capability families the **pinned artifact** actually serves.
///
@@ -362,6 +362,9 @@ const BOUNDED_READ_OPERATIONS: &[&str] = &[
"runtime_tree_status",
"score_person",
"search_entities",
+ // #6186. Selects closed segments with no summary; it writes nothing.
+ // The write it leads to is `set_segment_summary`, classified separately.
+ "segments_pending_summary",
"session_turns",
"snapshots",
"source_ingest_status",
diff --git a/src/openhuman/modules/memory_part_03.rs b/src/openhuman/modules/memory_part_03.rs
index 593c07cf9d..421ad4b6ee 100644
--- a/src/openhuman/modules/memory_part_03.rs
+++ b/src/openhuman/modules/memory_part_03.rs
@@ -265,6 +265,20 @@ impl MemoryEpisodic for ModuleMemoryProvider {
(segment_id, summary, now)
)
}
+ /// Forwarded rather than left to the trait default (#6186). The default
+ /// answers an empty list, which here would read as "no segment needs
+ /// re-summarising" — indistinguishable from a healthy store, and silent.
+ async fn segments_pending_summary(
+ &self,
+ limit: u32,
+ ) -> Result<Vec<ConversationSegment>, MemoryError> {
+ module_call!(
+ self,
+ "segments_pending_summary",
+ methods::SEGMENTS_PENDING_SUMMARY,
+ (limit,)
+ )
+ }
async fn upsert_segment_embedding(
&self,
segment_id: &str,
diff --git a/src/openhuman/modules/registry_part_01.rs b/src/openhuman/modules/registry_part_01.rs
index ee9eaebd6e..7f9c26b4e6 100644
--- a/src/openhuman/modules/registry_part_01.rs
+++ b/src/openhuman/modules/registry_part_01.rs
@@ -175,63 +175,63 @@ const TINYMEMORY: ModuleRecord = ModuleRecord {
description: "Local memory engine: store, ranked recall, and portable export",
bus_name: "ai.tinyhumans.tinymemory.Memory",
object_path: "/ai/tinyhumans/tinymemory/Memory",
- version: "1.15.3",
- release_url: "https://github.com/tinyhumansai/tinymemory/releases/tag/v1.15.3",
+ version: "1.16.0",
+ release_url: "https://github.com/tinyhumansai/tinymemory/releases/tag/v1.16.0",
assets: &[
PlatformAsset {
host_key: "ubuntu-24.04-x86_64",
- archive: "tinymemory-module-1.15.3-ubuntu-24.04-x86_64.tar.gz",
- sha256: "cdf1bc2f1deb32f7d52d5c0caa235ee28be458ce10a1dc69f2c0e611bed15b8d",
+ archive: "tinymemory-module-1.16.0-ubuntu-24.04-x86_64.tar.gz",
+ sha256: "fc65fce075b0d286b0d1cce48fc8952c2936e4b945f2af84b6a20d800c2a10d7",
},
PlatformAsset {
host_key: "ubuntu-24.04-arm64",
- archive: "tinymemory-module-1.15.3-ubuntu-24.04-arm64.tar.gz",
- sha256: "cb4e135a4be90953f277fba311e056d46d44d15db5fb027cbe83bee6247f0995",
+ archive: "tinymemory-module-1.16.0-ubuntu-24.04-arm64.tar.gz",
+ sha256: "1735efb7b0b6a56c85da1b62fbfa2d2a68995a04203ec2d79b4e1b389935fd92",
},
PlatformAsset {
host_key: "ubuntu-22.04-x86_64",
- archive: "tinymemory-module-1.15.3-ubuntu-22.04-x86_64.tar.gz",
- sha256: "5f50715abdc1b48745282db4718027159a292b5336d4bbd258cc471bb037b78e",
+ archive: "tinymemory-module-1.16.0-ubuntu-22.04-x86_64.tar.gz",
+ sha256: "f3ba06867ec89b8374a405f8a8569f5cecf88490609354ae4a6c1faa6e55b425",
},
PlatformAsset {
host_key: "ubuntu-22.04-arm64",
- archive: "tinymemory-module-1.15.3-ubuntu-22.04-arm64.tar.gz",
- sha256: "1992869bdea71ca7a96d5a7e0e32e8abc659a8bbb16d0cf34b2ba4440ca6892d",
+ archive: "tinymemory-module-1.16.0-ubuntu-22.04-arm64.tar.gz",
+ sha256: "b9f6794806e9463cffbfc3ce0c4b4b39cb8c1f3403a2ba956b0984cc35e9354a",
},
PlatformAsset {
host_key: "macos-26-arm64",
- archive: "tinymemory-module-1.15.3-macos-26-arm64.tar.gz",
- sha256: "63c64b35aa9364f2fbc7d83eb8dbab2895352441223f30a4e6226aa479c7563d",
+ archive: "tinymemory-module-1.16.0-macos-26-arm64.tar.gz",
+ sha256: "097ab5fdc352f84f34b770302db73c5c1468e7ad48709e1767e74d61cc55646c",
},
PlatformAsset {
host_key: "macos-26-x86_64",
- archive: "tinymemory-module-1.15.3-macos-26-x86_64.tar.gz",
- sha256: "61cc6b44627d11344957ff47a5047f2e25068d1d9fa158a08dbc37fbc78bc1ef",
+ archive: "tinymemory-module-1.16.0-macos-26-x86_64.tar.gz",
+ sha256: "3128eaff5e820c86fabfbe6a759976150313ca3c2c38e00bb2bb67dd2dfa76ba",
},
PlatformAsset {
host_key: "macos-15-arm64",
- archive: "tinymemory-module-1.15.3-macos-15-arm64.tar.gz",
- sha256: "4feed28d2bd4b8025ce975d3518014c85ff002bce4ca5ab7c9cfd923dc5f7686",
+ archive: "tinymemory-module-1.16.0-macos-15-arm64.tar.gz",
+ sha256: "fa9d65f31b7ece3eed0d118795ce06b66f0bd271556b91ccad09b0c4b41d94f9",
},
PlatformAsset {
host_key: "macos-15-x86_64",
- archive: "tinymemory-module-1.15.3-macos-15-x86_64.tar.gz",
- sha256: "bf567c16b0d26c8b00b6d5e4b44e37bfeec820dd5dcb7e941505859a87a3fa8c",
+ archive: "tinymemory-module-1.16.0-macos-15-x86_64.tar.gz",
+ sha256: "ac1343f128cdd4b299b43318019d1b26c0c8fc28abf62bf24ff8fb6d9894730f",
},
PlatformAsset {
host_key: "windows-2025-x86_64",
- archive: "tinymemory-module-1.15.3-windows-2025-x86_64.zip",
- sha256: "e741da2d02ee3b2bd99b7bbada298b92bfa3b233d903e05290a4a25cc3b68d62",
+ archive: "tinymemory-module-1.16.0-windows-2025-x86_64.zip",
+ sha256: "dcf5ec88583a02b284f0b430a037230a3d974703d39f11be53a4e36688c8d7db",
},
PlatformAsset {
host_key: "windows-2022-x86_64",
- archive: "tinymemory-module-1.15.3-windows-2022-x86_64.zip",
- sha256: "ad93120dcfeab2dcbf2d90bdadab220a2de46e087461e39d2203d483d868fb85",
+ archive: "tinymemory-module-1.16.0-windows-2022-x86_64.zip",
+ sha256: "cf56453fba522a075e569d60c39d7e56e938ff2d4fbb8270debaffd7e6b39819",
},
PlatformAsset {
host_key: "windows-11-arm64",
- archive: "tinymemory-module-1.15.3-windows-11-arm64.zip",
- sha256: "0242470cde6e802e93eedeb55ed8722da9483740fee8c0e5e60555a67d7b6da3",
+ archive: "tinymemory-module-1.16.0-windows-11-arm64.zip",
+ sha256: "9d0ca43cc3c7cac29e631e9870fc30d3fd4971e272e393ed2a91adb7ca20fdf3",
},
],
// Eager, unlike the two codecs above. A codec that is never asked for should
diff --git a/vendor/tinymemory b/vendor/tinymemory
index e8b6f36739..cc09032395 160000
--- a/vendor/tinymemory
+++ b/vendor/tinymemory
@@ -1 +1 @@
-Subproject commit e8b6f36739a55698582a130ca0cdf917701710a8
+Subproject commit cc0903239563b7448bbacc759867524507545c9d