Skip to content

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

fix(mcp): log underlying errors when argument validation is unavailable

Steven Enamakel8b5f482b498f
diff --git a/crates/openhuman-core/src/mcp/server/tools/params.rs b/crates/openhuman-core/src/mcp/server/tools/params.rs
index 81aba27fcb..485f0e0b4c 100644
--- a/crates/openhuman-core/src/mcp/server/tools/params.rs
+++ b/crates/openhuman-core/src/mcp/server/tools/params.rs
@@ -220,9 +220,15 @@ async fn validate_tool_arguments(
let config = crate::config::ops::load_current_or_init(ctx)
.await
- .map_err(|_| ToolCallError::Internal("MCP argument validation is unavailable".into()))?;
+ .map_err(|error| {
+ eprintln!("DBG mcp validate: {error:?}");
+ ToolCallError::Internal("MCP argument validation is unavailable".into())
+ })?;
let client = crate::mcp::module_client::McpConfiguredClient::for_config(&config)
- .map_err(|_| ToolCallError::Internal("MCP argument validation is unavailable".into()))?;
+ .map_err(|error| {
+ eprintln!("DBG mcp validate: {error:?}");
+ ToolCallError::Internal("MCP argument validation is unavailable".into())
+ })?;
let result = client
.validate_server_arguments(ValidateServerArgumentsRequest {
arguments,
@@ -230,7 +236,10 @@ async fn validate_tool_arguments(
rules,
})
.await
- .map_err(|_| ToolCallError::Internal("MCP argument validation is unavailable".into()))?;
+ .map_err(|error| {
+ eprintln!("DBG mcp validate: {error:?}");
+ ToolCallError::Internal("MCP argument validation is unavailable".into())
+ })?;
match result {
ServerArgumentsValidation::Valid(arguments) => Ok(arguments),
ServerArgumentsValidation::Invalid(error) => Err(error),
diff --git a/crates/openhuman-core/src/modules/storage_host_cdylib_stream_tests.rs b/crates/openhuman-core/src/modules/storage_host_cdylib_stream_tests.rs
index 454645e05d..caede353ee 100644
--- a/crates/openhuman-core/src/modules/storage_host_cdylib_stream_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_host_cdylib_stream_tests.rs
@@ -32,32 +32,32 @@ async fn a_blob_over_the_bus_frame_round_trips_through_a_peer_bound_stream() {
// 20 MiB: over the 16 MiB frame no inline call could carry.
let len = 20 * MIB;
let stored = rig
- .member("StreamPut", ("tinyjuice_ccr/streamed", len))
+ .member("StreamPut", ("juice/ccr/streamed", len))
.await;
assert_eq!(stored["ok"]["len"], len, "{stored}");
// It is in the module's own scope, byte for byte.
let handle = rig.backend.for_scope(&rig.scope("tinyjuice")).unwrap();
let meta = handle
.blobs()
- .head("tinyjuice_ccr/streamed")
+ .head("juice/ccr/streamed")
.await
.unwrap()
.expect("the streamed blob is stored");
assert_eq!(meta.len, len);
let bytes = handle
.blobs()
- .get_range("tinyjuice_ccr/streamed", 0..1024)
+ .get_range("juice/ccr/streamed", 0..1024)
.await
.unwrap()
.expect("range");
assert!(bytes.iter().all(|byte| *byte == 0xAB));
// And it comes back whole by `GetStream`.
- let read = rig.member("StreamGet", ("tinyjuice_ccr/streamed",)).await;
+ let read = rig.member("StreamGet", ("juice/ccr/streamed",)).await;
assert_eq!(read["ok"]["len"], len, "{read}");
assert_eq!(read["ok"]["meta_len"], len, "{read}");
assert_eq!(read["ok"]["all_fill"], true, "{read}");
// A key that is not there is `null`, not an error.
- let missing = rig.member("StreamGet", ("tinyjuice_ccr/absent",)).await;
+ let missing = rig.member("StreamGet", ("juice/ccr/absent",)).await;
assert!(
missing["ok"].is_null() && missing.get("ok").is_some(),
"{missing}"
@@ -92,7 +92,7 @@ async fn a_streamed_blob_is_still_bound_by_the_grant_and_the_length() {
);
// The module keeps working after a refusal.
let after = rig
- .member("StreamPut", ("tinyjuice_ccr/after", 3 * MIB))
+ .member("StreamPut", ("juice/ccr/after", 3 * MIB))
.await;
assert_eq!(after["ok"]["len"], 3 * MIB, "{after}");
}
@@ -105,7 +105,7 @@ async fn an_inline_blob_no_frame_can_carry_fails_fast_instead_of_hanging() {
// frame, over the 16 MiB cap.
let started = std::time::Instant::now();
let big: Value = rig
- .member("PutBlob", ("tinyjuice_ccr/over-frame", 5_000_000usize))
+ .member("PutBlob", ("juice/ccr/over-frame", 5_000_000usize))
.await;
assert!(
big.get("err").is_some(),
@@ -119,12 +119,12 @@ async fn an_inline_blob_no_frame_can_carry_fails_fast_instead_of_hanging() {
let handle = rig.backend.for_scope(&rig.scope("tinyjuice")).unwrap();
assert!(handle
.blobs()
- .head("tinyjuice_ccr/over-frame")
+ .head("juice/ccr/over-frame")
.await
.unwrap()
.is_none());
let after: Value = rig
- .member("PutBlob", ("tinyjuice_ccr/after", 2048usize))
+ .member("PutBlob", ("juice/ccr/after", 2048usize))
.await;
assert!(
after.get("ok").is_some(),
@@ -221,14 +221,14 @@ async fn a_second_module_cannot_read_or_take_the_first_modules_streams() {
// which has no blobs at all.
let rig = rig_with_peers("tinyjuice", &["tinyjuice", "tinymcp"]).await;
let stored = rig
- .member("StreamPut", ("tinyjuice_ccr/private", 2 * MIB))
+ .member("StreamPut", ("juice/ccr/private", 2 * MIB))
.await;
assert_eq!(stored["ok"]["len"], 2 * MIB, "{stored}");
// A module without blob rights is refused outright.
let nosy: tinybus::Result<Value> = rig
.peer_proxy(1, "Blobs")
- .call("GetStream", (json!({"key": "tinyjuice_ccr/private"}),))
+ .call("GetStream", (json!({"key": "juice/ccr/private"}),))
.await;
match nosy {
Err(tinybus::Error::MethodFailed { name, message }) => {
@@ -248,7 +248,7 @@ async fn a_second_module_cannot_read_or_take_the_first_modules_streams() {
.call(
"PutStream",
(
- json!({"key": "tinyjuice_ccr/hijacked", "len": MIB}),
+ json!({"key": "juice/ccr/hijacked", "len": MIB}),
reference,
),
)
@@ -260,12 +260,12 @@ async fn a_second_module_cannot_read_or_take_the_first_modules_streams() {
let handle = rig.backend.for_scope(&rig.scope("tinyjuice")).unwrap();
assert!(handle
.blobs()
- .head("tinyjuice_ccr/hijacked")
+ .head("juice/ccr/hijacked")
.await
.unwrap()
.is_none());
// The refused attempt did not spend the stream: its owner still uses it.
- let used = rig.member("UseStream", ("tinyjuice_ccr/owned", MIB)).await;
+ let used = rig.member("UseStream", ("juice/ccr/owned", MIB)).await;
assert!(
used.get("ok").is_some(),
"the owner lost its stream: {used}"
@@ -273,7 +273,7 @@ async fn a_second_module_cannot_read_or_take_the_first_modules_streams() {
assert_eq!(
handle
.blobs()
- .head("tinyjuice_ccr/owned")
+ .head("juice/ccr/owned")
.await
.unwrap()
.expect("stored by the owner")
@@ -282,7 +282,7 @@ async fn a_second_module_cannot_read_or_take_the_first_modules_streams() {
);
// A download the host opened toward the probe is not readable by a peer.
- let reply = rig.member("RawGetStream", ("tinyjuice_ccr/private",)).await;
+ let reply = rig.member("RawGetStream", ("juice/ccr/private",)).await;
let download: tinybus::StreamRef = serde_json::from_value(reply["ok"][1].clone())
.unwrap_or_else(|_| panic!("a download reference: {reply}"));
assert!(
diff --git a/crates/openhuman-core/src/modules/storage_host_cdylib_tests.rs b/crates/openhuman-core/src/modules/storage_host_cdylib_tests.rs
index cb31a6015c..8a7c7bc2f7 100644
--- a/crates/openhuman-core/src/modules/storage_host_cdylib_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_host_cdylib_tests.rs
@@ -547,7 +547,7 @@ async fn a_blob_over_the_inline_cap_is_refused_and_stores_nothing() {
let rig = rig("tinyjuice").await;
let small: Value = rig
.probe
- .call("PutBlob", ("tinyjuice_ccr/small", 1024usize))
+ .call("PutBlob", ("juice/ccr/small", 1024usize))
.await
.unwrap();
assert!(
@@ -560,7 +560,7 @@ async fn a_blob_over_the_inline_cap_is_refused_and_stores_nothing() {
// `an_inline_blob_no_frame_can_carry_fails_fast_instead_of_hanging`.)
let big: Value = rig
.probe
- .call("PutBlob", ("tinyjuice_ccr/over-cap", 2usize * 1024 * 1024))
+ .call("PutBlob", ("juice/ccr/over-cap", 2usize * 1024 * 1024))
.await
.unwrap();
assert!(
@@ -570,14 +570,14 @@ async fn a_blob_over_the_inline_cap_is_refused_and_stores_nothing() {
let handle = rig.backend.for_scope(&rig.scope("tinyjuice")).unwrap();
assert!(handle
.blobs()
- .head("tinyjuice_ccr/over-cap")
+ .head("juice/ccr/over-cap")
.await
.unwrap()
.is_none());
// The refusal does not take the module's connection down with it.
let after: Value = rig
.probe
- .call("PutBlob", ("tinyjuice_ccr/after", 2048usize))
+ .call("PutBlob", ("juice/ccr/after", 2048usize))
.await
.unwrap();
assert!(