Skip to content

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

test: cover new telemetry and e2e runtime branches

Steven Enamakel75a0a7de4f3a
diff --git a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_content_gate_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_content_gate_tests.rs
index a68fe51b0e..cabc7a40be 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_content_gate_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_content_gate_tests.rs
@@ -41,6 +41,16 @@ fn oversized_model_content_remains_structured() {
assert!(captured.to_string().chars().count() <= MAX_MODEL_CONTENT_CHARS + 128);
}
+#[test]
+fn object_model_content_is_truncated_without_panicking() {
+ let captured = capture_model_content(&serde_json::json!({
+ "role": "user",
+ "content": "x".repeat(MAX_MODEL_CONTENT_CHARS),
+ }));
+ assert_eq!(captured["role"], "user");
+ assert!(captured["content"].as_str().unwrap().contains("…"));
+}
+
#[test]
fn turn_content_respects_the_trace_context_capture_gate() {
// Regression (PR #4506 review): the collector briefly carried TWO capture
diff --git a/crates/openhuman-core/src/core/jsonrpc.rs b/crates/openhuman-core/src/core/jsonrpc.rs
index 0b86eb1ffb..8459afc3b0 100644
--- a/crates/openhuman-core/src/core/jsonrpc.rs
+++ b/crates/openhuman-core/src/core/jsonrpc.rs
@@ -1513,9 +1513,7 @@ async fn run_server_with_services(
// The browser E2E harness scripts direct tool calls through its mock model.
// Keep production's fail-closed packed default, while making those calls
// visible in the deterministic test core without changing library hosts.
- if std::env::var_os("OPENHUMAN_E2E").is_some() {
- builder = builder.tool_groups(crate::tools::toolpacks::ToolGroups::advertised());
- }
+ builder = apply_e2e_tool_groups(builder);
if let Some(host) = host {
builder = builder.host(host);
}
@@ -1527,6 +1525,16 @@ async fn run_server_with_services(
runtime.serve(ready_tx, shutdown_token).await
}
+fn apply_e2e_tool_groups(
+ builder: crate::core::runtime::CoreBuilder,
+) -> crate::core::runtime::CoreBuilder {
+ if std::env::var_os("OPENHUMAN_E2E").is_some() {
+ builder.tool_groups(crate::tools::toolpacks::ToolGroups::advertised())
+ } else {
+ builder
+ }
+}
+
/// Per-`DomainGroup` gating decision for each event-bus subscriber that
/// [`register_domain_subscribers`] conditionally registers. Extracted as a
/// pure value so the subscriber→group mapping has a single source of truth
diff --git a/crates/openhuman-core/src/core/jsonrpc_tests.rs b/crates/openhuman-core/src/core/jsonrpc_tests.rs
index bcf13f25cb..e5c5c3b720 100644
--- a/crates/openhuman-core/src/core/jsonrpc_tests.rs
+++ b/crates/openhuman-core/src/core/jsonrpc_tests.rs
@@ -7,11 +7,18 @@ use std::time::Duration;
use tokio_util::sync::CancellationToken;
use super::{
- default_state, group_first_time_when_bus_ready, invoke_method, is_session_expired_error,
- is_unconfirmed_unauthorized_error, learning_first_time_when_bus_ready, params_to_object,
- parse_json_params, should_publish_session_expired, translate_local_session_error, type_name,
- DomainSubscriberPlan,
+ apply_e2e_tool_groups, default_state, group_first_time_when_bus_ready, invoke_method,
+ is_session_expired_error, is_unconfirmed_unauthorized_error,
+ learning_first_time_when_bus_ready, params_to_object, parse_json_params,
+ should_publish_session_expired, translate_local_session_error, type_name, DomainSubscriberPlan,
};
+
+#[test]
+fn e2e_environment_enables_advertised_tool_groups() {
+ let _guard = EnvVarGuard::set_many(vec![("OPENHUMAN_E2E", "1".into())]);
+ let builder = crate::core::runtime::CoreBuilder::new(crate::core::types::HostKind::Cli);
+ let _ = apply_e2e_tool_groups(builder);
+}
// These are the `http-server`-gated RPC-surface symbols (#5048); the tests that
// name them below carry the same `#[cfg]` so the disabled-build test compile
// (`cargo test --no-default-features`) stays green.