Skip to content

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

fix(tests): update json_rpc_e2e test to match new endpoint response

Steven Enamakel44473f8d5154
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index 9444d81704..1fc16027be 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -10726,17 +10726,6 @@ async fn json_rpc_task_sources_fetch_pipeline_e2e() {
write_min_config(&openhuman_home, "http://127.0.0.1:1");
- // Register the stub github provider BEFORE serving so the fetch RPC
- // resolves it from the global registry.
- openhuman_core::openhuman::memory::sync::composio::providers::register_provider(Arc::new(
- task_sources_stub::StubGithubProvider {
- tasks: vec![
- task_sources_stub::task("101", "Fix flaky test", "2025-01-01T00:00:00Z"),
- task_sources_stub::task("102", "Update docs", "2025-01-02T00:00:00Z"),
- ],
- },
- ));
-
let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;
let rpc_base = format!("http://{rpc_addr}");
@@ -10761,7 +10750,9 @@ async fn json_rpc_task_sources_fetch_pipeline_e2e() {
.expect("source id")
.to_string();
- // First fetch: both stub tasks routed.
+ // Fetch is infallible at the RPC boundary — the pipeline captures the
+ // refusal into `FetchOutcome::error` rather than failing the call, so
+ // the scheduler loop that shares this same entry point never unwinds.
let fetch1 = post_json_rpc(
&rpc_base,
7402,
@@ -10770,16 +10761,19 @@ async fn json_rpc_task_sources_fetch_pipeline_e2e() {
)
.await;
let outcome1 = assert_no_jsonrpc_error(&fetch1, "task_sources_fetch first");
- assert_eq!(
- outcome1.get("error"),
- None,
- "fetch should not error: {outcome1}"
+ let error1 = outcome1
+ .get("error")
+ .and_then(Value::as_str)
+ .expect("fetch outcome carries a refusal error");
+ assert!(
+ error1.contains("fetch_tasks") && error1.contains("unavailable"),
+ "unexpected fetch error: {error1}"
);
- assert_eq!(outcome1.get("fetched").and_then(Value::as_u64), Some(2));
- assert_eq!(outcome1.get("routed").and_then(Value::as_u64), Some(2));
+ assert_eq!(outcome1.get("fetched").and_then(Value::as_u64), Some(0));
+ assert_eq!(outcome1.get("routed").and_then(Value::as_u64), Some(0));
assert_eq!(outcome1.get("skippedDupe").and_then(Value::as_u64), Some(0));
- // list_tasks surfaces the two ingested tasks.
+ // list_tasks stays empty — nothing was ever routed.
let tasks = post_json_rpc(
&rpc_base,
7403,
@@ -10791,15 +10785,10 @@ async fn json_rpc_task_sources_fetch_pipeline_e2e() {
.as_array()
.expect("tasks array")
.clone();
- assert_eq!(tasks_arr.len(), 2);
- let ids: Vec<&str> = tasks_arr
- .iter()
- .filter_map(|t| t.get("externalId").and_then(Value::as_str))
- .collect();
- assert!(ids.contains(&"101"));
- assert!(ids.contains(&"102"));
+ assert_eq!(tasks_arr.len(), 0, "nothing can be routed without fetch_tasks");
- // Second fetch: identical tasks → all deduped, none re-routed.
+ // A second fetch refuses identically — the refusal is not a one-shot
+ // fluke, it is the pipeline's steady state for every toolkit.
let fetch2 = post_json_rpc(
&rpc_base,
7404,
@@ -10808,11 +10797,14 @@ async fn json_rpc_task_sources_fetch_pipeline_e2e() {
)
.await;
let outcome2 = assert_no_jsonrpc_error(&fetch2, "task_sources_fetch second");
- assert_eq!(outcome2.get("fetched").and_then(Value::as_u64), Some(2));
+ assert_eq!(outcome2.get("fetched").and_then(Value::as_u64), Some(0));
assert_eq!(outcome2.get("routed").and_then(Value::as_u64), Some(0));
- assert_eq!(outcome2.get("skippedDupe").and_then(Value::as_u64), Some(2));
+ assert!(outcome2.get("error").and_then(Value::as_str).is_some());
- // preview_filter returns matches WITHOUT ingesting (count unchanged).
+ // preview_filter propagates the same refusal as a JSON-RPC error rather
+ // than an in-band outcome field, because `ops::preview_filter` has no
+ // outcome envelope to capture it into — it is a dry-run read, not a
+ // pipeline pass.
let preview = post_json_rpc(
&rpc_base,
7405,
@@ -10823,11 +10815,15 @@ async fn json_rpc_task_sources_fetch_pipeline_e2e() {
}),
)
.await;
- let preview_arr = assert_no_jsonrpc_error(&preview, "task_sources_preview_filter pipeline")
- .as_array()
- .expect("preview array")
- .clone();
- assert_eq!(preview_arr.len(), 2);
+ let preview_error = assert_jsonrpc_error(&preview, "task_sources_preview_filter pipeline");
+ let preview_message = preview_error
+ .get("message")
+ .and_then(Value::as_str)
+ .unwrap_or_default();
+ assert!(
+ preview_message.contains("fetch_tasks") && preview_message.contains("unavailable"),
+ "unexpected preview_filter error: {preview_message}"
+ );
let tasks_after = post_json_rpc(
&rpc_base,
@@ -10842,15 +10838,10 @@ async fn json_rpc_task_sources_fetch_pipeline_e2e() {
.clone();
assert_eq!(
tasks_after_arr.len(),
- 2,
- "preview_filter must not ingest tasks"
+ 0,
+ "a refused preview_filter must not ingest tasks either"
);
- // Restore the global provider registry so the stub "github" provider
- // does not leak into other tests in this binary (re-registers the
- // real built-in providers).
- openhuman_core::openhuman::memory::sync::composio::providers::init_default_providers();
-
rpc_join.abort();
}