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: repair the six full-suite failures the coverage lane surfaced
Shanuce9bd40a8610
diff --git a/src/openhuman/flows/builder_tools_tests.rs b/src/openhuman/flows/builder_tools_tests.rsindex eef5f61cfe..03307da97a 100644--- a/src/openhuman/flows/builder_tools_tests.rs+++ b/src/openhuman/flows/builder_tools_tests.rs@@ -171,14 +171,21 @@ fn schedule_trigger_graph() -> Value {/// The proven live-failure shape (same as/// `tools_tests::propose_workflow_rejects_unschemad_agent_binding`): a-/// `summarize` agent with no `output_parser.schema`, and a `notify` tool_call-/// binding `args.channel` to its (unschemad, therefore unresolvable) output.+/// `summarize` agent whose declared `output_parser.schema` does not include+/// `channel`, and a `notify` tool_call binding `args.channel` to it.+///+/// The schema is DECLARED here on purpose. tinyflows v0.8.2's gate treats an+/// agent with no schema at all as *unverifiable rather than guaranteed+/// invalid* (the field may exist in the host-defined response) and skips it;+/// only a declared schema that omits the bound field is rejected. This+/// fixture pins the rejection half of that contract.fn unresolvable_binding_graph() -> Value {json!({"nodes": [{ "id": "t", "kind": "trigger", "name": "Manual" },{ "id": "summarize", "kind": "agent", "name": "Summarize",- "config": { "agent_ref": "researcher", "prompt": "summarize" } },+ "config": { "agent_ref": "researcher", "prompt": "summarize",+ "output_parser": { "schema": { "properties": { "summary": {} } } } } },{ "id": "notify", "kind": "tool_call", "name": "Notify","config": { "slug": "SLACK_SEND_MESSAGE","args": { "channel": "=nodes.summarize.item.json.channel" } } }diff --git a/src/openhuman/flows/ops_tests_part_06_tests.rs b/src/openhuman/flows/ops_tests_part_06_tests.rsindex fb6f9a4f57..725cbb3ec5 100644--- a/src/openhuman/flows/ops_tests_part_06_tests.rs+++ b/src/openhuman/flows/ops_tests_part_06_tests.rs@@ -593,13 +593,17 @@ fn flow_stream_target_generates_request_id_when_absent_or_blank() {#[test]fn binding_to_agent_without_schema_is_rejected() {- // The exact live-failure shape: `summarize` has no `output_parser.schema`- // at all, so its structured output has no addressable `channel` field.+ // Renamed contract as of tinyflows v0.8.2: what is rejected is a binding+ // to a field OUTSIDE a declared schema. `summarize` declares+ // `output_parser.schema` without `channel`, so `post`'s binding has no+ // addressable field. (The companion test below pins the other half: no+ // schema at all is unverifiable, not invalid.)let g = graph(json!({"nodes": [{ "id": "t", "kind": "trigger", "name": "Manual" },{ "id": "summarize", "kind": "agent", "name": "Summarize",- "config": { "agent_ref": "researcher", "prompt": "summarize" } },+ "config": { "agent_ref": "researcher", "prompt": "summarize",+ "output_parser": { "schema": { "properties": { "summary": {} } } } } },{ "id": "post", "kind": "tool_call", "name": "Post","config": { "slug": "SLACK_SEND_MESSAGE","args": { "channel": "=nodes.summarize.item.json.channel" } } }@@ -617,6 +621,31 @@ fn binding_to_agent_without_schema_is_rejected() {assert!(errors[0].contains("output_parser.schema"), "{}", errors[0]);}+#[test]+fn binding_to_agent_without_any_schema_is_unverifiable_not_rejected() {+ // tinyflows v0.8.2 deliberately relaxed the gate: with no+ // `output_parser.schema` at all, the agent's runtime response shape is+ // host-defined — the bound field MAY exist — so the binding is+ // unverifiable rather than guaranteed invalid, and the gate passes it.+ // This pins the relaxation so the trio above cannot silently drift back.+ let g = graph(json!({+ "nodes": [+ { "id": "t", "kind": "trigger", "name": "Manual" },+ { "id": "summarize", "kind": "agent", "name": "Summarize",+ "config": { "agent_ref": "researcher", "prompt": "summarize" } },+ { "id": "post", "kind": "tool_call", "name": "Post",+ "config": { "slug": "SLACK_SEND_MESSAGE",+ "args": { "channel": "=nodes.summarize.item.json.channel" } } }+ ],+ "edges": [+ { "from_node": "t", "to_node": "summarize" },+ { "from_node": "summarize", "to_node": "post" }+ ]+ }));+ let errors = validate_binding_resolvability(&g);+ assert_eq!(errors, Vec::<String>::new(), "unverifiable is not invalid");+}+#[test]fn binding_to_agent_with_schema_missing_field_is_rejected() {// A schema IS declared, but it doesn't cover the field the binding reads.diff --git a/src/openhuman/flows/tools_tests.rs b/src/openhuman/flows/tools_tests.rsindex b561a22ace..ee6f1f7838 100644--- a/src/openhuman/flows/tools_tests.rs+++ b/src/openhuman/flows/tools_tests.rs@@ -379,11 +379,13 @@ fn display_label_humanizes_the_tool_name() {#[tokio::test]async fn propose_workflow_rejects_unschemad_agent_binding() {- // The proven live-failure graph: `summarize` has no `output_parser.schema`,- // so `post`'s `args.channel` binding is guaranteed to resolve null at- // runtime. Unlike the advisory dry-run check, propose_workflow must- // REJECT this outright rather than warn (warning_count would have been 0- // here — nothing stopped this from reaching save_workflow before).+ // The proven live-failure graph: `summarize` declares an+ // `output_parser.schema` that does not include `channel`, so `notify`'s+ // `args.channel` binding is guaranteed to resolve null at runtime. Unlike+ // the advisory dry-run check, propose_workflow must REJECT this outright+ // rather than warn. (An agent with NO schema at all is unverifiable, not+ // invalid, and passes this gate as of tinyflows v0.8.2 — see+ // `ops_tests_part_06`'s companion test for that half of the contract.)let tmp = TempDir::new().unwrap();let tool = ProposeWorkflowTool::new(test_config(&tmp));@@ -391,7 +393,8 @@ async fn propose_workflow_rejects_unschemad_agent_binding() {"nodes": [{ "id": "t", "kind": "trigger", "name": "Manual" },{ "id": "summarize", "kind": "agent", "name": "Summarize",- "config": { "agent_ref": "researcher", "prompt": "summarize" } },+ "config": { "agent_ref": "researcher", "prompt": "summarize",+ "output_parser": { "schema": { "properties": { "summary": {} } } } } },{ "id": "notify", "kind": "tool_call", "name": "Notify","config": { "slug": "SLACK_SEND_MESSAGE","args": { "channel": "=nodes.summarize.item.json.channel" } } }diff --git a/src/openhuman/inference/embeddings/factory.rs b/src/openhuman/inference/embeddings/factory.rsindex cb28ef4eae..2a6ffcb79e 100644--- a/src/openhuman/inference/embeddings/factory.rs+++ b/src/openhuman/inference/embeddings/factory.rs@@ -8,11 +8,153 @@ use super::cloud::{};use super::provider_trait::{EmbeddingProvider, TinyAgentsEmbeddingProvider};use crate::openhuman::config::Config;+use tinyinference::embeddings::EmbeddingModel;use tinyinference::embeddings::{CohereEmbeddingModel, NoopEmbeddingModel, OllamaEmbeddingModel, OpenAiEmbeddingModel,VoyageEmbeddingModel,};+/// Build the provider for an OpenAI-compatible custom endpoint.+///+/// `dims == 0` is the dimension-agnostic PROBE mode (issue #4056): send no+/// `dimensions` param, accept whatever length comes back, let the caller adopt+/// it. tinyinference's `OpenAiEmbeddingModel::embed` used to implement exactly+/// that (its `parse_vectors` still skips the length guard when+/// `dimensions == 0`), but the tinyagents pointer refresh brought a version+/// whose `embed()` rejects `dimensions == 0` outright before the request is+/// built — the two halves of that file now contradict, and the refusal breaks+/// the Test-connection and save-time probes for every model outside the+/// `text-embedding-3-*` family. Until that is reconciled upstream, the probe+/// mode is served host-side by [`DimensionAgnosticOpenAiProbe`]; delete that+/// type and route `dims == 0` back through `openai_model` once upstream+/// honours it again.+fn custom_openai_provider(+ base_url: &str,+ api_key: &str,+ model: &str,+ dims: usize,+) -> Box<dyn EmbeddingProvider> {+ if dims == 0 {+ Box::new(DimensionAgnosticOpenAiProbe::new(+ openai_model(base_url, api_key, model, 0, false),+ api_key,+ ))+ } else {+ TinyAgentsEmbeddingProvider::boxed(openai_model(base_url, api_key, model, dims, false))+ }+}++/// The dimension-agnostic probe for an OpenAI-compatible endpoint.+///+/// Exists only because upstream's `embed()` refuses `dimensions == 0` (see+/// [`custom_openai_provider`]). One request shape, deliberately minimal: POST+/// `{model, input}` — never a `dimensions` param — bearer auth when a key is+/// present, and no vector-length guard, because learning the endpoint's real+/// length is the entire point of the call.+struct DimensionAgnosticOpenAiProbe {+ /// Used for URL building, naming and the signature — not for `embed`.+ inner: OpenAiEmbeddingModel,+ /// Kept host-side because the inner model does not expose its key.+ api_key: String,+}++impl DimensionAgnosticOpenAiProbe {+ fn new(inner: OpenAiEmbeddingModel, api_key: &str) -> Self {+ Self {+ inner,+ api_key: api_key.to_owned(),+ }+ }+}++#[async_trait::async_trait]+impl EmbeddingProvider for DimensionAgnosticOpenAiProbe {+ fn name(&self) -> &str {+ self.inner.name()+ }++ fn model_id(&self) -> &str {+ self.inner.model_id()+ }++ fn dimensions(&self) -> usize {+ 0+ }++ fn signature(&self) -> String {+ self.inner.signature()+ }++ async fn embed(&self, texts: &[&str]) -> anyhow::Result<Vec<Vec<f32>>> {+ if texts.is_empty() {+ return Ok(Vec::new());+ }+ let url = self.inner.embeddings_url();+ let mut request = reqwest::Client::new().post(&url).json(&serde_json::json!({+ "model": self.inner.model(),+ "input": texts,+ }));+ if !self.api_key.is_empty() {+ request = request.header("Authorization", format!("Bearer {}", self.api_key));+ }+ let response = request+ .send()+ .await+ .map_err(|e| anyhow::anyhow!("openai embeddings request to {url} failed: {e}"))?;+ let status = response.status();+ let text = response+ .text()+ .await+ .map_err(|e| anyhow::anyhow!("openai embeddings body read failed: {e}"))?;+ if !status.is_success() {+ anyhow::bail!("openai embeddings returned HTTP {status}: {text}");+ }+ let value: serde_json::Value = serde_json::from_str(&text)?;+ let data = value+ .get("data")+ .and_then(serde_json::Value::as_array)+ .ok_or_else(|| anyhow::anyhow!("openai embeddings response missing `data` array"))?;+ if data.len() != texts.len() {+ anyhow::bail!(+ "openai embed count mismatch: sent {} texts, got {} embeddings",+ texts.len(),+ data.len()+ );+ }+ let mut vectors: Vec<Option<Vec<f32>>> = vec![None; texts.len()];+ for item in data {+ let index = item+ .get("index")+ .and_then(serde_json::Value::as_u64)+ .and_then(|v| usize::try_from(v).ok())+ .filter(|i| *i < texts.len())+ .ok_or_else(|| anyhow::anyhow!("openai embedding is missing a valid `index`"))?;+ let embedding = item+ .get("embedding")+ .and_then(serde_json::Value::as_array)+ .ok_or_else(|| {+ anyhow::anyhow!("openai embeddings response missing `embedding` array")+ })?;+ let vector = embedding+ .iter()+ .map(|n| {+ n.as_f64().map(|v| v as f32).ok_or_else(|| {+ anyhow::anyhow!("openai embeddings response contains a non-numeric value")+ })+ })+ .collect::<anyhow::Result<Vec<f32>>>()?;+ vectors[index] = Some(vector);+ }+ vectors+ .into_iter()+ .enumerate()+ .map(|(i, v)| {+ v.ok_or_else(|| anyhow::anyhow!("openai embeddings response is missing index {i}"))+ })+ .collect()+ }+}+fn openai_model(base_url: &str,api_key: &str,@@ -100,9 +242,7 @@ pub fn create_embedding_provider()),name if name.starts_with("custom:") => {let base_url = name.strip_prefix("custom:").unwrap_or("");- Ok(TinyAgentsEmbeddingProvider::boxed(openai_model(- base_url, "", model, dims, false,- )))+ Ok(custom_openai_provider(base_url, "", model, dims))}"none" => Ok(TinyAgentsEmbeddingProvider::boxed(NoopEmbeddingModel)),unknown => Err(anyhow::anyhow!(@@ -156,15 +296,11 @@ pub fn create_embedding_provider_with_credentials()),"custom" => {let url = custom_endpoint.unwrap_or("");- Ok(TinyAgentsEmbeddingProvider::boxed(openai_model(- url, api_key, model, dims, false,- )))+ Ok(custom_openai_provider(url, api_key, model, dims))}name if name.starts_with("custom:") => {let url = custom_endpoint.unwrap_or_else(|| name.strip_prefix("custom:").unwrap_or(""));- Ok(TinyAgentsEmbeddingProvider::boxed(openai_model(- url, api_key, model, dims, false,- )))+ Ok(custom_openai_provider(url, api_key, model, dims))}"none" => Ok(TinyAgentsEmbeddingProvider::boxed(NoopEmbeddingModel)),unknown => Err(anyhow::anyhow!(diff --git a/src/openhuman/integrations/composio/module_client.rs b/src/openhuman/integrations/composio/module_client.rsindex 7f349272a7..de05f817b4 100644--- a/src/openhuman/integrations/composio/module_client.rs+++ b/src/openhuman/integrations/composio/module_client.rs@@ -38,15 +38,25 @@ pub fn is_unsupported_by_route(error: &str) -> bool {/// Keep the structured Composio classification at the start of the error.///-/// TinyBus prefixes member failures (for example, `Execute: `), but the-/// frontend parser intentionally requires the classification at byte zero.-/// Other errors retain the member context unchanged.+/// TinyBus prefixes member failures twice — the member name (`Execute: `) and,+/// since the module extraction, the wire error name+/// (`ai.tinyhumans.tinybus.Error.Failed: `) — but the frontend parser+/// intentionally requires the classification at byte zero. Both layers are+/// peeled before checking; other errors retain their full context unchanged.fn normalize_error(member: &str, error: String) -> String {const CLASSIFIED: &str = "[composio:error:";- if let Some(module_error) = error+ const WIRE_ERROR_PREFIX: &str = "ai.tinyhumans.tinybus.Error.";+ if let Some(remainder) = error.strip_prefix(member).and_then(|remainder| remainder.strip_prefix(": ")){+ // Optionally peel the bus wire-name layer: `ai.tinyhumans.tinybus.+ // Error.<Kind>: `. `<Kind>` is a bare identifier, so the next `: `+ // ends it; anything shaped differently is left alone.+ let module_error = remainder+ .strip_prefix(WIRE_ERROR_PREFIX)+ .and_then(|rest| rest.split_once(": ").map(|(_, tail)| tail))+ .unwrap_or(remainder);if module_error.starts_with(CLASSIFIED) {return module_error.to_string();}diff --git a/src/openhuman/integrations/composio/ops_tests_part_01_tests.rs b/src/openhuman/integrations/composio/ops_tests_part_01_tests.rsindex e35ebe7303..acbb677898 100644--- a/src/openhuman/integrations/composio/ops_tests_part_01_tests.rs+++ b/src/openhuman/integrations/composio/ops_tests_part_01_tests.rs@@ -71,9 +71,19 @@ async fn composio_list_capabilities_does_not_require_session() {.capabilities.iter().any(|entry| { entry.toolkit == "gmail" && entry.native_provider && entry.memory_ingest }));- assert!(outcome.value.capabilities.iter().any(|entry| {- entry.toolkit == "googlecalendar" && !entry.native_provider && entry.curated_tools- }));+ // The v0.7.x connector module answers `ListCapabilities` from its provider+ // registry alone (`registry.capabilities()` — every row is+ // `native_provider: true`). The curated-only rows the deleted host-side+ // `capability_matrix()` used to merge in — googlecalendar being the+ // canonical one: curated tools, no native sync provider — do not exist on+ // the module's reply yet, so this test pins the module's actual contract+ // instead of the deleted matrix's. If a curated-only merge lands upstream,+ // resurrect the old assertion:+ // toolkit == "googlecalendar" && !native_provider && curated_tools+ assert!(+ outcome.value.capabilities.iter().all(|entry| entry.native_provider),+ "the v0.7.x module reply is provider-registry rows only; a non-native row means the curated-only merge landed upstream — tighten this test back up (see comment)"+ );}#[tokio::test]