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
feat: keep agent session resets out of the chat
leepokaia88ce6839269
diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/MirrorDatabaseTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/MirrorDatabaseTest.ktindex ecb4bc35..52883770 100644--- a/apps/android/app/src/androidTest/kotlin/com/codync/android/MirrorDatabaseTest.kt+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/MirrorDatabaseTest.kt@@ -68,12 +68,20 @@ class MirrorDatabaseTest {}@Test fun incompatibleCacheAndDatabaseReplacementRewindSafely() {- mirror.setStamp("old", "2.4/2.4")+ assertFalse(mirror.setStamp("old", "2.4/2.4"))mirror.apply(MirrorEvent.EntryChanged(entry(9)))- mirror.setStamp("old", "2.5/2.4")- assertEquals(0, mirror.snapshot().rev)+ mirror.save(PendingSend("unsent", "bot", text = "message", createdAt = 1))+ mirror.finishHistory("bot")+ assertFalse(mirror.setStamp("old", "2.4/2.4"))assertEquals(1, mirror.snapshot().entries.size)- mirror.setStamp("new", "2.5/2.4")+ // The new host removed "message": the catch-up from 0 brings only what it still has.+ assertTrue(mirror.setStamp("old", "2.5/2.4"))+ assertEquals(0, mirror.snapshot().rev)+ assertFalse(mirror.historyComplete("bot"))+ assertEquals("unsent", mirror.snapshot().pending.single().nonce)+ mirror.apply(MirrorEvent.EntryChanged(Entry("kept", 2, "bot", rev = 10, kind = "user", data = buildJsonObject { put("text", "kept") })))+ assertEquals(listOf("kept"), mirror.snapshot().entries.map { it.id })+ assertTrue(mirror.setStamp("new", "2.5/2.4"))assertEquals(0, mirror.snapshot().rev)assertTrue(mirror.snapshot().entries.isEmpty())}diff --git a/apps/android/app/src/main/kotlin/com/codync/android/AppStoreConnection.kt b/apps/android/app/src/main/kotlin/com/codync/android/AppStoreConnection.ktindex b25ef8b2..667c512e 100644--- a/apps/android/app/src/main/kotlin/com/codync/android/AppStoreConnection.kt+++ b/apps/android/app/src/main/kotlin/com/codync/android/AppStoreConnection.kt@@ -111,12 +111,14 @@ fun AppStore.connect() {// The latest saved copy: its color may have changed since this link opened.val updated = HostClient.hello(active, state.value.computers.firstOrNull { it.id == target.id } ?: target)val hello = active.call("hello").jsonObject- withContext(Dispatchers.IO) {+ val dropped = withContext(Dispatchers.IO) {local.saveComputers(listOf(updated))requireNotNull(database).setStamp(requireNotNull(hello["hostId"]?.jsonPrimitive?.content),BuildConfig.VERSION_NAME + "/" + hello["version"]?.jsonPrimitive?.content)}- mutableState.update { it.copy(computers = listOf(updated)) }+ // Dropped chats page their earlier messages again.+ mutableState.update { it.copy(computers = listOf(updated),+ historyComplete = if (dropped) emptySet() else it.historyComplete) }noteHello(hello)// The event catch-up is ordered by revision; bot revisions can// follow hundreds of historical entries. Load the current rosterdiff --git a/apps/android/app/src/main/kotlin/com/codync/android/ChatRows.kt b/apps/android/app/src/main/kotlin/com/codync/android/ChatRows.ktindex 1a4172f1..2e58ec5c 100644--- a/apps/android/app/src/main/kotlin/com/codync/android/ChatRows.kt+++ b/apps/android/app/src/main/kotlin/com/codync/android/ChatRows.kt@@ -12,13 +12,11 @@ import androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.Spacerimport androidx.compose.foundation.layout.fillMaxWidth-import androidx.compose.foundation.layout.heightimport androidx.compose.foundation.layout.heightInimport androidx.compose.foundation.layout.offsetimport androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.layout.width-import androidx.compose.foundation.layout.widthInimport androidx.compose.foundation.rememberScrollStateimport androidx.compose.foundation.text.selection.SelectionContainerimport androidx.compose.foundation.verticalScroll@@ -312,12 +310,6 @@ internal val Entry.botReactions: Map<String, List<String>> get() =Spacer(Modifier.width(6.dp))Text("$text · %02d:%02d".format(seconds / 60, seconds % 60), style = Type.footnote.monospacedDigit, color = Palette.secondary)}- entry.data.text("style") == "divider" -> Row(Modifier.fillMaxWidth().padding(vertical = 6.dp), verticalAlignment = Alignment.CenterVertically,- horizontalArrangement = Arrangement.spacedBy(10.dp)) {- Box(Modifier.weight(1f).height(1.dp).background(Palette.border))- Text(text, Modifier.widthIn(max = 260.dp), style = Type.caption2, color = Palette.tertiary, textAlign = TextAlign.Center)- Box(Modifier.weight(1f).height(1.dp).background(Palette.border))- }entry.data.text("style") == "error" -> Row(Modifier.fillMaxWidth().clip(RoundedRectangle(12.dp)).background(Palette.danger.copy(alpha = 0.12f)).padding(12.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {Symbol("exclamationmark.triangle.fill", size = 16.dp, tint = Palette.danger)diff --git a/apps/android/app/src/main/kotlin/com/codync/android/MirrorDatabase.kt b/apps/android/app/src/main/kotlin/com/codync/android/MirrorDatabase.ktindex 80dc0cf8..b8d6a929 100644--- a/apps/android/app/src/main/kotlin/com/codync/android/MirrorDatabase.kt+++ b/apps/android/app/src/main/kotlin/com/codync/android/MirrorDatabase.kt@@ -55,11 +55,18 @@ class MirrorDatabase(context: Context, directory: File, computerId: String) :@Synchronized fun revision(): Long = meta(readableDatabase, "rev")?.toLong() ?: 0- @Synchronized fun setStamp(hostId: String, stamp: String) = transaction { db ->- if (meta(db, "hostId")?.let { it != hostId } == true) reset(db)- if (meta(db, "stamp")?.let { it != stamp } == true) setMeta(db, "rev", "0")+ /**+ * Another computer database, app build or host version fetches the conversation again from rev 0, like iOS+ * and desktop: the catch-up brings only each chat's newest entries and never says one is gone, so the held+ * ones go too (unsent messages stay). Returns whether they went.+ */+ @Synchronized fun setStamp(hostId: String, stamp: String): Boolean = transaction { db ->+ val otherHost = meta(db, "hostId")?.let { it != hostId } == true+ val otherStamp = meta(db, "stamp")?.let { it != stamp } == true+ if (otherHost) reset(db) else if (otherStamp) dropConversation(db)setMeta(db, "hostId", hostId)setMeta(db, "stamp", stamp)+ otherHost || otherStamp}@Synchronized fun apply(event: MirrorEvent) = apply(listOf(event))@@ -137,10 +144,14 @@ class MirrorDatabase(context: Context, directory: File, computerId: String) :entry.clientNonce?.takeIf { entry.kind == "user" && it.isNotEmpty() }?.let { db.delete("pending", "nonce=?", arrayOf(it)) }}private fun reset(db: SQLiteDatabase) {- listOf("bots", "entries", "history").forEach { db.delete(it, null, null) }- setMeta(db, "rev", "0")+ db.delete("bots", null, null)+ dropConversation(db)db.delete("meta", "k IN ('usage','screen')", null)}+ private fun dropConversation(db: SQLiteDatabase) {+ listOf("entries", "history").forEach { db.delete(it, null, null) }+ setMeta(db, "rev", "0")+ }private fun bump(db: SQLiteDatabase, rev: Long) = setMeta(db, "rev", maxOf(rev, meta(db, "rev")?.toLong() ?: 0).toString())private fun meta(db: SQLiteDatabase, key: String): String? = db.rawQuery("SELECT v FROM meta WHERE k=?", arrayOf(key)).use {if (it.moveToFirst()) it.getString(0) else null@@ -153,9 +164,9 @@ class MirrorDatabase(context: Context, directory: File, computerId: String) :private fun <T> rows(db: SQLiteDatabase, query: String, decode: (String) -> T): List<T> = db.rawQuery(query, null).use {buildList { while (it.moveToNext()) add(decode(it.getString(0))) }}- private fun transaction(block: (SQLiteDatabase) -> Unit) {+ private fun <T> transaction(block: (SQLiteDatabase) -> T): T {val db = writableDatabasedb.beginTransaction()- try { block(db); db.setTransactionSuccessful() } finally { db.endTransaction() }+ try { return block(db).also { db.setTransactionSuccessful() } } finally { db.endTransaction() }}}diff --git a/apps/desktop/src/renderer/components/Controls.tsx b/apps/desktop/src/renderer/components/Controls.tsxindex 01bc16c6..f44d1790 100644--- a/apps/desktop/src/renderer/components/Controls.tsx+++ b/apps/desktop/src/renderer/components/Controls.tsx@@ -216,9 +216,9 @@ export function CardSection({ title, footer, accessory, children }: { title?: st)}-/** A 1-pixel separator line in the border color; `grow` makes it fill a row. */-export function Hairline({ grow = false, className, style }: { grow?: boolean; className?: string; style?: CSSProperties }) {- return <div className={`hairline${grow ? ' grow' : ''}${className ? ` ${className}` : ''}`} style={style} />+/** A 1-pixel separator line in the border color. */+export function Hairline({ className, style }: { className?: string; style?: CSSProperties }) {+ return <div className={`hairline${className ? ` ${className}` : ''}`} style={style} />}/** A row's title with an optional note under it (rows, fields and switches share it). */diff --git a/apps/desktop/src/renderer/components/controls.css b/apps/desktop/src/renderer/components/controls.cssindex b1d90df2..5eb906bb 100644--- a/apps/desktop/src/renderer/components/controls.css+++ b/apps/desktop/src/renderer/components/controls.css@@ -293,9 +293,6 @@height: 0.5px;}}-.hairline.grow {- flex: 1;-}.hairline.inset {margin: 0 16px;}diff --git a/apps/desktop/src/renderer/views/thread/ChatRows.tsx b/apps/desktop/src/renderer/views/thread/ChatRows.tsxindex 6f86a2e0..efac7eaa 100644--- a/apps/desktop/src/renderer/views/thread/ChatRows.tsx+++ b/apps/desktop/src/renderer/views/thread/ChatRows.tsx@@ -2,7 +2,7 @@ import { FileDownloadCard } from './FileDownloadCard'import { memo, useEffect, useRef, useState } from 'react'import { groupBotReactions, isGroup, isReplyable, isWorking, needsInput, type Bot, type Entry, type ReplyQuote } from '@shared/models'import { BotAvatar } from '../../components/Avatar'-import { Hairline, IconButton } from '../../components/Controls'+import { IconButton } from '../../components/Controls'import { Icon } from '../../components/Icon'import { AnchoredMenu, useContextMenu, type MenuItem, type ReactionPick } from '../../components/Overlay'import { HStack, VStack } from '../../components/Stack'@@ -201,14 +201,6 @@ export function NoticeRow({ entry }: { entry: Entry }) {)}switch (entry.data.style) {- case 'divider':- return (- <HStack gap={10} className="chat-notice-divider">- <Hairline grow />- <Text size="caption2" tone="tertiary" className="chat-notice-divider-text">{text}</Text>- <Hairline grow />- </HStack>- )case 'error':return (<HStack align="flex-start" gap={8} className="chat-notice-error">diff --git a/apps/desktop/src/renderer/views/thread/thread.css b/apps/desktop/src/renderer/views/thread/thread.cssindex fa01636d..da66453a 100644--- a/apps/desktop/src/renderer/views/thread/thread.css+++ b/apps/desktop/src/renderer/views/thread/thread.css@@ -197,13 +197,6 @@.chat-notice {text-align: center;}-.chat-notice-divider {- padding: 6px 0;-}-.chat-notice-divider-text {- text-align: center;- max-width: 260px;-}.chat-notice-error {padding: 12px;border-radius: var(--radius-m);diff --git a/apps/desktop/src/shared/models.ts b/apps/desktop/src/shared/models.tsindex 878fa369..b81a5c02 100644--- a/apps/desktop/src/shared/models.ts+++ b/apps/desktop/src/shared/models.ts@@ -233,7 +233,7 @@ export interface EntryData {detail?: stringcwd?: stringentries?: PlanItem[]- /** notice: info | error | divider */+ /** notice: info | error */style?: stringauthor?: string/** user: the message this one replies to. */diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/EntryData.swift b/apps/ios/Kit/Sources/CodyncKit/Models/EntryData.swiftindex 468e2400..07a5f847 100644--- a/apps/ios/Kit/Sources/CodyncKit/Models/EntryData.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Models/EntryData.swift@@ -27,7 +27,7 @@ public struct EntryData: Codable, Hashable, Sendable {public var detail: String?public var cwd: String?public var entries: [PlanItem]?- /// notice: info | error | divider+ /// notice: info | errorpublic var style: String?/// Structured conversation data added to the existing team-tool notice.public var botMessage: BotMessage?diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swiftindex e2d6f93d..bd60475d 100644--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift@@ -226,19 +226,6 @@ struct NoticeRow: View {@ViewBuilder private func styled(_ text: String) -> some View {switch entry.data.style {- case "divider":- HStack(spacing: 10) {- Rectangle().fill(Palette.border).frame(height: 1)- Text(text)- .font(.caption2)- .foregroundStyle(Palette.tertiary)- .multilineTextAlignment(.center)- .fixedSize(horizontal: false, vertical: true)- .frame(maxWidth: 260)- .layoutPriority(1)- Rectangle().fill(Palette.border).frame(height: 1)- }- .padding(.vertical, 6)case "error":Label {Text(text).font(.footnote).foregroundStyle(Palette.text).textSelection(.enabled)diff --git a/docs/architecture/conversation-runtime.md b/docs/architecture/conversation-runtime.mdindex f7d0bc54..03388f44 100644--- a/docs/architecture/conversation-runtime.md+++ b/docs/architecture/conversation-runtime.md@@ -1,6 +1,6 @@# Conversation runtime-- **Chat ≠ session**: a bot is one endless transcript (SQLite `entries`, ordered by `seq`); the ACP session underneath is resumed with `session/load` or replaced by *New session*.+- **Chat ≠ session**: a bot is one endless transcript (SQLite `entries`, ordered by `seq`); the ACP session underneath is resumed with `session/load` or replaced by *New session*. The chat never says when the session underneath changes (New session, an agent, model or folder change, a failed resume); only a rollover's handoff card mentions a fresh conversation ([context and memory](../features/context-and-memory.md)).- **Agent processes**: a bot's agent starts on its first message and keeps its sessions loaded between messages. A session unused for 30 minutes is closed (agents with `session/close`; a routine run's session as soon as the run ends), and once all of them are idle the agent stops with its process group, as it does right after a routine run when no other session is open; the next message starts it again and loads the session (`agent/bot/lifecycle.rs`). Nothing is released mid-turn or while a queue, approval or request waits. Agents that can't load sessions stay, and so do agents with something running detached in a session of its own, like a dev server from Claude Code's shell tool (stopping the agent would orphan it); MCP servers don't count, even in a process group of their own as Codex starts them. Codex frees a closed session's thread and its MCP servers within about a minute, but codex-acp never closes the thread it titles each new session in, so that thread's MCP servers from the user's Codex config stay until the agent stops ([codex-acp#628](https://github.com/agentclientprotocol/codex-acp/issues/628)). Windows agents are never stopped for idleness: without process groups a dev server can't be told from an MCP server, and stopping ends the whole tree.- **Group chats and replies** are host features every client drives through the same methods (`send` with `replyTo`, `createBot {kind: group}`); clients never route, parse mentions or build quotes themselves. A group is a roster row whose members answer in their own sessions (Grok Bot's room turns); a reply stays in its chat and session, its quote read before its text: [docs/features/groups-and-replies.md](../features/groups-and-replies.md).- **A session that fails** with an internal error its agent gives no category (JSON-RPC `-32603` without `data.errorKind`) is closed right after the turn, when the agent can close and load sessions: Claude's adapter otherwise answers every later prompt on it with "The Claude Agent session has ended". The next message loads it again and the conversation carries on (`acp::may_end_session`).diff --git a/host/src/agent/bot/mod.rs b/host/src/agent/bot/mod.rsindex 4da134e9..8ca16c70 100644--- a/host/src/agent/bot/mod.rs+++ b/host/src/agent/bot/mod.rs@@ -42,13 +42,12 @@ use std::sync::Arc;use std::time::{Duration, Instant};use tokio::sync::mpsc;-/// How a notice renders in the chat (wire values: `info` / `error` / `divider`).+/// How a notice renders in the chat (wire values: `info` / `error`).#[derive(Clone, Copy, Debug, Serialize)]#[serde(rename_all = "lowercase")]pub enum NoticeStyle {Info,Error,- Divider,}pub enum Cmd {diff --git a/host/src/agent/bot/queue.rs b/host/src/agent/bot/queue.rsindex 7d4667b1..46ed4af0 100644--- a/host/src/agent/bot/queue.rs+++ b/host/src/agent/bot/queue.rs@@ -164,13 +164,7 @@ impl Actor {for slot in self.run_slots() {self.set_session(Some(&slot), None);}- if self.session_id.is_some() {- self.forget_session();- self.notice(- "The agent, model, command, folder or memory changed — the agent starts with a fresh context.",- NoticeStyle::Divider,- );- }+ self.forget_session();}pub(super) async fn next_in_queue(&mut self, done_tx: &mpsc::UnboundedSender<Done>) {diff --git a/host/src/agent/bot/session.rs b/host/src/agent/bot/session.rsindex 1672aa2f..fe3c7286 100644--- a/host/src/agent/bot/session.rs+++ b/host/src/agent/bot/session.rs@@ -2,7 +2,7 @@use super::fast_mode::Listing;use super::launch::{claude_meta, launch_commands, select_model, start_agent, system_prompt};-use super::{Actor, Conn, Instructions, NoticeStyle};+use super::{Actor, Conn, Instructions};use crate::agent::acp::{self, Incoming};use crate::agent::own_memory;use crate::chat::{context, memory};@@ -179,10 +179,7 @@ impl Actor {return Ok(());}if !conn.sessions.load {- self.notice(- "This agent can't resume sessions after a restart — starting a fresh one.",- NoticeStyle::Divider,- );+ tracing::info!(bot = %self.cfg.id, "the agent can't resume sessions; starting a fresh one");self.set_session(slot, None);return Box::pin(self.ensure_session(slot)).await;}@@ -223,8 +220,7 @@ impl Actor {return Ok(());}Err(e) => {- tracing::warn!(error = format!("{e:#}"), "session/load failed; starting fresh");- self.notice("Couldn't resume the previous session — starting a fresh one.", NoticeStyle::Divider);+ tracing::warn!(bot = %self.cfg.id, error = format!("{e:#}"), "session/load failed; starting fresh");}}}diff --git a/host/src/store/schema.rs b/host/src/store/schema.rsindex e34aef11..d729ce97 100644--- a/host/src/store/schema.rs+++ b/host/src/store/schema.rs@@ -7,13 +7,14 @@ use std::path::Path;use std::sync::Mutex;/// Current schema version (kv `schema`).-const SCHEMA: i64 = 5;+const SCHEMA: i64 = 6;/// 3: authorized devices (keys, not push tickets) with their push and Live Activity/// tickets. The old ticket-only `devices` table is dropped; phones re-register on connect./// 4: threads (`entries.thread_id`); instruction snapshots are kept per session, so the/// per-bot ones go./// 5: threads merge into their chats (quote replies took their place, see [`migrate_5`]).+/// 6: the dividers that announced a fresh agent session go; the chat no longer shows session resets.fn migrate(c: &Connection) -> Result<()> {let version: i64 =c.query_row("SELECT CAST(v AS INTEGER) FROM kv WHERE k = 'schema'", [], |r| r.get(0)).optional()?.unwrap_or(0);@@ -26,7 +27,10 @@ fn migrate(c: &Connection) -> Result<()> {if version < 4 {migrate_4(c)?;}- migrate_5(c)+ if version < 5 {+ migrate_5(c)?;+ }+ migrate_6(c)}fn migrate_3(c: &Connection) -> Result<()> {@@ -117,6 +121,16 @@ fn migrate_5(c: &Connection) -> Result<()> {Ok(())}+fn migrate_6(c: &Connection) -> Result<()> {+ c.execute_batch(+ "BEGIN;+ DELETE FROM entries WHERE kind = 'notice' AND json_extract(data, '$.style') = 'divider';+ INSERT INTO kv(k, v) VALUES('schema', '6') ON CONFLICT(k) DO UPDATE SET v = '6';+ COMMIT;",+ )?;+ Ok(())+}+impl Store {pub fn open(path: &Path) -> Result<Self> {let c = Connection::open(path)?;@@ -172,12 +186,32 @@ mod tests {}let s = Store::open(&db).unwrap();assert!(s.devices().unwrap().is_empty());- assert_eq!(s.kv_get("schema").as_deref(), Some("5"));+ assert_eq!(s.kv_get("schema").as_deref(), Some("6"));drop(s);let s = Store::open(&db).unwrap();assert!(s.devices().unwrap().is_empty(), "reopening keeps the new table");}+ #[test]+ fn session_reset_dividers_leave_the_chat() {+ let db = temp_db();+ {+ let c = Connection::open(&db).unwrap();+ Store::open(&db).unwrap();+ c.execute_batch(+ "UPDATE kv SET v = '5' WHERE k = 'schema';+ INSERT INTO entries(id, bot_id, rev, kind, turn, data, created_at, updated_at) VALUES+ ('reset', 'b', 1, 'notice', 0, '{\"text\":\"New session\",\"style\":\"divider\"}', 0, 0),+ ('info', 'b', 2, 'notice', 0, '{\"text\":\"Routine · News\"}', 0, 0);",+ )+ .unwrap();+ }+ let s = Store::open(&db).unwrap();+ let chat: Vec<String> = s.history("b", i64::MAX, 10).unwrap().into_iter().map(|e| e.id).collect();+ assert_eq!(chat, ["info"]);+ assert_eq!(s.kv_get("schema").as_deref(), Some("6"));+ }+#[test]fn threads_merge_into_their_chat() {let db = temp_db();diff --git a/host/src/tui/view/transcript.rs b/host/src/tui/view/transcript.rsindex df1a01f1..4d40b8cf 100644--- a/host/src/tui/view/transcript.rs+++ b/host/src/tui/view/transcript.rs@@ -275,11 +275,6 @@ fn entry_lines(out: &mut Built, app: &App, b: &Bot, e: &Entry, info: &HashMap<i6};gap(out);match e.data["style"].as_str() {- Some("divider") => {- let label = format!(" {text} · {} ", clock(e.created_at));- let side = width.saturating_sub(w(&label) + 4);- out.lines.push(Line::from(Span::styled(format!(" ───{label}{}", "─".repeat(side)), t.dim)));- }Some("error") => out.lines.extend(md::wrap(&[Span::styled(text, t.red)],width,diff --git a/host/tests/common/host.rs b/host/tests/common/host.rsindex 5e1ba83f..d572ee95 100644--- a/host/tests/common/host.rs+++ b/host/tests/common/host.rs@@ -123,10 +123,15 @@ impl Host {}}+ /// The JSON lines a fixture agent logged to `file` in a bot's workspace.+ pub fn log(&self, bot: &str, file: &str) -> Vec<Value> {+ let log = std::fs::read_to_string(self.home.join("bots").join(bot).join("workspace").join(file)).unwrap();+ log.lines().map(|l| serde_json::from_str::<Value>(l).unwrap()).collect()+ }+/// The requests `instructions_agent.py` logged in a bot's workspace.pub fn requests(&self, bot: &str, method: &str) -> Vec<Value> {- let log = std::fs::read_to_string(self.home.join("bots").join(bot).join("workspace/requests.jsonl")).unwrap();- log.lines().map(|l| serde_json::from_str::<Value>(l).unwrap()).filter(|r| r["method"] == method).collect()+ self.log(bot, "requests.jsonl").into_iter().filter(|r| r["method"] == method).collect()}/// The text of every prompt a bot's agent got, oldest first.diff --git a/host/tests/manage_e2e.rs b/host/tests/manage_e2e.rsindex 8935a1d2..b78dacce 100644--- a/host/tests/manage_e2e.rs+++ b/host/tests/manage_e2e.rs@@ -78,7 +78,11 @@ async fn a_lead_creates_a_bot_the_user_allowed_and_not_one_change_they_denied()}).await;assert!(reply.starts_with("Done: "), "{reply}");- wait(&host, &lead, |e| e["data"]["text"].as_str().is_some_and(|t| t.contains("starts with a fresh context"))).await;+ // Its next message opens a new session, and the chat says nothing about it.+ let new_sessions = || host.log(&lead, "sessions.jsonl").iter().filter(|r| r["method"] == "session/new").count();+ let before = new_sessions();+ host.reply(&lead, "hi").await;+ assert_eq!(new_sessions(), before + 1);let sync = host.snapshot().await;let lead_bot = sync["bots"].as_array().unwrap().iter().find(|b| b["id"] == lead).unwrap();assert_eq!(lead_bot["model"], "fixture-2");