The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(archivist): classify the Ollama errors the embedder actually emits
M3gA-Mind445b94722a6f
diff --git a/src/openhuman/memory/tree/health/user_error.rs b/src/openhuman/memory/tree/health/user_error.rsindex a81fb5de57..e332bd8db8 100644--- a/src/openhuman/memory/tree/health/user_error.rs+++ b/src/openhuman/memory/tree/health/user_error.rs@@ -129,22 +129,37 @@ pub(crate) fn notice_local_model_unavailable_once(origin: &str) {"[archivist] action=broadcast_user_error kind={LOCAL_MODEL_UNAVAILABLE_KIND} \source={MEMORY_USER_ERROR_SOURCE} origin={origin}");- crate::openhuman::web_chat::publish_web_channel_event(- local_model_unavailable_user_error(),- );+ crate::openhuman::web_chat::publish_web_channel_event(local_model_unavailable_user_error());});}-/// Text classifier for a local Ollama embedding failure, for errors that crossed+/// Text classifier for a local Ollama model failure, for errors that crossed/// the bus and only exist as strings.///-/// Matches the two error shapes emitted by `tinyinference::embeddings::ollama`:-/// - `"ollama embed request failed (is Ollama running at <base>?): …"` —-/// the transport bail when the daemon is not listening.-/// - `"Ollama embedding model `<id>` is not installed at <base>. …"` —-/// the rewritten 404 when the configured model was never pulled.+/// Every literal below is quoted from the upstream source rather than from the+/// error text as remembered — an earlier revision matched+/// `"Ollama embedding model … is not installed at …"`, which reads plausibly+/// and appears nowhere in `tinyinference`, so the model-not-pulled half of+/// openhuman#5867 was never classified.+///+/// Three shapes, covering both models the archivist needs (the embedder and+/// the summarisation model — #5867 names `bge-m3` *and* `gemma3:4b`):+///+/// 1. Daemon not listening —+/// `"ollama embed request failed (is Ollama running at {base}?): {error}"`+/// (`embeddings/ollama.rs:136`).+/// 2. Embedding model not pulled — Ollama answers 404 and the embeddings path+/// renders it through `ollama_http_error` as+/// `"ollama embed failed with status {status}: {body}"`+/// (`embeddings/ollama.rs:241`). Anchored on the status so the other six+/// `"ollama embed …"` shapes in that file (NaN, count/dimension mismatch,+/// empty vector, parse failure) keep their own non-notification path —+/// those are data faults, not an absent runtime.+/// 3. Chat model not pulled — `"Ollama model `{model}` is not installed at+/// {base_url}. …"` (`providers/openai/local.rs:376`). Note the wording:+/// `Ollama model`, with no `embedding`.///-/// Both strings are Ollama-specific, so a generic cloud-embedder transport+/// All three are Ollama-anchored, so a generic cloud-embedder transport/// failure ("error sending request for url …") does not match and keeps its/// own non-notification path. Mirrors `classify_embed_error_str` from/// `tinycortex` — the typed host-side classifier it maps to@@ -153,8 +168,14 @@ pub(crate) fn notice_local_model_unavailable_once(origin: &str) {/// typed error is no longer available.pub(crate) fn is_local_embedding_error(message: &str) -> bool {let msg = message.to_ascii_lowercase();+ // 1. The daemon is not listening.msg.contains("is ollama running at")- || (msg.contains("ollama embedding model") && msg.contains("is not installed at"))+ // 2. The embedding model was never pulled: Ollama answers 404.+ || msg.contains("ollama embed failed with status 404")+ // 3. The chat/summarisation model was never pulled. Matched on+ // "ollama" rather than the exact noun phrase so a future reword+ // between "Ollama model" and "Ollama embedding model" still lands.+ || (msg.contains("is not installed at") && msg.contains("ollama"))}/// host-side fallback for paths that only ever see text.diff --git a/src/openhuman/memory/tree/health/user_error_tests.rs b/src/openhuman/memory/tree/health/user_error_tests.rsindex bdcb1c1ab3..bd08a8658f 100644--- a/src/openhuman/memory/tree/health/user_error_tests.rs+++ b/src/openhuman/memory/tree/health/user_error_tests.rs@@ -99,10 +99,16 @@ fn wire_notice_is_latched_once_per_process() {notice_corrupt_store_once("test detector");}-/// The local-embedding classifier matches the two Ollama error shapes and-/// nothing else. A false positive here would tell the user to start Ollama-/// for a generic storage or bus failure that has nothing to do with the local-/// model runtime.+/// The classifier matches the three real Ollama error shapes and nothing else.+///+/// A false positive tells the user to start Ollama for a storage or bus fault+/// that has nothing to do with the local runtime; a false negative is how+/// openhuman#5867 stayed unfixed for the model-not-pulled case. **Every+/// positive literal here is copied from the upstream source**, not composed+/// from the shape of the message — the string this replaced+/// (`"Ollama embedding model … is not installed at …"`) reads plausibly and+/// exists nowhere in `tinyinference`, so the test passed while the product+/// never emitted it.#[test]fn local_embedding_error_classifier_matches_ollama_patterns_only() {// Transport bail: daemon is not listening.@@ -114,10 +120,19 @@ fn local_embedding_error_classifier_matches_ollama_patterns_only() {assert!(is_local_embedding_error("is Ollama running at http://127.0.0.1:11434"));- // Model-not-pulled shape.+ // Embedding model never pulled. `embeddings/ollama.rs` renders Ollama's+ // 404 through `ollama_http_error`, so this — not a prose "not installed"+ // sentence — is what the embedder actually produces for #5867's `bge-m3`.assert!(is_local_embedding_error(- "Ollama embedding model `nomic-embed-text` is not installed at \- http://localhost:11434. Run `ollama pull nomic-embed-text`."+ "ollama embed failed with status 404 Not Found: \+ {\"error\":\"model 'bge-m3' not found\"}"+ ));+ // Chat/summarisation model never pulled (#5867 also names `gemma3:4b`).+ // Quoted from `providers/openai/local.rs:376` — "Ollama model", not+ // "Ollama embedding model".+ assert!(is_local_embedding_error(+ "Ollama model `gemma3:4b` is not installed at http://localhost:11434. \+ Run `ollama pull gemma3:4b`, or call `list_models()` to see what is installed"));// Case-insensitive match.assert!(is_local_embedding_error("IS OLLAMA RUNNING AT localhost"));@@ -130,16 +145,57 @@ fn local_embedding_error_classifier_matches_ollama_patterns_only() {));assert!(!is_local_embedding_error("backend failed: 500 internal"));assert!(!is_local_embedding_error(""));++ // The embeddings path emits six other `ollama embed …` shapes that are+ // data faults, not an absent runtime. Telling the user to install Ollama+ // for a NaN or a dimension mismatch would be wrong, so the status-404+ // anchor must not widen to the whole prefix.+ assert!(!is_local_embedding_error(+ "ollama embed count mismatch: sent 1 text, got 0 embeddings"+ ));+ assert!(!is_local_embedding_error(+ "ollama embed dimension mismatch at index 0: expected 1024, got 768"+ ));+ assert!(!is_local_embedding_error(+ "Ollama could not encode input without NaN values"+ ));+ assert!(!is_local_embedding_error(+ "ollama embed failed with status 500 Internal Server Error"+ ));}/// Once-latch for the archivist embedding failure path (openhuman#5867):/// one failed embedding per segment must not become one banner per segment.+///+/// This subscribes to the web-channel bus and counts what actually arrives.+/// The previous version called the function twice and asserted nothing, so it+/// passed whether the notice fired twice, once, or never — which is every+/// outcome, including the banner storm the latch exists to prevent.+///+/// The receiver is taken *before* the first call because `broadcast` only+/// delivers what is sent after subscribing. This is the only test in the+/// binary that calls `notice_local_model_unavailable_once`, so the+/// function-local `Once` is untripped when it runs.#[test]fn local_model_unavailable_notice_is_latched_once_per_process() {- // Same contract as the corrupt-store latch: calling twice is safe and- // the second invocation returns immediately on the latch path.+ let mut events = crate::openhuman::web_chat::subscribe_web_channel_events();+notice_local_model_unavailable_once("test archivist");notice_local_model_unavailable_once("test archivist duplicate");++ let first = events+ .try_recv()+ .expect("the first call must publish exactly one user_error");+ assert_eq!(+ first.error_type.as_deref(),+ Some(LOCAL_MODEL_UNAVAILABLE_KIND),+ "the published event must be the local-model notice"+ );+ assert!(+ events.try_recv().is_err(),+ "the second call must publish nothing — one failed embedding per \+ segment would otherwise be one banner per segment"+ );}/// The local-model-unavailable payload carries the same no-leak contract as