A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
test: keep partial socket lines across e2e read timeouts (#3281)
Sebastian Müller58e57374ecd9
diff --git a/crates/pa-cli/tests/agents_view_flash_e2e.rs b/crates/pa-cli/tests/agents_view_flash_e2e.rsindex 3505bc21b0..69ed1643c8 100644--- a/crates/pa-cli/tests/agents_view_flash_e2e.rs+++ b/crates/pa-cli/tests/agents_view_flash_e2e.rs@@ -201,10 +201,9 @@ impl Client {.set_read_timeout(Some(Duration::from_millis(100))).expect("set timeout");loop {- line.clear();match self.reader.read_line(&mut line) {Ok(0) => panic!("supervisor closed the connection"),- Ok(_) if line.trim().is_empty() => {}+ Ok(_) if line.trim().is_empty() => line.clear(),Ok(_) => return serde_json::from_str(line.trim()).expect("parse line"),Err(error) => {assert!(Instant::now() < deadline, "timed out reading: {error}");diff --git a/crates/pa-cli/tests/continue_guard_e2e.rs b/crates/pa-cli/tests/continue_guard_e2e.rsindex 27a3aa74d7..10d501569c 100644--- a/crates/pa-cli/tests/continue_guard_e2e.rs+++ b/crates/pa-cli/tests/continue_guard_e2e.rs@@ -120,16 +120,16 @@ fn make_session_active(socket: &Path, session_path: &Path, cwd: &Path) -> Stringwriter.write_all(line.as_bytes()).expect("send");writer.flush().expect("flush");let deadline = Instant::now() + Duration::from_secs(30);+ let mut line = String::new();loop {assert!(Instant::now() < deadline, "no create response");- let mut line = String::new();reader.get_mut().set_read_timeout(Some(Duration::from_millis(100))).expect("timeout");match reader.read_line(&mut line) {Ok(0) => panic!("daemon closed during create"),- Ok(_) if line.trim().is_empty() => {}+ Ok(_) if line.trim().is_empty() => line.clear(),Ok(_) => {let response: Value = serde_json::from_str(line.trim()).expect("parse");assert_eq!(response["success"], true, "create failed: {response}");diff --git a/crates/pa-cli/tests/daemon_commands_e2e.rs b/crates/pa-cli/tests/daemon_commands_e2e.rsindex 53eaf6795e..a5cdf060b1 100644--- a/crates/pa-cli/tests/daemon_commands_e2e.rs+++ b/crates/pa-cli/tests/daemon_commands_e2e.rs@@ -212,10 +212,9 @@ impl Wire {.set_read_timeout(Some(Duration::from_millis(100))).expect("set timeout");loop {- line.clear();match self.reader.read_line(&mut line) {Ok(0) => panic!("daemon closed the connection"),- Ok(_) if line.trim().is_empty() => {}+ Ok(_) if line.trim().is_empty() => line.clear(),Ok(_) => return serde_json::from_str(line.trim()).expect("parse daemon line"),Err(_) if Instant::now() < deadline => {}Err(error) => panic!("timed out waiting for daemon line: {error}"),diff --git a/crates/pa-cli/tests/subagent_panel_nested_count_e2e.rs b/crates/pa-cli/tests/subagent_panel_nested_count_e2e.rsindex 6da1ddf5ab..0be8da6580 100644--- a/crates/pa-cli/tests/subagent_panel_nested_count_e2e.rs+++ b/crates/pa-cli/tests/subagent_panel_nested_count_e2e.rs@@ -142,10 +142,9 @@ impl Client {.set_read_timeout(Some(Duration::from_millis(100))).expect("set timeout");loop {- line.clear();match self.reader.read_line(&mut line) {Ok(0) => panic!("supervisor closed the connection"),- Ok(_) if line.trim().is_empty() => {}+ Ok(_) if line.trim().is_empty() => line.clear(),Ok(_) => return serde_json::from_str(line.trim()).expect("parse response line"),Err(error) => {assert!(diff --git a/crates/pa-daemon/tests/supervisor_e2e/main.rs b/crates/pa-daemon/tests/supervisor_e2e/main.rsindex f5c118c4a2..3bcf2f063f 100644--- a/crates/pa-daemon/tests/supervisor_e2e/main.rs+++ b/crates/pa-daemon/tests/supervisor_e2e/main.rs@@ -142,10 +142,9 @@ impl Client {.set_read_timeout(Some(Duration::from_millis(100))).expect("set timeout");loop {- line.clear();match self.reader.read_line(&mut line) {Ok(0) => panic!("supervisor closed the connection"),- Ok(_) if line.trim().is_empty() => {}+ Ok(_) if line.trim().is_empty() => line.clear(),Ok(_) => {return serde_json::from_str(line.trim()).expect("parse response line");}