Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

test(host): wait for the file agent to finish writing its results

leepokaib9c5f9bd4126
diff --git a/host/tests/files_e2e.rs b/host/tests/files_e2e.rs
index 26418c64..6921c113 100644
--- a/host/tests/files_e2e.rs
+++ b/host/tests/files_e2e.rs
@@ -188,8 +188,10 @@ async fn rejects_invalid_sources_without_a_file_entry() {
async fn rejected(path: &std::path::Path) {
let waited = tokio::time::timeout(Duration::from_secs(20), async {
loop {
- if let Ok(data) = std::fs::read(path) {
- let results: Value = serde_json::from_slice(&data).unwrap();
+ // A file that doesn't parse yet is still being written by the agent.
+ if let Ok(data) = std::fs::read(path)
+ && let Ok(results) = serde_json::from_slice::<Value>(&data)
+ {
assert!(
results.as_array().unwrap().iter().all(|result| result["isError"] == true
&& result["content"][0]["text"].as_str().unwrap().contains("own chat and threads")),