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.

fix(host): send one completion alert per finished task

leepokaia364e8a2cd41
diff --git a/docs/design/push-and-live-activity.md b/docs/design/push-and-live-activity.md
index f0d0de75..bee1467d 100644
--- a/docs/design/push-and-live-activity.md
+++ b/docs/design/push-and-live-activity.md
@@ -9,8 +9,8 @@ Updated: 2026-09-27. This describes the implemented notification contract and it
| A task is sent from this iPhone | No alert | Start one activity for this bot |
| Working | No alert for each tool call | Bot identity and working orb |
| Input or permission needed | Bot name, “Response needed”, request summary; “Review request” action | Needs you; keep the activity alive |
-| Completed | Bot name, “Task complete”, final reply preview; “Open conversation” action | Done, then dismiss after 60 seconds |
-| Failed | Bot name, “Task failed”, failure summary; “Open conversation” action | Error state, then dismiss after 60 seconds |
+| Completed (sent once the last queued message is answered) | Bot name, “Task complete”, final reply preview; “Open conversation” action | Done, then dismiss after 60 seconds |
+| Failed (an error, or the turn stopped short: output/step limit, refusal) | Bot name, “Task failed”, failure summary; “Open conversation” action | Error state, then dismiss after 60 seconds |
| No fresh update for 15 minutes | No synthetic failure alert | Update delayed; never infer completion |
The encrypted title is limited to 80 characters and the body to 400 characters. The body is an excerpt of the agent's final answer, not a newly generated summary. System notification previews, text truncation, Focus, sounds and delivery timing remain controlled by iOS. There is no invented completion percentage or per-tool notification stream.
diff --git a/host/src/agent/bot.rs b/host/src/agent/bot.rs
index 43a054cc..66bb5afc 100644
--- a/host/src/agent/bot.rs
+++ b/host/src/agent/bot.rs
@@ -1118,17 +1118,17 @@ impl Actor {
});
self.hub.team.cancel_from(&self.cfg.id);
// A room turn's news comes from the group once the room is done (see `group`).
- if !self.stop_requested && !delegated && !grouped {
- let body =
- final_text.unwrap_or_else(|| if failed { "The agent failed.".into() } else { "Finished.".into() });
- push::notify(
- &self.hub,
- &self.cfg,
- None,
- &self.cfg.name,
- &body,
- if failed { AlertKind::Failed } else { AlertKind::Done },
- );
+ let more = self.queue.iter().any(|q| matches!(q, Queued::User { .. }));
+ if !self.stop_requested
+ && !delegated
+ && !grouped
+ && let Some(kind) = turn_alert(failed, &stop_reason, more)
+ {
+ let body = final_text.unwrap_or_else(|| match kind {
+ AlertKind::Done => "Finished.".into(),
+ _ => "The agent didn't finish.".into(),
+ });
+ push::notify(&self.hub, &self.cfg, None, &self.cfg.name, &body, kind);
}
}
@@ -1554,8 +1554,26 @@ pub fn diff_summary(path: &str, old: &str, new: &str) -> Value {
})
}
+/// A finished turn alerts once the user's work is done: not while their next message
+/// is already queued. A turn that ended short of `end_turn` always reports the failure.
+fn turn_alert(failed: bool, stop_reason: &str, more: bool) -> Option<AlertKind> {
+ if failed || !matches!(stop_reason, "end_turn" | "cancelled") {
+ return Some(AlertKind::Failed);
+ }
+ (stop_reason == "end_turn" && !more).then_some(AlertKind::Done)
+}
+
#[cfg(test)]
mod tests {
+ #[test]
+ fn only_finished_tasks_alert() {
+ assert_eq!(turn_alert(false, "end_turn", false), Some(AlertKind::Done));
+ assert_eq!(turn_alert(false, "end_turn", true), None, "next message queued");
+ assert_eq!(turn_alert(false, "cancelled", false), None);
+ assert_eq!(turn_alert(false, "max_turn_requests", false), Some(AlertKind::Failed));
+ assert_eq!(turn_alert(true, "error", true), Some(AlertKind::Failed));
+ }
+
use super::*;
#[test]