Skip to content

armgit / kwant

Public Imported from GitHub
0

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.

0.7.1: a reply paused on an approval says "Waiting for your OK", not a loading skeleton (#336)

Oleksandr Ivanchenko779745866333
diff --git a/frontend/src/components/ChatView.tsx b/frontend/src/components/ChatView.tsx
index 0e501086..02d0ed0a 100644
--- a/frontend/src/components/ChatView.tsx
+++ b/frontend/src/components/ChatView.tsx
@@ -62,7 +62,7 @@ import { RouteChoiceMeta, parseRouteChoiceMeta, questionsOfReplies } from '../ro
import { SmartActionsSlot, actionClass } from './results/SmartActions';
import { WorkingStrip } from './WorkingStrip';
import { ScrollRow } from './ScrollRow';
-import { waitingOn } from '../workingStrip';
+import { liveBubble, waitingOn } from '../workingStrip';
import { COMPOSE_PREFILL_EVENT, withPrefill } from './results/SmartResult';
import { FilesPreviewOnly } from './results/Files';
import { ReactionButtons, ReplyButton, ReplyChip, ReplyQuote } from './MessageReactions';
@@ -634,6 +634,8 @@ export const ChatView: React.FC<ChatViewProps> = ({
// Phone (0.6.13 spec A3/C2): the working strip is the one live line, so the stream drops what repeats it.
// (`phone` is the A1 PHONE_QUERY flag above).
const stripWaitsOn = isStreaming ? waitingOn({ live: liveActivity, queued: !!queued, awaitingAnswer: !!awaitingAnswer, awaitingBrowser: !!awaitingBrowser }) : null;
+ // What the live bubble holds before its first words: a pending approval reads as "waiting for your OK", not loading.
+ const bubble = liveBubble({ live: liveActivity, queued: !!queued, awaitingAnswer: !!awaitingAnswer, awaitingBrowser: !!awaitingBrowser, writing: !!streamingText });
// The strip's "Answer ↑": the open question card, else the approval card, fully in view.
const showWaitingCard = (on: 'question' | 'approval') => {
if (on === 'approval') return showApproval();
@@ -1640,10 +1642,10 @@ export const ChatView: React.FC<ChatViewProps> = ({
<span className="w-1.5 h-1.5 rounded-full bg-amber-300" aria-hidden="true" />
Queued
</span>
- ) : awaitingAnswer && !phone ? (
+ ) : (awaitingAnswer || bubble === 'approval') && !phone ? (
<span className="inline-flex items-center gap-1 text-amber-300 text-[10px]">
<span className="w-1.5 h-1.5 rounded-full bg-amber-300" aria-hidden="true" />
- {awaitingBrowser ? 'Waiting for you in the browser' : 'Waiting for your answer'}
+ {bubble === 'approval' ? 'Waiting for your OK' : awaitingBrowser ? 'Waiting for you in the browser' : 'Waiting for your answer'}
</span>
) : discussionState?.inProgress ? (
<span className="inline-flex items-center gap-1 text-sky-400 text-[10px]">
@@ -1682,6 +1684,10 @@ export const ChatView: React.FC<ChatViewProps> = ({
? 'Paused on the browser step above. Do it in the browser panel and press Done; this reply carries on from it.'
: 'Paused on the question above. Answer it there; this reply carries on from it.'}
</p>
+ ) : bubble === 'approval' ? (
+ <p className="text-zinc-400" role="status" data-live-bubble="approval">
+ Paused on the approval below. Allow or deny it there; this reply carries on from it.
+ </p>
) : (
<div className="space-y-2.5 py-1" role="status" aria-label="Waiting for the first words">
<div className="kws-skel h-3 w-11/12 rounded-full bg-zinc-700/60" />
diff --git a/frontend/src/workingStrip.ts b/frontend/src/workingStrip.ts
index 9116b04c..9d708314 100644
--- a/frontend/src/workingStrip.ts
+++ b/frontend/src/workingStrip.ts
@@ -41,6 +41,20 @@ export function waitingOn(s: WorkingState): 'question' | 'approval' | null {
return open?.kind === 'approval' && open.status === 'waiting' ? 'approval' : null;
}
+/**
+ * What the live reply bubble holds before its first words. A turn paused on an approval card (the
+ * production floor, a shell command) is waiting for the person, not loading, so it gets a line that
+ * points at the card instead of the "first words" skeleton (0.7.1, D6 footage).
+ */
+export type LiveBubble = 'queued' | 'text' | 'question' | 'browser' | 'approval' | 'starting';
+
+export function liveBubble(s: WorkingState): LiveBubble {
+ if (s.queued) return 'queued';
+ if (s.writing) return 'text';
+ if (s.awaitingAnswer) return s.awaitingBrowser ? 'browser' : 'question';
+ return waitingOn(s) === 'approval' ? 'approval' : 'starting';
+}
+
/** The strip's clock; the saved card header uses the same one. */
export const formatElapsed = formatClock;
diff --git a/frontend/tests/liveBubble.test.mjs b/frontend/tests/liveBubble.test.mjs
new file mode 100644
index 00000000..c6c0945c
--- /dev/null
+++ b/frontend/tests/liveBubble.test.mjs
@@ -0,0 +1,43 @@
+// 0.7.1: a turn paused on an approval card (the production floor in the D6 footage) showed the grey
+// "first words" skeleton above the card for as long as the card waited. It isn't loading: it waits for you.
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { readFileSync } from 'node:fs';
+import { loadBundled } from './bundle.mjs';
+
+const w = await loadBundled(`export * from './src/workingStrip';`);
+
+const step = (over = {}) => ({ id: 's1', kind: 'tool', status: 'running', title: 'Running `ls`', started_at: '2026-11-05T20:00:00Z', ...over });
+const approval = step({ id: 'ap', kind: 'approval', status: 'waiting', title: 'Run `./deploy.sh`' });
+
+test('a turn waiting on an approval card shows "waiting for your OK", not the loading skeleton', () => {
+ const live = { turnId: 't', steps: [step({ id: 'a', status: 'ok' }), approval] };
+ assert.equal(w.liveBubble({ live }), 'approval');
+ // The strip and the bubble agree on whose move it is.
+ assert.equal(w.workingLabel({ live }), 'waiting for your OK');
+ assert.equal(w.waitingOn({ live }), 'approval');
+});
+
+test('the skeleton stays for a turn that is really starting, and settled approvals don’t hold it', () => {
+ assert.equal(w.liveBubble({}), 'starting');
+ assert.equal(w.liveBubble({ live: { turnId: 't', steps: [step()] } }), 'starting');
+ // Allowed: the step is no longer waiting, so the bot is working again.
+ assert.equal(w.liveBubble({ live: { turnId: 't', steps: [{ ...approval, status: 'ok' }] } }), 'starting');
+});
+
+test('words, the queue and questions win over the approval line', () => {
+ const live = { turnId: 't', steps: [approval] };
+ assert.equal(w.liveBubble({ live, writing: true }), 'text');
+ assert.equal(w.liveBubble({ live, queued: true }), 'queued');
+ assert.equal(w.liveBubble({ live, awaitingAnswer: true }), 'question');
+ assert.equal(w.liveBubble({ live, awaitingAnswer: true, awaitingBrowser: true }), 'browser');
+});
+
+test('ChatView draws the approval line before it falls back to the skeleton', () => {
+ const chat = readFileSync(new URL('../src/components/ChatView.tsx', import.meta.url), 'utf8');
+ const line = chat.indexOf("bubble === 'approval' ? (");
+ const skel = chat.indexOf('aria-label="Waiting for the first words"');
+ assert.ok(line > 0 && skel > line, 'the approval branch comes before the skeleton');
+ assert.match(chat, /Paused on the approval below\. Allow or deny it there; this reply carries on from it\./);
+ assert.match(chat, /bubble === 'approval' \? 'Waiting for your OK'/);
+});