Skip to content

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

refactor(rpc): thread dispatch context through controller handlers

Steven Enamakeleae09ecab179
diff --git a/crates/openhuman-embed/tests/seams_runtime.rs b/crates/openhuman-embed/tests/seams_runtime.rs
index 814a921af3..a417b789fa 100644
--- a/crates/openhuman-embed/tests/seams_runtime.rs
+++ b/crates/openhuman-embed/tests/seams_runtime.rs
@@ -19,7 +19,7 @@ use serde_json::{json, Map, Value};
const METHOD: &str = "openhuman.embed_seam_probe_ping";
const POLICY_MARKER: u32 = 4242;
-fn ping(_params: Map<String, Value>) -> ControllerFuture {
+fn ping(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async { Ok(json!({ "pong": true })) })
}
diff --git a/crates/openhuman-rpc/src/http_host/schemas.rs b/crates/openhuman-rpc/src/http_host/schemas.rs
index 2fba913b84..553b6a4ca6 100644
--- a/crates/openhuman-rpc/src/http_host/schemas.rs
+++ b/crates/openhuman-rpc/src/http_host/schemas.rs
@@ -159,7 +159,7 @@ pub fn schemas(function: &str) -> ControllerSchema {
}
}
-fn handle_start(params: Map<String, Value>) -> ControllerFuture {
+fn handle_start(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let params: StartHostedDirParams = parse(params)?;
crate::http_host::rpc::start(params)
@@ -168,7 +168,7 @@ fn handle_start(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_stop(params: Map<String, Value>) -> ControllerFuture {
+fn handle_stop(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let params: HostedDirLookupParams = parse(params)?;
crate::http_host::rpc::stop(params)
@@ -177,7 +177,7 @@ fn handle_stop(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_get(params: Map<String, Value>) -> ControllerFuture {
+fn handle_get(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let params: HostedDirLookupParams = parse(params)?;
crate::http_host::rpc::get(params)
@@ -186,7 +186,7 @@ fn handle_get(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_list(_params: Map<String, Value>) -> ControllerFuture {
+fn handle_list(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
crate::http_host::rpc::list()
.await?
diff --git a/crates/openhuman-rpc/src/server/http/rpc_handler_tests.rs b/crates/openhuman-rpc/src/server/http/rpc_handler_tests.rs
index 43f22315cf..ac2738d2c6 100644
--- a/crates/openhuman-rpc/src/server/http/rpc_handler_tests.rs
+++ b/crates/openhuman-rpc/src/server/http/rpc_handler_tests.rs
@@ -29,7 +29,7 @@ async fn structured_rpc_error_envelope_passes_through_generic_dispatch() {
method: "openhuman.threads_generate_title".to_string(),
params: json!({ "thread_id": "thread-ghost" }),
};
- let response = rpc_handler(State(default_state()), Json(stale_thread_request)).await;
+ let response = rpc_handler(State(default_state()), None, Json(stale_thread_request)).await;
let body = to_bytes(response.into_body(), usize::MAX)
.await
.expect("response body");
@@ -110,7 +110,7 @@ async fn thread_not_found_rpc_error_does_not_report_to_sentry() {
}
}),
};
- let response = rpc_handler(State(default_state()), Json(stale_thread_request)).await;
+ let response = rpc_handler(State(default_state()), None, Json(stale_thread_request)).await;
let body = to_bytes(response.into_body(), usize::MAX)
.await
.expect("response body");
@@ -127,7 +127,7 @@ async fn thread_not_found_rpc_error_does_not_report_to_sentry() {
method: "core.not_a_real_method".to_string(),
params: json!({}),
};
- let response = rpc_handler(State(default_state()), Json(unrelated_error_request)).await;
+ let response = rpc_handler(State(default_state()), None, Json(unrelated_error_request)).await;
let body = to_bytes(response.into_body(), usize::MAX)
.await
.expect("response body");
@@ -220,7 +220,7 @@ async fn unknown_method_severity_split_by_probe_allow_list() {
method: "rpc.discover".to_string(),
params: json!({}),
};
- let response = rpc_handler(State(default_state()), Json(probe_request)).await;
+ let response = rpc_handler(State(default_state()), None, Json(probe_request)).await;
let body = to_bytes(response.into_body(), usize::MAX)
.await
.expect("response body");
@@ -244,7 +244,7 @@ async fn unknown_method_severity_split_by_probe_allow_list() {
method: "totally.made.up.method".to_string(),
params: json!({}),
};
- let response = rpc_handler(State(default_state()), Json(unknown_request)).await;
+ let response = rpc_handler(State(default_state()), None, Json(unknown_request)).await;
let body = to_bytes(response.into_body(), usize::MAX)
.await
.expect("response body");
@@ -333,7 +333,7 @@ async fn invalid_memory_ingest_is_not_reported_to_sentry() {
method: "openhuman.memory_brain_ingest".to_string(),
params: json!({ "path": "/openhuman-test/missing-memory-ingest-file" }),
};
- let response = rpc_handler(State(default_state()), Json(request)).await;
+ let response = rpc_handler(State(default_state()), None, Json(request)).await;
let body = to_bytes(response.into_body(), usize::MAX)
.await
.expect("response body");