The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: reformat long lines in test and store files
Steven Enamakel03edbf300018
diff --git a/crates/openhuman-core/src/agent/goals/tools_tests.rs b/crates/openhuman-core/src/agent/goals/tools_tests.rsindex b6c8cc3808..94383268ea 100644--- a/crates/openhuman-core/src/agent/goals/tools_tests.rs+++ b/crates/openhuman-core/src/agent/goals/tools_tests.rs@@ -12,7 +12,8 @@ impl ToolRunContext for ThreadContext {/// Every goal tool answers with `{ goal, text }`: the structured goal the UI/// reads and the rendered block the transcript shows.fn payload(res: &tinytools::ToolResult) -> serde_json::Value {- serde_json::from_str(&res.text()).unwrap_or_else(|e| panic!("goal payload is JSON: {e}: {}", res.text()))+ serde_json::from_str(&res.text())+ .unwrap_or_else(|e| panic!("goal payload is JSON: {e}: {}", res.text()))}#[tokio::test]@@ -47,7 +48,10 @@ async fn set_get_complete_via_tools_in_thread_scope() {let get_payload = payload(&res);assert_eq!(get_payload["goal"]["status"], "active");assert_eq!(get_payload["goal"]["goalId"], set_payload["goal"]["goalId"]);- assert!(get_payload["text"].as_str().unwrap().contains("status: active"));+ assert!(get_payload["text"]+ .as_str()+ .unwrap()+ .contains("status: active"));let done = GoalCompleteTool::new(dir.clone());let res = done@@ -56,7 +60,10 @@ async fn set_get_complete_via_tools_in_thread_scope() {.unwrap();let done_payload = payload(&res);assert_eq!(done_payload["goal"]["status"], "complete");- assert!(done_payload["text"].as_str().unwrap().starts_with("Goal marked complete."));+ assert!(done_payload["text"]+ .as_str()+ .unwrap()+ .starts_with("Goal marked complete."));}#[tokio::test]diff --git a/crates/openhuman-core/src/agent/tools/todo_tests.rs b/crates/openhuman-core/src/agent/tools/todo_tests.rsindex dda4a9233d..e1c0910a29 100644--- a/crates/openhuman-core/src/agent/tools/todo_tests.rs+++ b/crates/openhuman-core/src/agent/tools/todo_tests.rs@@ -99,14 +99,21 @@ fn schema_is_the_claude_shape() {let schema = tool.parameters_schema();let props = &schema["properties"];assert!(props.get("todos").is_some());- assert_eq!(props.as_object().unwrap().len(), 1, "no per-card ops: {props}");+ assert_eq!(+ props.as_object().unwrap().len(),+ 1,+ "no per-card ops: {props}"+ );assert_eq!(props["todos"]["items"]["properties"]["status"]["enum"],json!(["pending", "in_progress", "completed"]));let desc = tool.description();assert!(desc.contains("3+ steps"), "missing when-to-use guidance");- assert!(desc.contains("one `in_progress`"), "missing single-in_progress rule");+ assert!(+ desc.contains("one `in_progress`"),+ "missing single-in_progress rule"+ );assert!(!desc.contains("board"),"the tool must not describe itself as a board"@@ -168,16 +175,30 @@ fn every_agent_binds_to_its_own_session() {#[tokio::test]async fn sessions_do_not_see_each_other_and_a_list_survives_across_turns() {- let a = TodoScope::Session { id: "sess-a".into() };- let b = TodoScope::Session { id: "sess-b".into() };+ let a = TodoScope::Session {+ id: "sess-a".into(),+ };+ let b = TodoScope::Session {+ id: "sess-b".into(),+ };crate::agent::todos::ops::clear(&a).await.unwrap();crate::agent::todos::ops::clear(&b).await.unwrap();let item = TodoItem::with_status("only in a", TodoStatus::InProgress);- crate::agent::todos::ops::replace(&a, vec![item]).await.unwrap();+ crate::agent::todos::ops::replace(&a, vec![item])+ .await+ .unwrap();let a_again = crate::agent::todos::ops::list(&a).await.unwrap();- assert_eq!(a_again.items.len(), 1, "a later turn of the same session reads it back");+ assert_eq!(+ a_again.items.len(),+ 1,+ "a later turn of the same session reads it back"+ );assert_eq!(a_again.session_id.as_deref(), Some("sess-a"));- assert!(crate::agent::todos::ops::list(&b).await.unwrap().items.is_empty());+ assert!(crate::agent::todos::ops::list(&b)+ .await+ .unwrap()+ .items+ .is_empty());}diff --git a/crates/openhuman-core/src/integrations/task_sources/store.rs b/crates/openhuman-core/src/integrations/task_sources/store.rsindex 8c2ebfc499..ce8fd614e7 100644--- a/crates/openhuman-core/src/integrations/task_sources/store.rs+++ b/crates/openhuman-core/src/integrations/task_sources/store.rs@@ -295,9 +295,8 @@ pub fn mark_ingested(config: &Config, source_id: &str, task: &NormalizedTask) ->/// brand-new one in its logs.pub fn was_ingested(config: &Config, source_id: &str, external_id: &str) -> Result<bool> {with_connection(config, |conn| {- let mut stmt = conn.prepare(- "SELECT 1 FROM ingested_tasks WHERE source_id = ?1 AND external_id = ?2",- )?;+ let mut stmt =+ conn.prepare("SELECT 1 FROM ingested_tasks WHERE source_id = ?1 AND external_id = ?2")?;let mut rows = stmt.query(params![source_id, external_id])?;Ok(rows.next()?.is_some())})diff --git a/crates/openhuman-core/src/integrations/task_sources/store_tests.rs b/crates/openhuman-core/src/integrations/task_sources/store_tests.rsindex 18a9ad0b61..c11b3ebf36 100644--- a/crates/openhuman-core/src/integrations/task_sources/store_tests.rs+++ b/crates/openhuman-core/src/integrations/task_sources/store_tests.rs@@ -163,8 +163,7 @@ fn remove_deletes_and_cascades_ingested() {25,).unwrap();- mark_ingested(&config, &src.id, &sample_task("1", "A", "2025-01-01"))- .unwrap();+ mark_ingested(&config, &src.id, &sample_task("1", "A", "2025-01-01")).unwrap();remove_source(&config, &src.id).unwrap();assert!(get_source(&config, &src.id).is_err());@@ -268,10 +267,8 @@ fn list_ingested_orders_newest_first() {).unwrap();- mark_ingested(&config, &src.id, &sample_task("1", "first", "2025-01-01"))- .unwrap();- mark_ingested(&config, &src.id, &sample_task("2", "second", "2025-01-02"))- .unwrap();+ mark_ingested(&config, &src.id, &sample_task("1", "first", "2025-01-01")).unwrap();+ mark_ingested(&config, &src.id, &sample_task("2", "second", "2025-01-02")).unwrap();let listed = list_ingested(&config, &src.id, 10).unwrap();assert_eq!(listed.len(), 2);// Newest ingested_at first; "2" was inserted last.diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rsindex 1f59727443..eafae2fd66 100644--- a/tests/agent_harness_e2e.rs+++ b/tests/agent_harness_e2e.rs@@ -4614,7 +4614,11 @@ async fn todo_list_ticks_off_five_items_across_turns_inner() {.to_string()}).collect();- assert_eq!(todo_statuses(&payload), expected, "after {completed} done: {payload}");+ assert_eq!(+ todo_statuses(&payload),+ expected,+ "after {completed} done: {payload}"+ );}// The model was told what it wrote back: the tool message in the next@@ -4638,10 +4642,17 @@ async fn todo_list_ticks_off_five_items_across_turns_inner() {let turns = turn_state_history(&stack.rpc_base, 650, "thread-todo-five").await;assert_eq!(turns.len(), FIVE_STEPS.len() + 1, "one snapshot per turn");let rows = persisted_tool_rows(&turns, "todo");- assert_eq!(rows.len(), FIVE_STEPS.len() + 1, "one todo row per turn: {rows:?}");+ assert_eq!(+ rows.len(),+ FIVE_STEPS.len() + 1,+ "one todo row per turn: {rows:?}"+ );for row in &rows {assert_eq!(row["status"].as_str(), Some("success"), "{row}");- assert!(row["output"].as_str().is_some(), "persisted row keeps the output: {row}");+ assert!(+ row["output"].as_str().is_some(),+ "persisted row keeps the output: {row}"+ );}let last: Value = serde_json::from_str(rows.last().unwrap()["output"].as_str().unwrap()).expect("persisted output is the JSON payload");@@ -4711,7 +4722,11 @@ async fn todo_list_rejects_two_items_in_progress_inner() {.all(|frame| frame["tool_call_id"].as_str() == Some("call_todo")),"the todo tool is unpacked — every frame is a direct `todo` call: {todo_frames:?}");- assert_eq!(todo_frames.len(), 3, "write, rejected write, read: {results:?}");+ assert_eq!(+ todo_frames.len(),+ 3,+ "write, rejected write, read: {results:?}"+ );assert_eq!(todo_frames[0]["success"], json!(true), "{}", todo_frames[0]);assert_eq!(todo_frames[1]["success"],@@ -4764,10 +4779,8 @@ async fn thread_goal_is_set_read_back_and_completed_across_turns_inner() {]);let stack = boot_stack().await;- let mut events = spawn_sse_collector(format!(- "{}/events?client_id=harness-goal",- stack.rpc_base- ));+ let mut events =+ spawn_sse_collector(format!("{}/events?client_id=harness-goal", stack.rpc_base));// Turn 1: goal_set.send_web_chat(@@ -4781,10 +4794,16 @@ async fn thread_goal_is_set_read_back_and_completed_across_turns_inner() {let (terminal, results) = collect_turn_tool_results(&mut events, Duration::from_secs(60)).await;assert_eq!(terminal["event"].as_str(), Some("chat_done"), "{terminal}");let set = tool_result_payload(&results, "goal_set");- assert_eq!(set["goal"]["objective"], "Ship the v2 release notes", "{set}");+ assert_eq!(+ set["goal"]["objective"], "Ship the v2 release notes",+ "{set}"+ );assert_eq!(set["goal"]["status"], "active", "{set}");assert_eq!(set["goal"]["tokenBudget"], 50000, "{set}");- assert_eq!(set["goal"]["threadId"], "thread-goal", "bound to the chat thread: {set}");+ assert_eq!(+ set["goal"]["threadId"], "thread-goal",+ "bound to the chat thread: {set}"+ );let goal_id = set["goal"]["goalId"].as_str().filter(|id| !id.is_empty())@@ -4800,14 +4819,30 @@ async fn thread_goal_is_set_read_back_and_completed_across_turns_inner() {// scripted upstream returns no `usage`, so a turn charges nothing against// the budget. `agent::goals::runtime`'s unit tests cover the accounting// and the budget-limit transition directly.)- send_web_chat(&stack.rpc_base, 801, "harness-goal", "thread-goal", "status?").await;+ send_web_chat(+ &stack.rpc_base,+ 801,+ "harness-goal",+ "thread-goal",+ "status?",+ )+ .await;let (terminal, results) = collect_turn_tool_results(&mut events, Duration::from_secs(60)).await;assert_eq!(terminal["event"].as_str(), Some("chat_done"), "{terminal}");let got = tool_result_payload(&results, "goal_get");- assert_eq!(got["goal"]["goalId"], goal_id, "same goal across turns: {got}");+ assert_eq!(+ got["goal"]["goalId"], goal_id,+ "same goal across turns: {got}"+ );assert_eq!(got["goal"]["status"], "active", "{got}");- assert_eq!(got["goal"]["objective"], "Ship the v2 release notes", "{got}");- assert_eq!(got["goal"]["tokenBudget"], 50000, "the budget persisted: {got}");+ assert_eq!(+ got["goal"]["objective"], "Ship the v2 release notes",+ "{got}"+ );+ assert_eq!(+ got["goal"]["tokenBudget"], 50000,+ "the budget persisted: {got}"+ );// Turn 3: goal_complete.send_web_chat(&stack.rpc_base, 802, "harness-goal", "thread-goal", "done?").await;@@ -4817,7 +4852,10 @@ async fn thread_goal_is_set_read_back_and_completed_across_turns_inner() {assert_eq!(done["goal"]["goalId"], goal_id, "{done}");assert_eq!(done["goal"]["status"], "complete", "{done}");assert!(- done["text"].as_str().unwrap().starts_with("Goal marked complete."),+ done["text"]+ .as_str()+ .unwrap()+ .starts_with("Goal marked complete."),"{done}");@@ -4836,7 +4874,10 @@ async fn thread_goal_is_set_read_back_and_completed_across_turns_inner() {.expect("persisted goal_complete keeps its output"),).unwrap();- assert_eq!(persisted_done["goal"]["status"], "complete", "{persisted_done}");+ assert_eq!(+ persisted_done["goal"]["status"], "complete",+ "{persisted_done}"+ );// A thread that never set a goal reads back none — the payload the pane// treats as "no banner".