Skip to content

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

test(agent-harness): remove dead helper code from streaming_support module

Steven Enamakel8b77074254ca
diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rs
index 1603b16d9e..3f202bf737 100644
--- a/tests/agent_harness_e2e.rs
+++ b/tests/agent_harness_e2e.rs
@@ -2290,212 +2290,6 @@ mod streaming_support {
ModelResponse::assistant(text).with_usage(usage)
}
- pub fn native_tool_response_s(id: &str, name: &str, args: serde_json::Value) -> ModelResponse {
- let mut usage = Usage::new(15, 4);
- usage.cache_read_tokens = 3;
- ModelResponse {
- message: AssistantMessage {
- id: None,
- content: Vec::<ContentBlock>::new(),
- tool_calls: vec![ToolCall::new(id, name, args)],
- usage: Some(usage),
- origin: None,
- },
- usage: Some(usage),
- finish_reason: Some("tool_calls".to_string()),
- raw: None,
- resolved_model: None,
- continue_turn: None,
- served_from_cache: false,
- correlation: None,
- resolved_route: None,
- }
- }
-
- // ── workspace / memory helpers ──────────────────────────────────────────
- // Copied from agent_session_turn_raw_coverage_e2e.rs:503-553.
-
- pub fn workspace_s(label: &str) -> (TempDir, PathBuf) {
- let root = std::env::current_dir()
- .unwrap()
- .join("target")
- .join(format!(
- "agent-harness-e2e-stream-{label}-{}",
- uuid::Uuid::new_v4()
- ));
- std::fs::create_dir_all(&root).unwrap();
- let temp = TempDir::new_in(root.parent().unwrap()).unwrap();
- let path = temp.path().join(label);
- std::fs::create_dir_all(&path).unwrap();
- (temp, path)
- }
-
- /// A memory that stores nothing, which is what this helper always built.
- ///
- /// It used to ask the engine's factory for `backend: "none"` — an engine
- /// call whose whole purpose was to get back something that does not store.
- /// The agent under test needs *a* memory to be constructed with; it never
- /// reads one back. So the no-op is not a downgrade from what was here, it
- /// is the same behaviour without linking 133k lines to obtain it.
- #[derive(Debug)]
- struct NoMemory;
-
- #[async_trait::async_trait]
- impl Memory for NoMemory {
- fn name(&self) -> &str {
- "none"
- }
- async fn store(
- &self,
- _namespace: &str,
- _key: &str,
- _content: &str,
- _category: openhuman_core::memory::api::types::MemoryCategory,
- _session_id: Option<&str>,
- ) -> anyhow::Result<()> {
- Ok(())
- }
- async fn recall(
- &self,
- _query: &str,
- _limit: usize,
- _opts: openhuman_core::memory::api::recall::RecallOpts<'_>,
- ) -> anyhow::Result<Vec<openhuman_core::memory::api::types::MemoryEntry>> {
- Ok(Vec::new())
- }
- async fn get(
- &self,
- _namespace: &str,
- _key: &str,
- ) -> anyhow::Result<Option<openhuman_core::memory::api::types::MemoryEntry>> {
- Ok(None)
- }
- async fn list(
- &self,
- _namespace: Option<&str>,
- _category: Option<&openhuman_core::memory::api::types::MemoryCategory>,
- _session_id: Option<&str>,
- ) -> anyhow::Result<Vec<openhuman_core::memory::api::types::MemoryEntry>> {
- Ok(Vec::new())
- }
- async fn forget(&self, _namespace: &str, _key: &str) -> anyhow::Result<bool> {
- Ok(false)
- }
- async fn namespace_summaries(
- &self,
- ) -> anyhow::Result<Vec<openhuman_core::memory::api::types::NamespaceSummary>> {
- Ok(Vec::new())
- }
- async fn count(&self) -> anyhow::Result<usize> {
- Ok(0)
- }
- async fn health_check(&self) -> bool {
- true
- }
- }
-
- fn memory_for_workspace_s(_path: &Path) -> Arc<dyn Memory> {
- Arc::new(NoMemory)
- }
-
- pub fn agent_with_s(
- provider: Arc<dyn ChatModel<()>>,
- tools: Vec<Box<dyn Tool>>,
- workspace_path: PathBuf,
- config: AgentConfig,
- ) -> OpenHumanSessionHost {
- OpenHumanSessionHost::builder()
- .chat_model(provider)
- .tools(tools)
- .memory(memory_for_workspace_s(&workspace_path))
- .tool_dispatcher(Box::new(NativeDialect))
- .workspace_dir(workspace_path)
- .event_context("stream-accum-session", "stream-accum-channel")
- .agent_definition_name("round17/orchestrator")
- .config(config)
- .context_config(ContextConfig::default())
- .auto_save(true)
- .explicit_preferences_enabled(false)
- .build()
- .unwrap()
- }
-
- // ── EchoTool ─────────────────────────────────────────────────────────────
- // Minimal Tool impl whose execute asserts args["value"] == "STREAMED_ARG_CANARY"
- // (panicking with the actual args otherwise) and increments a counter.
-
- pub struct EchoTool {
- pub name: &'static str,
- pub calls: Arc<AtomicUsize>,
- }
-
- impl EchoTool {
- pub fn boxed(name: &'static str, calls: Arc<AtomicUsize>) -> Box<dyn Tool> {
- Box::new(Self { name, calls })
- }
- }
-
- #[async_trait]
- impl Tool for EchoTool {
- fn name(&self) -> &str {
- self.name
- }
-
- fn description(&self) -> &str {
- "echo tool for streaming accumulation tests"
- }
-
- fn parameters_schema(&self) -> serde_json::Value {
- json!({
- "type": "object",
- "properties": {
- "value": { "type": "string" }
- },
- "required": ["value"]
- })
- }
-
- async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {
- self.execute_with_options(args, ToolCallOptions::default())
- .await
- }
-
- async fn execute_with_options(
- &self,
- args: serde_json::Value,
- _options: ToolCallOptions,
- ) -> anyhow::Result<ToolResult> {
- self.calls.fetch_add(1, Ordering::SeqCst);
- let got = args
- .get("value")
- .and_then(|v| v.as_str())
- .unwrap_or_default();
- assert_eq!(
- got, "STREAMED_ARG_CANARY",
- "EchoTool received wrong args — dispatch must use the FULL assembled argument \
- string from ModelResponse.message.tool_calls, not partial delta fragments.\n\
- Expected: \"STREAMED_ARG_CANARY\"\n\
- Got: \"{got}\"\n\
- Full args: {args}"
- );
- Ok(ToolResult {
- content: vec![ToolContent::Text {
- text: format!("echoed:{got}"),
- }],
- is_error: false,
- markdown_formatted: None,
- ..ToolResult::default()
- })
- }
-
- fn permission_level(&self) -> PermissionLevel {
- PermissionLevel::ReadOnly
- }
-
- fn scope(&self) -> RuntimeToolScope {
- RuntimeToolScope::All
- }
- }
}
// ─── Per-model-call wall-clock ceiling (#5766 / PR #5767) ────────────────────