Skip to content

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

test(computer-bali): add malformed-flow rejection test and e2e plan replay

Steven Enamakeld4cb27927143
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser_computer_tests.rs b/crates/openhuman-core/src/tools/impl/browser/browser_computer_tests.rs
index c172ae00a0..7bcd93de02 100644
--- a/crates/openhuman-core/src/tools/impl/browser/browser_computer_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/browser/browser_computer_tests.rs
@@ -366,3 +366,16 @@ fn idle_and_oldest_sessions_are_bounded() {
assert_eq!(evicted.len(), 1);
assert_eq!(evicted[0].id.as_str(), "expired-browser");
}
+
+#[tokio::test]
+async fn task_rejects_a_malformed_flow_before_the_module() {
+ let client = Arc::new(BrowserClient::new(Arc::new(
+ crate::config::Config::default(),
+ )));
+ let tool = BrowserTool::new(Arc::new(SecurityPolicy::default()), client, 3);
+ let error = tool
+ .run(&json!({"action":"task","goal":"Read the news","flow":{"steps":"not a list"}}))
+ .await
+ .unwrap_err();
+ assert!(error.to_string().contains("Invalid flow"), "{error}");
+}
diff --git a/tests/computer_bali_live_e2e.rs b/tests/computer_bali_live_e2e.rs
index d2a083ea6f..f404c978ba 100644
--- a/tests/computer_bali_live_e2e.rs
+++ b/tests/computer_bali_live_e2e.rs
@@ -26,7 +26,8 @@
//! ```
//!
//! Optional: `COMPUTER_E2E_CHROME` (Chrome executable), `COMPUTER_E2E_HEADLESS=1`,
-//! `COMPUTER_E2E_MINUTES` (default 20), `COMPUTER_E2E_DECISION_MODEL`
+//! `COMPUTER_E2E_MINUTES` (default 20), `COMPUTER_E2E_PLAN=1` (plan instead of
+//! replaying `fixtures/computer/bali/plan.json`), `COMPUTER_E2E_DECISION_MODEL`
//! (`jev`, `open_jev`, `sage`), `COMPUTER_E2E_OUT` (report directory).
use std::collections::BTreeMap;
@@ -38,6 +39,10 @@ use tinycomputer_bus::agent::{ContinueTaskRequest, TaskStatus, TaskView};
const TASK: &str = include_str!("fixtures/computer/bali/task.md");
const FACTS: &str = include_str!("fixtures/computer/bali/facts.json");
+/// The flow to replay, adapted from the Kashmir demo's recorded plan. Replaying
+/// a saved flow is how that demo's passing runs were made; set
+/// `COMPUTER_E2E_PLAN=1` to let the planner write a fresh one instead.
+const PLAN: &str = include_str!("fixtures/computer/bali/plan.json");
const DEFAULT_CHROME: &str = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
fn config(workspace: &std::path::Path) -> Config {
@@ -140,6 +145,11 @@ async fn books_a_bali_flight_up_to_the_payment_page() {
facts: facts.clone(),
origins: vec!["https://.google.com".into(), "https://.goindigo.in".into()],
max_actions: 200,
+ flow: if std::env::var("COMPUTER_E2E_PLAN").is_ok_and(|v| v == "1") {
+ None
+ } else {
+ Some(serde_json::from_str(PLAN).expect("saved Bali flow"))
+ },
};
let minutes = std::env::var("COMPUTER_E2E_MINUTES")
.ok()
diff --git a/tests/fixtures/computer/bali/plan.json b/tests/fixtures/computer/bali/plan.json
new file mode 100644
index 0000000000..ae648f3185
--- /dev/null
+++ b/tests/fixtures/computer/bali/plan.json
@@ -0,0 +1,167 @@
+{
+ "app": "browser",
+ "vars": {
+ "destination": "Denpasar, Bali (DPS)",
+ "origin": "Bengaluru (BLR)",
+ "travel_date": "Sunday 15 November 2026"
+ },
+ "steps": [
+ {
+ "browse": "https://www.google.com/travel/flights?q=Flights%20to%20DPS%20from%20BLR%20on%202026-11-15%20oneway&curr=INR&hl=en&gl=IN"
+ },
+ {
+ "wait_for": "a list of one-way flight results from ${origin} to ${destination} is showing"
+ },
+ {
+ "pick": {
+ "from": "the flight results",
+ "by": "lowest price",
+ "into": "cheapest_flight"
+ }
+ },
+ {
+ "verify": "flight results with prices are showing"
+ },
+ {
+ "browse": "https://www.goindigo.in/"
+ },
+ {
+ "if": {
+ "condition": "a cookie banner is visible",
+ "then": [
+ "dismiss the cookie banner by accepting essential cookies only"
+ ],
+ "else": []
+ }
+ },
+ "choose the One Way trip type",
+ {
+ "choose": {
+ "what": "the source city selector",
+ "option": "Bengaluru"
+ }
+ },
+ {
+ "choose": {
+ "what": "the destination city selector",
+ "option": "Denpasar"
+ }
+ },
+ {
+ "choose": {
+ "what": "the departure date calendar",
+ "option": "15 November 2026"
+ }
+ },
+ "search for flights",
+ {
+ "wait_for": "a list of flights for ${travel_date} from ${origin} to ${destination} is showing"
+ },
+ {
+ "pick": {
+ "from": "the IndiGo flight results",
+ "by": "lowest price",
+ "into": "selected_flight"
+ }
+ },
+ {
+ "choose": {
+ "what": "the fare type for the selected flight",
+ "option": "Saver"
+ }
+ },
+ {
+ "repeat_until": {
+ "condition": "a passenger details form with first name and last name fields is showing",
+ "steps": [
+ "continue to passenger details"
+ ],
+ "max": 3
+ }
+ },
+ {
+ "enter": {
+ "first and middle name": "${first name}",
+ "last name": "${last name}",
+ "date of birth": "${date of birth}"
+ }
+ },
+ {
+ "if": {
+ "condition": "a passenger title field is shown",
+ "then": [
+ {
+ "choose": {
+ "what": "the passenger title",
+ "option": "${title}"
+ }
+ }
+ ],
+ "else": []
+ }
+ },
+ {
+ "choose": {
+ "what": "the passenger gender",
+ "option": "${gender}"
+ }
+ },
+ {
+ "enter": {
+ "contact email": "${email}",
+ "contact mobile number": "${mobile number}"
+ }
+ },
+ {
+ "if": {
+ "condition": "an unticked checkbox agreeing to the airline's Conditions of Carriage is shown",
+ "then": [
+ "tick the Conditions of Carriage checkbox"
+ ],
+ "else": []
+ }
+ },
+ {
+ "repeat_until": {
+ "condition": "the add-ons page is showing",
+ "steps": [
+ "continue to the add-ons page"
+ ],
+ "max": 3
+ }
+ },
+ {
+ "repeat_until": {
+ "condition": "the seat selection page is showing",
+ "steps": [
+ "continue past the add-ons page without adding anything"
+ ],
+ "max": 3
+ }
+ },
+ {
+ "if": {
+ "condition": "a free window seat is offered",
+ "then": [
+ "choose a free window seat"
+ ],
+ "else": []
+ }
+ },
+ {
+ "repeat_until": {
+ "condition": "the payment page is showing",
+ "steps": [
+ "continue to the payment page, pressing Skip when no seat is chosen"
+ ],
+ "max": 3
+ }
+ },
+ {
+ "verify": "the trip summary shows 1 Adult, ${origin} to ${destination}, on ${travel_date}"
+ },
+ {
+ "stop_before": "paying for the booking"
+ }
+ ]
+}
\ No newline at end of file