Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
Recognise stall stops by turn_stalled meta, wording only for old rows
Pixel (kwant bot)37bb90222ccb
diff --git a/frontend/src/interruptions.ts b/frontend/src/interruptions.tsindex bc5e308f..b31d3f2a 100644--- a/frontend/src/interruptions.ts+++ b/frontend/src/interruptions.ts@@ -1,6 +1,6 @@// Replies that ended without an answer: cut off by a restart (system note with-// `turn_interrupted` meta) or stopped by the stall watchdog (the bot's own "⚠️ [Name] The model-// sent nothing for N s" message). Both get a notice with Retry, which resends the person's message.+// `turn_interrupted` meta) or stopped by the stall watchdog (the bot's own message with+// `turn_stalled` meta). Both get a notice with Retry, which resends the person's message.import type { ChatMessage } from './components/ChatView';import { AttachmentRef, parseAttachments } from './attachments';import { parseMetaObject } from './questions';@@ -12,7 +12,7 @@ export interface Interruption {secs?: number;}-// Written by routes.rs when the stall watchdog fires; there is no meta on that message.+// Rows saved before the watchdog tagged its message with `turn_stalled` meta carry only this text.const STALL_RE = /^⚠️ \[(.+?)\] The model sent nothing for (\d+) s, so this reply was stopped\./;export function parseInterruption(msg: ChatMessage): Interruption | null {@@ -23,6 +23,13 @@ export function parseInterruption(msg: ChatMessage): Interruption | null {return { kind: 'restart', botName: name };}if (msg.sender_role === 'kwant') {+ const m = parseMetaObject(msg.meta);+ if (m?.kind === 'turn_stalled') {+ if (m.stalled !== true) return null;+ const name = typeof m.kwant_name === 'string' && m.kwant_name.trim() ? m.kwant_name : msg.sender_id || 'The bot';+ const secs = typeof m.stall_secs === 'number' && m.stall_secs > 0 ? m.stall_secs : undefined;+ return { kind: 'stall', botName: name, secs };+ }const s = STALL_RE.exec(msg.text.trim());if (s) return { kind: 'stall', botName: s[1], secs: Number(s[2]) };}@@ -32,7 +39,9 @@ export function parseInterruption(msg: ChatMessage): Interruption | null {export function interruptionText(i: Interruption): string {return i.kind === 'restart'? `${i.botName}'s reply was cut off when the app restarted.`- : `${i.botName} sent nothing for ${i.secs} s, so the reply was stopped.`;+ : i.secs+ ? `${i.botName} sent nothing for ${i.secs} s, so the reply was stopped.`+ : `${i.botName} went quiet, so the reply was stopped.`;}export interface RetryTarget {diff --git a/frontend/tests/interruptions.test.mjs b/frontend/tests/interruptions.test.mjsindex fb9aa8e7..cf0aa310 100644--- a/frontend/tests/interruptions.test.mjs+++ b/frontend/tests/interruptions.test.mjs@@ -19,7 +19,15 @@ const restartNote = (id, name = 'Architect') => ({text: `This reply from ${name} was interrupted by a restart. Send your message again to retry.`,meta: JSON.stringify({ kind: 'turn_interrupted', interrupted: true, kwant_id: 'k1', kwant_name: name, turn_id: 't1', started_at: '2026-10-21T19:00:00Z' }),});-// The stall watchdog's message in routes.rs (saved as the bot's reply, no meta).+// The stall watchdog's message in routes.rs (saved as the bot's reply with turn_stalled meta).+const taggedStall = (id, name = 'Writer', secs = 120, text = 'anything') => ({+ id,+ sender_role: 'kwant',+ sender_id: name,+ text,+ meta: JSON.stringify({ kind: 'turn_stalled', stalled: true, kwant_id: 'k2', kwant_name: name, stall_secs: secs }),+});+// Older rows, saved before the watchdog tagged its message: text only.const stallNote = (id, name = 'Writer', secs = 120) => ({id,sender_role: 'kwant',@@ -39,6 +47,26 @@ test('recognises restart and stall notices, and nothing else', () => {assert.equal(m.parseInterruption({ ...stallNote('s'), sender_role: 'user' }), null);});+test('stall stops are recognised by meta first, wording only as a fallback for old rows', () => {+ // Tagged: found even if the wording changes.+ assert.deepEqual(m.parseInterruption(taggedStall('t1', 'TechLead', 45, 'Reply stopped (reworded).')), { kind: 'stall', botName: 'TechLead', secs: 45 });+ // Meta wins over the text: an untagged-looking text with stalled:false is not a notice.+ assert.equal(+ m.parseInterruption({ ...stallNote('t2'), meta: JSON.stringify({ kind: 'turn_stalled', stalled: false }) }),+ null,+ );+ // Missing secs or name: still a notice, with gentler wording.+ const bare = m.parseInterruption({ ...taggedStall('t3', 'Lead'), meta: JSON.stringify({ kind: 'turn_stalled', stalled: true }) });+ assert.deepEqual(bare, { kind: 'stall', botName: 'Lead', secs: undefined });+ assert.equal(m.interruptionText(bare), 'Lead went quiet, so the reply was stopped.');+ // Old row without meta: the wording match still works.+ assert.deepEqual(m.parseInterruption(stallNote('t4', 'Writer', 120)), { kind: 'stall', botName: 'Writer', secs: 120 });+ // Other meta kinds on a bot message don't turn into notices through the text fallback either way.+ assert.equal(m.parseInterruption({ ...bot('b', 'hi'), meta: JSON.stringify({ kind: 'turn_stalled_x' }) }), null);+ // Tagged stalls get Retry like the rest.+ assert.equal(m.retryTargets([user('u1', 'build it'), taggedStall('t5')]).get('t5').text, 'build it');+});+test('Retry targets the person message before the newest notice only', () => {const att = { id: '0f8fad5b-d9cb-469f-a165-70867728950e', name: 'a.png', mime: 'image/png', size: 3 };const msgs = [