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.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
fix(host): say Stopped when a stopped turn's agent ends it normally
leepokaidced4b9e3c10
diff --git a/host/src/agent/bot/turn.rs b/host/src/agent/bot/turn.rsindex cbe7ea03..39ee6eef 100644--- a/host/src/agent/bot/turn.rs+++ b/host/src/agent/bot/turn.rs@@ -298,7 +298,9 @@ impl Actor {self.failure_notice(e, &format!("The agent failed: {e}{detail}"), "error");}}+ // A stopped turn says so even when its agent still ended it normally: its reply is withheld above.(_, "cancelled") | (Err(_), _) => self.stop_notice("Stopped.", "cancelled"),+ (Ok(_), _) if self.stop_requested => self.stop_notice("Stopped.", "cancelled"),(_, "max_tokens") => self.stop_notice("The agent hit its output limit.", "max_tokens"),(_, "max_turn_requests") => {self.stop_notice("The agent hit its step limit for this turn.", "max_turn_requests");diff --git a/host/tests/fixtures/send_cli_agent.py b/host/tests/fixtures/send_cli_agent.pyindex 08b8430f..dca747ad 100644--- a/host/tests/fixtures/send_cli_agent.py+++ b/host/tests/fixtures/send_cli_agent.py@@ -11,6 +11,7 @@ sys.stdout.reconfigure(encoding="utf-8")lock = threading.Lock()permissions = {}prompts = {}+finishers = set()sessions = 0@@ -35,7 +36,9 @@ def turn(message):mode = modes[-1] if modes else "normal"event = threading.Event()prompts[rid] = (session, event)- if mode == "hang":+ if mode in {"hang", "finish_on_cancel"}:+ if mode == "finish_on_cancel":+ finishers.add(rid)update(session, "agent_thought_chunk", "Waiting indefinitely")event.wait(120)return@@ -93,5 +96,8 @@ for line in sys.stdin:for rid, (session, event) in list(prompts.items()):if session == message["params"]["sessionId"]:prompts.pop(rid, None)- send({"id": rid, "result": {"stopReason": "cancelled"}})+ # Some agents finish the turn normally when asked to cancel.+ if rid in finishers:+ update(session, "agent_message_chunk", "Finished anyway")+ send({"id": rid, "result": {"stopReason": "end_turn" if rid in finishers else "cancelled"}})event.set()diff --git a/host/tests/send_cli_e2e.rs b/host/tests/send_cli_e2e.rsindex 4bb7e33d..4273b4ad 100644--- a/host/tests/send_cli_e2e.rs+++ b/host/tests/send_cli_e2e.rs@@ -82,6 +82,16 @@ async fn returns_failure_for_limits_refusals_agent_errors_and_a_stopped_turn() {let result = json_output(&output, 1);assert_eq!(result["status"], "failed");assert_eq!(result["stopReason"], "cancelled");+ // An agent that ends the stopped turn normally: still a stop, and its late reply isn't the answer.+ let earlier = host.entry(&bot, |e| e["data"]["text"] == "Waiting indefinitely").await["seq"].as_i64();+ let child = host.command(&["--bot", &bot, "--wait", "--json", "CLI_MODE=finish_on_cancel"]).spawn().unwrap();+ host.entry(&bot, |e| e["data"]["text"] == "Waiting indefinitely" && e["seq"].as_i64() > earlier).await;+ host.call("stop", json!({"botId":bot})).await;+ let output = tokio::time::timeout(Duration::from_secs(30), child.wait_with_output()).await.unwrap().unwrap();+ let result = json_output(&output, 1);+ assert_eq!(result["status"], "failed");+ assert_eq!(result["stopReason"], "cancelled");+ assert!(result.get("reply").is_none());}#[tokio::test]