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: list /fast before a bot's agent has said whether it offers Fast mode

leepokaie8f33308772d
diff --git a/apps/desktop/src/renderer/views/thread/slash-commands.test.ts b/apps/desktop/src/renderer/views/thread/slash-commands.test.ts
index c730df7c..3a54959e 100644
--- a/apps/desktop/src/renderer/views/thread/slash-commands.test.ts
+++ b/apps/desktop/src/renderer/views/thread/slash-commands.test.ts
@@ -22,7 +22,8 @@ test('built-in commands come first, then only the bot\'s own skills, by name or
assert.deepEqual(slashCommands(bot, 'review', installed).map((c) => c.name), ['code-review'])
assert.deepEqual(slashCommands(bot, 'session', installed).map((c) => c.name), ['new'])
assert.deepEqual(slashCommands(normalizeBot({ id: 'b', skills: ['pdf'] }), 'xl', installed), [])
- assert.deepEqual(slashCommands(normalizeBot({ id: 'b' }), '', []).map((c) => c.name), ['new'], 'no Fast mode on offer')
+ assert.deepEqual(slashCommands(normalizeBot({ id: 'b' }), '', []).map((c) => c.name), ['fast', 'new'], 'offered until the agent says otherwise')
+ assert.deepEqual(slashCommands(normalizeBot({ id: 'b', fastModeSupport: 'unsupported' }), '', []).map((c) => c.name), ['new'], 'no Fast mode on offer')
assert.deepEqual(slashCommands(normalizeBot({ id: 'g', kind: 'group', fastModeSupport: 'offered' }), '', installed), [])
})
@@ -31,11 +32,11 @@ test('sending just a built-in command runs it; anything else is a message', () =
assert.equal(builtInCommand(bot, '/fast ')?.action.kind, 'fast')
assert.equal(builtInCommand(bot, '/new')?.action.kind, 'newSession')
assert.equal(builtInCommand(bot, '/fast please'), null)
- assert.equal(builtInCommand(normalizeBot({ id: 'b' }), '/fast'), null, 'without Fast mode it reaches the agent')
+ assert.equal(builtInCommand(normalizeBot({ id: 'b', fastModeSupport: 'unsupported' }), '/fast'), null, 'without Fast mode it reaches the agent')
})
test('Return runs the highlighted command, but sends a skill already typed out', () => {
- const bot = normalizeBot({ id: 'b', skills: ['pdf'] })
+ const bot = normalizeBot({ id: 'b', skills: ['pdf'], fastModeSupport: 'unsupported' })
const [newSession, pdf] = slashCommands(bot, '', installed)
assert.equal(returnRuns(newSession!, '/'), true)
assert.equal(returnRuns(pdf!, '/pd'), true)
diff --git a/apps/desktop/src/shared/fast-mode.ts b/apps/desktop/src/shared/fast-mode.ts
index 677cb444..7917cae7 100644
--- a/apps/desktop/src/shared/fast-mode.ts
+++ b/apps/desktop/src/shared/fast-mode.ts
@@ -4,10 +4,13 @@ import type { Bot } from './models'
export type FastModeState = 'on' | 'off' | 'refused'
-/** An agent bot whose agent offers Fast mode, or one that has it on (so it can be turned off). */
+/**
+ * An agent bot unless its agent said it has no Fast mode (an unknown one may: its first session
+ * settles it), or one that has it on (so it can be turned off).
+ */
export function fastModeShown(bot: Bot | null): boolean {
if (!bot || bot.kind === 'group') return false
- return bot.fastMode || bot.fastModeSupport === 'offered' || bot.fastModeSupport === 'refused'
+ return bot.fastMode || bot.fastModeSupport !== 'unsupported'
}
export function fastModeState(bot: Bot): FastModeState {
diff --git a/apps/desktop/src/shared/models.test.ts b/apps/desktop/src/shared/models.test.ts
index 56dad919..3e3b95cb 100644
--- a/apps/desktop/src/shared/models.test.ts
+++ b/apps/desktop/src/shared/models.test.ts
@@ -12,9 +12,10 @@ test('a host without Fast mode reads as off', () => {
assert.equal(normalizeBot({ id: 'b' }).fastMode, false)
})
-test('the composer offers Fast mode once the agent does, and while it is on', async () => {
+test('the composer offers Fast mode until the agent says it has none, and while it is on', async () => {
const { fastModeShown, fastModeState, fastModeDetail } = await import('./fast-mode.ts')
- assert.equal(fastModeShown(normalizeBot({ id: 'b' })), false)
+ assert.equal(fastModeShown(normalizeBot({ id: 'b' })), true)
+ assert.equal(fastModeShown(normalizeBot({ id: 'b', fastModeSupport: 'unsupported' })), false)
assert.equal(fastModeShown(normalizeBot({ id: 'b', fastModeSupport: 'offered' })), true)
assert.equal(fastModeShown(normalizeBot({ id: 'b', fastMode: true, fastModeSupport: 'unsupported' })), true)
assert.equal(fastModeShown(normalizeBot({ id: 'g', kind: 'group', fastModeSupport: 'offered' })), false)
diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/Bot+FastMode.swift b/apps/ios/Kit/Sources/CodyncKit/Models/Bot+FastMode.swift
index a64fdd15..e3fd15ab 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Models/Bot+FastMode.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Models/Bot+FastMode.swift
@@ -5,9 +5,10 @@ import Foundation
public extension Bot {
enum FastModeState: Sendable { case on, off, refused }
- /// An agent bot whose agent offers Fast mode, or one that has it on (so it can be turned off).
+ /// An agent bot unless its agent said it has no Fast mode (an unknown one may: its first session
+ /// settles it), or one that has it on (so it can be turned off).
var fastModeShown: Bool {
- !isGroup && (fastMode || fastModeSupport == "offered" || fastModeSupport == "refused")
+ !isGroup && (fastMode || fastModeSupport != "unsupported")
}
var fastModeState: FastModeState {
diff --git a/apps/ios/Kit/Tests/CodyncKitTests/AgentModelsTests.swift b/apps/ios/Kit/Tests/CodyncKitTests/AgentModelsTests.swift
index 80ea1b82..7d04f660 100644
--- a/apps/ios/Kit/Tests/CodyncKitTests/AgentModelsTests.swift
+++ b/apps/ios/Kit/Tests/CodyncKitTests/AgentModelsTests.swift
@@ -51,9 +51,10 @@ import Testing
#expect(!older.fastMode)
}
-@Test func composerOffersFastModeOnceTheAgentDoes() throws {
+@Test func composerOffersFastModeUntilTheAgentSaysItHasNone() throws {
func bot(_ json: String) throws -> Bot { try JSONDecoder().decode(Bot.self, from: Data(json.utf8)) }
- #expect(try !bot(#"{"id":"b"}"#).fastModeShown)
+ #expect(try bot(#"{"id":"b"}"#).fastModeShown)
+ #expect(try !bot(#"{"id":"b","fastModeSupport":"unsupported"}"#).fastModeShown)
#expect(try bot(#"{"id":"b","fastModeSupport":"offered"}"#).fastModeShown)
#expect(try bot(#"{"id":"b","fastMode":true,"fastModeSupport":"unsupported"}"#).fastModeShown)
#expect(try !bot(#"{"id":"g","kind":"group","fastModeSupport":"offered"}"#).fastModeShown)
diff --git a/apps/ios/Kit/Tests/CodyncUITests/SlashCommandsTests.swift b/apps/ios/Kit/Tests/CodyncUITests/SlashCommandsTests.swift
index b5d246fb..9b9a3cf8 100644
--- a/apps/ios/Kit/Tests/CodyncUITests/SlashCommandsTests.swift
+++ b/apps/ios/Kit/Tests/CodyncUITests/SlashCommandsTests.swift
@@ -22,7 +22,8 @@ private let installed = [("pdf", "PDF"), ("code-review", "Code Review"), ("xlsx"
#expect(SlashCommands.list(for: offered, query: "review", skills: installed).map(\.name) == ["code-review"])
#expect(SlashCommands.list(for: offered, query: "session", skills: installed).map(\.name) == ["new"])
#expect(SlashCommands.list(for: try bot(#"{"id":"b","skills":["pdf"]}"#), query: "xl", skills: installed).isEmpty)
- #expect(SlashCommands.list(for: try bot(#"{"id":"b"}"#), query: "", skills: []).map(\.name) == ["new"], "no Fast mode on offer")
+ #expect(SlashCommands.list(for: try bot(#"{"id":"b"}"#), query: "", skills: []).map(\.name) == ["fast", "new"], "offered until the agent says otherwise")
+ #expect(SlashCommands.list(for: try bot(#"{"id":"b","fastModeSupport":"unsupported"}"#), query: "", skills: []).map(\.name) == ["new"], "no Fast mode on offer")
#expect(SlashCommands.list(for: try bot(#"{"id":"g","kind":"group","fastModeSupport":"offered"}"#), query: "", skills: installed).isEmpty)
}
@@ -31,5 +32,5 @@ private let installed = [("pdf", "PDF"), ("code-review", "Code Review"), ("xlsx"
#expect(SlashCommands.builtIn(for: offered, draft: "/fast ")?.action == .fast)
#expect(SlashCommands.builtIn(for: offered, draft: "/new")?.action == .newSession)
#expect(SlashCommands.builtIn(for: offered, draft: "/fast please") == nil)
- #expect(SlashCommands.builtIn(for: try bot(#"{"id":"b"}"#), draft: "/fast") == nil, "without Fast mode it reaches the agent")
+ #expect(SlashCommands.builtIn(for: try bot(#"{"id":"b","fastModeSupport":"unsupported"}"#), draft: "/fast") == nil, "without Fast mode it reaches the agent")
}
diff --git a/docs/features/marketplace.md b/docs/features/marketplace.md
index 7fd68eac..529e594f 100644
--- a/docs/features/marketplace.md
+++ b/docs/features/marketplace.md
@@ -78,14 +78,14 @@ The bot's runtime carries what the agent says (`fastModeSupport`, `fastModeIssue
| `fastModeSupport` | Meaning |
|---|---|
-| `unknown` | No session has listed its options yet. |
+| `unknown` | No session has listed its options yet. A session that lists no config options at all settles it as `unsupported`. |
| `offered` | The agent offers it for the session's model. |
| `unsupported` | The session's model doesn't (the chat gets an info notice while the bot asks for it). |
| `refused` | The agent turned it off right after the bot asked, or despite the switch: Claude does this for an account without extra usage and appends the reason to the option's description, which becomes `fastModeIssue`. The host stops asking until the user changes the setting or the host restarts. |
`offered` and `unsupported` are kept across host restarts (`fast-mode.<bot>` in the kv store); a refusal isn't, so a new host asks again.
-Clients show Fast mode for an agent bot whose runtime says `offered` or `refused`, or while it's on (so it can be turned off); never for a group:
+Clients show Fast mode for an agent bot unless its runtime says `unsupported` (an `unknown` bot may offer it; its first session settles it), and always while it's on (so it can be turned off); never for a group:
- Composer: the `/fast` [command](#commands), not a button. The terminal UI also shows `⚡ fast` or `⚡ refused` in the chat header.
- Bot settings: a Fast mode switch row under Model when the agent's model list offers it (never for a custom command), when the bot's own sessions do, or while it's on. While refused, its detail gives the reason. The terminal UI form always lists the field and notes when the agent doesn't offer it.
diff --git a/host/src/agent/bot/fast_mode.rs b/host/src/agent/bot/fast_mode.rs
index 2809f300..927f88d1 100644
--- a/host/src/agent/bot/fast_mode.rs
+++ b/host/src/agent/bot/fast_mode.rs
@@ -5,12 +5,26 @@ use super::{Actor, NoticeStyle};
use crate::agent::config::{FastModeSupport, fast_mode_change, fast_mode_config, fast_mode_on, fast_mode_refusal};
use serde_json::{Value, json};
+/// Where a session's config options come from.
+#[derive(Clone, Copy, PartialEq, Eq)]
+pub(super) enum Listing {
+ /// `session/new`, `session/load` or `session/fork`.
+ Session,
+ /// The answer to our own Fast mode switch.
+ Switch,
+ /// A `config_option_update`.
+ Update,
+}
+
impl Actor {
/// Records a session's options from an agent answer or a `config_option_update`.
- /// `requested`: the answer to our own switch.
- pub(super) fn note_options(&mut self, sid: &str, options: &Value, requested: bool) {
- // An answer without config options says nothing about Fast mode.
+ pub(super) fn note_options(&mut self, sid: &str, options: &Value, listing: Listing) {
if !options["configOptions"].is_array() {
+ // A session without config options has no Fast mode to offer; other answers that
+ // leave them out say nothing, and neither overrides what the agent listed before.
+ if listing == Listing::Session && self.fast_support == FastModeSupport::Unknown {
+ self.publish_fast_support(FastModeSupport::Unsupported);
+ }
return;
}
let Some(conn) = self.conn.as_mut() else { return };
@@ -19,7 +33,7 @@ impl Actor {
let support = match &option {
None => FastModeSupport::Unsupported,
// Turned off right after it was on, or despite our asking: the agent refused it.
- Some(o) if self.cfg.fast_mode && !fast_mode_on(o) && (requested || was_on) => {
+ Some(o) if self.cfg.fast_mode && !fast_mode_on(o) && (listing == Listing::Switch || was_on) => {
FastModeSupport::Refused(fast_mode_refusal(o))
}
Some(_) => FastModeSupport::Offered,
@@ -42,7 +56,7 @@ impl Actor {
let (Some(config_id), Some(value)) = (option["id"].as_str(), fast_mode_change(option, on)) else { return };
let params = json!({"sessionId": sid, "configId": config_id, "value": value});
match self.session_request("session/set_config_option", params).await {
- Ok(answer) => self.note_options(sid, &answer, true),
+ Ok(answer) => self.note_options(sid, &answer, Listing::Switch),
Err(error) => {
tracing::warn!(bot = %self.cfg.id, error = format!("{error:#}"), "couldn't set Fast mode");
self.notice(&format!("Couldn't change Fast mode: {error:#}"), NoticeStyle::Info);
diff --git a/host/src/agent/bot/session.rs b/host/src/agent/bot/session.rs
index d59e0780..007a8a7c 100644
--- a/host/src/agent/bot/session.rs
+++ b/host/src/agent/bot/session.rs
@@ -1,5 +1,6 @@
//! The agent process and its ACP sessions: launch, handshake, new/load/fork, thread sessions.
+use super::fast_mode::Listing;
use super::{Actor, Conn, NoticeStyle, SessionCaps};
use crate::agent::acp::{self, Acp, Incoming};
use crate::chat::context;
@@ -198,7 +199,7 @@ impl Actor {
{
conn.loaded.insert(sid.clone(), Instant::now());
self.set_session(slot, Some(&sid));
- self.note_options(&sid, &res, false);
+ self.note_options(&sid, &res, Listing::Session);
forked = true;
} else {
tracing::warn!(bot = %self.cfg.id, "session/fork failed; the thread starts fresh");
@@ -254,7 +255,7 @@ impl Actor {
res
};
conn.loaded.insert(sid.clone(), Instant::now());
- self.note_options(&sid, &res, false);
+ self.note_options(&sid, &res, Listing::Session);
if let Some(s) = snapshot {
// Its system prompt now names the bot as rendered.
context::mark_announced(&self.hub.store, &self.cfg.id, &s, s.system_identity.clone())?;
@@ -283,7 +284,7 @@ impl Actor {
let sid = res["sessionId"].as_str().ok_or_else(|| anyhow!("agent returned no sessionId"))?.to_owned();
conn.loaded.insert(sid.clone(), Instant::now());
let options = select_model(&conn.acp, &res, &sid, &self.cfg).await?;
- self.note_options(&sid, &options, false);
+ self.note_options(&sid, &options, Listing::Session);
self.set_session(slot, Some(&sid));
self.session_fresh = true;
self.turn_session = Some(sid.clone());
diff --git a/host/src/agent/bot/updates.rs b/host/src/agent/bot/updates.rs
index 59978108..94fb7bf5 100644
--- a/host/src/agent/bot/updates.rs
+++ b/host/src/agent/bot/updates.rs
@@ -1,5 +1,6 @@
//! Agent → client: `session/update`s, permission requests and streamed text mapped onto entries.
+use super::fast_mode::Listing;
use super::{Actor, NoticeStyle, Seg, SegKind};
use crate::agent::acp::{self, Incoming};
use crate::chat::context;
@@ -27,7 +28,7 @@ impl Actor {
&& params["update"]["sessionUpdate"] == "config_option_update"
&& let Some(sid) = params["sessionId"].as_str()
{
- self.note_options(sid, &params["update"], false);
+ self.note_options(sid, &params["update"], Listing::Update);
} else if method == "session/update"
&& params["sessionId"].as_str() == self.turn_session.as_deref()
&& self.turn.is_some()
diff --git a/host/src/tui/app/model.rs b/host/src/tui/app/model.rs
index 2128f7ef..6bc81f7c 100644
--- a/host/src/tui/app/model.rs
+++ b/host/src/tui/app/model.rs
@@ -158,9 +158,10 @@ impl AgentModel {
}
impl Bot {
- /// An agent bot whose agent offers Fast mode, or one that has it on (so it can be turned off).
+ /// An agent bot unless its agent said it has no Fast mode (an unknown one may: its first
+ /// session settles it), or one that has it on (so it can be turned off).
pub fn fast_shown(&self) -> bool {
- !self.group && (self.fast_mode || self.fast_support == "offered" || self.fast_support == "refused")
+ !self.group && (self.fast_mode || self.fast_support != "unsupported")
}
/// Why Fast mode isn't in effect, when the agent turned it off itself.
diff --git a/host/src/tui/app/slash.rs b/host/src/tui/app/slash.rs
index 9681e585..58d99d77 100644
--- a/host/src/tui/app/slash.rs
+++ b/host/src/tui/app/slash.rs
@@ -179,8 +179,10 @@ mod tests {
assert_eq!(names(&app), ["fast", "new", "pdf", "docx"], "only skills the bot has on");
app.drafts.insert("b".into(), super::Editor::with("/session"));
assert_eq!(names(&app), ["new"], "titles match too");
- app.bots.get_mut("b").expect("the bot").fast_support = "unsupported".into();
+ app.bots.get_mut("b").expect("the bot").fast_support = "unknown".into();
app.drafts.insert("b".into(), super::Editor::with("/"));
+ assert_eq!(names(&app), ["fast", "new", "pdf", "docx"], "offered until the agent says otherwise");
+ app.bots.get_mut("b").expect("the bot").fast_support = "unsupported".into();
assert_eq!(names(&app), ["new", "pdf", "docx"], "no Fast mode on offer");
}
diff --git a/host/tests/fixtures/fast_mode_agent.py b/host/tests/fixtures/fast_mode_agent.py
index 90926c43..80320949 100644
--- a/host/tests/fixtures/fast_mode_agent.py
+++ b/host/tests/fixtures/fast_mode_agent.py
@@ -2,7 +2,8 @@
every new process. It resumes sessions, logs session calls to calls.jsonl in its
folder, and answers each prompt with its speed and the prompt text. With a `refuse`
file in its folder it turns Fast mode back off during a prompt, the way Claude does
-for an account without extra usage."""
+for an account without extra usage. With a `plain` file its sessions list no config
+options at all."""
import json
import os
@@ -38,7 +39,8 @@ for line in sys.stdin:
send({"id": rid, "result": {"protocolVersion": 1, "agentCapabilities": {"loadSession": True}}})
elif method in ("session/new", "session/load"):
log({"method": method})
- send({"id": rid, "result": {"sessionId": "s1", **options()}})
+ listed = {} if os.path.exists("plain") else options()
+ send({"id": rid, "result": {"sessionId": "s1", **listed}})
elif method == "session/set_config_option":
log({"method": method, "configId": params["configId"], "value": params["value"]})
fast = params["value"]
diff --git a/host/tests/turns_e2e.rs b/host/tests/turns_e2e.rs
index 95e6dc8f..38605aad 100644
--- a/host/tests/turns_e2e.rs
+++ b/host/tests/turns_e2e.rs
@@ -181,6 +181,22 @@ async fn fast_mode_switches_live_sessions_without_a_restart() {
assert_eq!((log.matches(FAST_ON).count(), log.matches(FAST_OFF).count()), (2, 1), "{log}");
}
+#[tokio::test]
+async fn an_agent_without_config_options_has_no_fast_mode() {
+ if python_missing() {
+ return;
+ }
+ let host = Host::start().await;
+ let bot = host.bot("Plain", "tests/fixtures/fast_mode_agent.py").await;
+ std::fs::write(host.home.join("Plain").join("plain"), "").unwrap();
+ let support = || async { common::snapshot(&host.base, &host.token).await["bots"][0]["fastModeSupport"].clone() };
+ assert_eq!(support().await, "unknown", "clients offer /fast until a session says");
+
+ host.call("send", json!({"botId": bot, "text": "one"})).await;
+ host.wait_for(&bot, Duration::from_secs(60), speed_reply("fast off", "one")).await;
+ assert_eq!(support().await, "unsupported");
+}
+
#[tokio::test]
async fn a_refused_fast_mode_is_reported_and_not_asked_for_again() {
if python_missing() {