Skip to content

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

test(flows): remove host gate tests for arg resolvability

Steven Enamakel2f82c2e4c900
diff --git a/crates/openhuman-core/src/flows/host_gates/mod_tests.rs b/crates/openhuman-core/src/flows/host_gates/mod_tests.rs
index 452015a002..1664899cf9 100644
--- a/crates/openhuman-core/src/flows/host_gates/mod_tests.rs
+++ b/crates/openhuman-core/src/flows/host_gates/mod_tests.rs
@@ -276,205 +276,6 @@ fn connection_refs_fail_open_on_unavailable_connections_but_keep_mismatch() {
assert!(errors[0].contains("tiktok"), "{}", errors[0]);
}
-/// The mock-run argument preflight as `run_builder_gates` invokes it: the
-/// analysis is `tinyflows::preflight`'s, this pins the host's native slug prefix.
-async fn validate_required_arg_resolvability(graph: &WorkflowGraph) -> Vec<String> {
- tinyflows::preflight::unresolvable_tool_args(
- graph,
- &[crate::flows::tinyflows::caps::NATIVE_TOOL_PREFIX],
- )
- .await
-}
-
-// ── validate_required_arg_resolvability (issue B18) ─────────────────────────
-//
-// `validate_tool_contracts`'s `missing_required_args` only proves an arg is
-// PRESENT (absent/literal-null) — it says nothing about whether an arg wired
-// to a real-looking `=`-expression actually RESOLVES to a value at runtime,
-// nor about an arg the schema doesn't individually mark `required` even
-// though the provider enforces it as a business rule (the real B18 bug:
-// `GMAIL_SEND_EMAIL.subject`/`.body` are each optional in the schema, but
-// Gmail rejects a send where both are empty). These tests sandbox-run the
-// graph the same way `dry_run_workflow` does and prove ANY tool_call arg
-// that resolves `null` (because it's bound to a field that doesn't exist
-// upstream) is a hard reject, while a fully-resolved graph passes clean. No
-// live-catalog seeding needed — this check doesn't consult the Composio
-// schema at all, only the sandbox's own traced diagnostics.
-
-#[tokio::test]
-async fn validate_required_arg_resolvability_rejects_a_null_resolved_arg() {
- let g = graph(json!({
- "nodes": [
- { "id": "t", "kind": "trigger", "name": "Manual" },
- { "id": "prep", "kind": "code", "name": "Prep",
- "config": { "language": "javascript", "source": "return {};" } },
- { "id": "post", "kind": "tool_call", "name": "Post",
- "config": { "slug": "GMAIL_SEND_EMAIL",
- "args": { "recipient_email": "[email protected]", "subject": "=item.nonexistent_field" } } }
- ],
- "edges": [
- { "from_node": "t", "to_node": "prep" },
- { "from_node": "prep", "to_node": "post" }
- ]
- }));
- let errors = validate_required_arg_resolvability(&g).await;
- assert_eq!(errors.len(), 1, "{errors:?}");
- assert!(errors[0].contains("post"), "{}", errors[0]);
- assert!(errors[0].contains("`subject`"), "{}", errors[0]);
- assert!(errors[0].contains("GMAIL_SEND_EMAIL"), "{}", errors[0]);
-}
-
-#[tokio::test]
-async fn validate_required_arg_resolvability_accepts_a_fully_resolved_graph() {
- let g = graph(json!({
- "nodes": [
- { "id": "t", "kind": "trigger", "name": "Manual" },
- { "id": "post", "kind": "tool_call", "name": "Post",
- "config": { "slug": "GMAIL_SEND_EMAIL",
- "args": { "recipient_email": "[email protected]", "subject": "hello", "body": "hi there" } } }
- ],
- "edges": [ { "from_node": "t", "to_node": "post" } ]
- }));
- let errors = validate_required_arg_resolvability(&g).await;
- assert!(errors.is_empty(), "{errors:?}");
-}
-
-#[tokio::test]
-async fn validate_required_arg_resolvability_ignores_native_and_dynamic_slugs() {
- // `oh:` native tools and `=`-derived slugs have no external-provider
- // rejection mode this gate should be checking.
- let g = graph(json!({
- "nodes": [
- { "id": "t", "kind": "trigger", "name": "Manual" },
- { "id": "prep", "kind": "code", "name": "Prep",
- "config": { "language": "javascript", "source": "return {};" } },
- { "id": "native", "kind": "tool_call", "name": "Native",
- "config": { "slug": "oh:web_search",
- "args": { "query": "=item.nonexistent_field" } } },
- { "id": "dynamic", "kind": "tool_call", "name": "Dynamic",
- "config": { "slug": "=item.nonexistent_field",
- "args": { "x": "=item.nonexistent_field" } } }
- ],
- "edges": [
- { "from_node": "t", "to_node": "prep" },
- { "from_node": "prep", "to_node": "native" },
- { "from_node": "native", "to_node": "dynamic" }
- ]
- }));
- let errors = validate_required_arg_resolvability(&g).await;
- assert!(errors.is_empty(), "{errors:?}");
-}
-
-#[tokio::test]
-async fn mock_opaque_tool_call_upstream_ref_matches_native_and_composio_upstreams() {
- // Both a Composio curated action and a native `oh:` tool are opaque-echoed
- // by the mock sandbox, so a null bound to EITHER is unverifiable (Some).
- // An `agent` / `code` upstream's real output IS produced by the sandbox, and
- // a `=`-dynamic slug is unknowable, so a null bound to those is genuine (None).
- let g = graph(json!({
- "nodes": [
- { "id": "t", "kind": "trigger", "name": "Manual" },
- { "id": "code_up", "kind": "code", "name": "Code",
- "config": { "language": "javascript", "source": "return {};" } },
- { "id": "agent_up", "kind": "agent", "name": "Agent",
- "config": { "agent_ref": "planner", "prompt": "x" } },
- { "id": "native_up", "kind": "tool_call", "name": "Link",
- "config": { "slug": "oh:storage_get_link", "args": { "file_id": "f" } } },
- { "id": "composio_up", "kind": "tool_call", "name": "Profile",
- "config": { "slug": "GMAIL_GET_PROFILE", "args": {} } },
- { "id": "dyn_up", "kind": "tool_call", "name": "Dyn",
- "config": { "slug": "=item.slug", "args": {} } },
- { "id": "sink", "kind": "tool_call", "name": "Sink",
- "config": { "slug": "GMAIL_SEND_EMAIL", "args": {} } }
- ],
- "edges": []
- }));
- let up = |expr: &str| {
- tinyflows::preflight::mock_opaque_tool_call_upstream_ref(expr, &g, "sink")
- .map(str::to_string)
- };
- assert_eq!(
- up("=nodes.native_up.item.json.url").as_deref(),
- Some("native_up")
- );
- assert_eq!(
- up("=nodes.composio_up.item.json.data.emailAddress").as_deref(),
- Some("composio_up")
- );
- assert_eq!(up("=nodes.agent_up.item.json.field"), None);
- assert_eq!(up("=nodes.code_up.item.json.field"), None);
- assert_eq!(up("=nodes.dyn_up.item.json.x"), None);
-}
-
-#[tokio::test]
-async fn validate_required_arg_resolvability_downgrades_null_from_native_tool_call_upstream() {
- // #5148's chain: a Composio `send` binds its `attachment` to a native
- // `oh:storage_get_link` node's `url`. That `url` is null in the echo sandbox
- // (native tools are opaque-echoed), but the wiring is correct, so the gate
- // must NOT reject it. Before the native-upstream carve-out it did — the loop
- // that halted the live "fix with agent" self-repair.
- let g = graph(json!({
- "nodes": [
- { "id": "t", "kind": "trigger", "name": "Manual" },
- { "id": "prep", "kind": "code", "name": "Prep",
- "config": { "language": "javascript", "source": "return {};" } },
- { "id": "get_link", "kind": "tool_call", "name": "Link",
- "config": { "slug": "oh:storage_get_link", "args": { "file_id": "f_1" } } },
- { "id": "send", "kind": "tool_call", "name": "Send",
- "config": { "slug": "GMAIL_SEND_EMAIL",
- "args": { "recipient_email": "[email protected]", "subject": "hi", "body": "there",
- "attachment": "=nodes.get_link.item.json.url" } } }
- ],
- "edges": [
- { "from_node": "t", "to_node": "prep" },
- { "from_node": "prep", "to_node": "get_link" },
- { "from_node": "get_link", "to_node": "send" }
- ]
- }));
- let errors = validate_required_arg_resolvability(&g).await;
- assert!(
- errors.is_empty(),
- "a native-upstream attachment null must be downgraded, got: {errors:?}"
- );
-}
-
-#[tokio::test]
-async fn native_file_attachment_chain_passes_required_arg_resolvability() {
- // Drift check that was missing pre-merge: author #5148's OWN documented
- // `produce -> oh:storage_upload_file -> oh:storage_get_link -> send` chain
- // and assert the null-arg gate (the exact gate that rejected it in the live
- // "fix with agent" loop) now passes it. Targets `validate_required_arg_
- // resolvability` directly (deterministic, no live catalog) rather than
- // `run_builder_gates`, whose connection/contract gates need live Composio.
- let g = graph(json!({
- "nodes": [
- { "id": "t", "kind": "trigger", "name": "Manual" },
- { "id": "make_page", "kind": "code", "name": "Write",
- "config": { "language": "javascript", "source": "return {};" } },
- { "id": "upload", "kind": "tool_call", "name": "Upload",
- "config": { "slug": "oh:storage_upload_file", "args": { "path": "report.html" } } },
- { "id": "get_link", "kind": "tool_call", "name": "Link",
- "config": { "slug": "oh:storage_get_link",
- "args": { "file_id": "=nodes.upload.item.json.file_id", "expires_in_seconds": 900 } } },
- { "id": "send", "kind": "tool_call", "name": "Send",
- "config": { "slug": "GMAIL_SEND_EMAIL",
- "args": { "recipient_email": "[email protected]", "subject": "AI trends", "body": "attached",
- "attachment": "=nodes.get_link.item.json.url" } } }
- ],
- "edges": [
- { "from_node": "t", "to_node": "make_page" },
- { "from_node": "make_page", "to_node": "upload" },
- { "from_node": "upload", "to_node": "get_link" },
- { "from_node": "get_link", "to_node": "send" }
- ]
- }));
- let errors = validate_required_arg_resolvability(&g).await;
- assert!(
- errors.is_empty(),
- "the documented native attachment chain must pass the null-arg gate, got: {errors:?}"
- );
-}
-
#[test]
fn validate_upload_paths_rejects_an_absolute_path() {
// The live-observed bug: the model copies `/tmp/openhuman-flow/report.html`