Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(chat): keep the thinking caption on the legacy surface

M3gA-Mindf9dc9b77bdcc
diff --git a/app/src/features/conversations/components/aui/InferenceStatusLine.test.tsx b/app/src/features/conversations/components/aui/InferenceStatusLine.test.tsx
new file mode 100644
index 0000000000..7d0a9ee60f
--- /dev/null
+++ b/app/src/features/conversations/components/aui/InferenceStatusLine.test.tsx
@@ -0,0 +1,59 @@
+/**
+ * `InferenceStatusLine` is shared by two surfaces, and they need different things
+ * from it.
+ *
+ * `/chat` renders `AssistantUiChat`, where assistant-ui paints its own pulsing
+ * `●` during the pre-first-token gap, so a `Thinking... (N)` caption there is a
+ * second indicator stacked under the library's. Voice mode renders
+ * `ChatThreadView`, which has no assistant-ui markdown and therefore no dot —
+ * and which mounts this line *specifically* for the `thinking` phase.
+ *
+ * So the duplicate is suppressed at the assistant-ui caller
+ * (`AssistantUiInferenceStatus` returns null for `thinking`), NOT by deleting
+ * the branch from this shared component. These tests pin that split: removing
+ * the branch here to "fix" the duplicate silently blanks the legacy surface,
+ * which is what #6572 originally did and what tinysweeper caught.
+ */
+import { screen } from '@testing-library/react';
+import { describe, expect, it } from 'vitest';
+
+import { I18nProvider } from '../../../../lib/i18n/I18nContext';
+import { renderWithProviders } from '../../../../test/test-utils';
+import { InferenceStatusLine } from './InferenceStatusLine';
+
+// `I18nProvider` reads `state.locale.current`, so the line needs a store; the
+// shared helper supplies the same reducer set the app mounts.
+function renderLine(status: { phase: string; iteration: number }) {
+ return renderWithProviders(
+ <I18nProvider>
+ <InferenceStatusLine status={status} />
+ </I18nProvider>
+ );
+}
+
+describe('InferenceStatusLine — the legacy surface still gets a thinking caption', () => {
+ it('captions the thinking phase with the iteration count', () => {
+ renderLine({ phase: 'thinking', iteration: 3 });
+ // The legacy surface has no library dot, so a bare pulse with no words is
+ // indistinguishable from a stalled turn.
+ expect(screen.getByTestId('inference-status-line').textContent).toContain('3');
+ expect(screen.getByTestId('inference-status-line').textContent).toMatch(/Thinking/i);
+ });
+
+ it('captions the thinking phase without a count before the first iteration', () => {
+ renderLine({ phase: 'thinking', iteration: 0 });
+ const text = screen.getByTestId('inference-status-line').textContent ?? '';
+ expect(text).toMatch(/Thinking/i);
+ // `Thinking... (0)` would be worse than no number at all.
+ expect(text).not.toContain('(0)');
+ });
+
+ it('renders the line with a caption, not an empty pulse', () => {
+ // The regression this guards is specifically "renders, but says nothing":
+ // the element was still present, so a presence assertion would have passed
+ // while the user saw a bare dot.
+ renderLine({ phase: 'thinking', iteration: 1 });
+ const text = (screen.getByTestId('inference-status-line').textContent ?? '').trim();
+ expect(text.length).toBeGreaterThan(0);
+ });
+});
diff --git a/app/src/features/conversations/components/aui/InferenceStatusLine.tsx b/app/src/features/conversations/components/aui/InferenceStatusLine.tsx
index 9b949b8c78..e08c396a33 100644
--- a/app/src/features/conversations/components/aui/InferenceStatusLine.tsx
+++ b/app/src/features/conversations/components/aui/InferenceStatusLine.tsx
@@ -1,3 +1,4 @@
+import { useT } from '../../../../lib/i18n/I18nContext';
import type { ToolTimelineEntry } from '../../../../store/chatRuntimeSlice';
import { formatTimelineEntry } from '../../../../utils/toolTimelineFormatting';
@@ -22,30 +23,48 @@ export interface InferenceStatusLineProps {
* once that timeline is on screen, and keeps it when there is no timeline row
* to fall back on.
*
- * There is deliberately NO `thinking` branch. It rendered `Thinking... (N)`,
- * which stacked a second indicator under assistant-ui's own: the library's
- * `react-markdown/styles/dot.css` paints a pulsing `●` on
- * `.aui-md[data-status="running"]:empty`, which is live for precisely the
- * pre-first-token gap this line was covering. The `(N)` was the harness's
- * iteration counter — internal telemetry, not something a reader can act on.
- * `AssistantUiInferenceStatus` returns null for that phase before reaching
- * here; this component has no translation for it either.
+ * The `thinking` branch renders `Thinking... (N)`, and stays here because this
+ * component is shared: `ChatThreadView` (the legacy / voice-mode surface) renders
+ * this line *specifically* for that phase, and that surface has no assistant-ui
+ * markdown, so nothing else indicates the pre-first-token gap for it.
+ *
+ * On the assistant-ui surface that caption WOULD stack a second indicator under
+ * the library's own — `react-markdown/styles/dot.css` paints a pulsing `●` on
+ * `.aui-md[data-status="running"]:empty`, live for exactly that gap, and the
+ * `(N)` is the harness's iteration counter, internal telemetry a reader cannot
+ * act on. That is suppressed one layer up: `AssistantUiInferenceStatus` returns
+ * null for `thinking` before reaching this component.
+ *
+ * So the suppression is per-surface, at the surface-specific caller, rather than
+ * by deleting a branch the other caller depends on.
*/
export function InferenceStatusLine({
status,
activeToolEntry,
activeSubagentEntry,
}: InferenceStatusLineProps) {
- // No `useT` here any more: the only translated strings this component had
- // were the `thinking` ones, and both keys are gone. The `tool_use` /
- // `subagent` captions come from `formatTimelineEntry`, which localises the
- // row title itself.
+ // The `thinking` caption stays HERE, in the shared component, because the
+ // legacy surface still needs it: `ChatThreadView` renders this line
+ // specifically for that phase ("keep it only for the `thinking` phase, which
+ // has no timeline row yet") and has no assistant-ui markdown, so nothing
+ // paints a dot for it. Removing the branch left that surface with a bare
+ // pulse and no caption.
+ //
+ // The duplicate this PR is fixing is an assistant-ui problem, and it is fixed
+ // at the assistant-ui layer: `AssistantUiInferenceStatus` returns null for
+ // `thinking` before it ever reaches this component, so the caption below
+ // cannot stack under the library's own `●` there.
+ const { t } = useT();
return (
<div
data-testid="inference-status-line"
className="flex items-center gap-2 px-1 py-1.5 text-xs text-content-muted">
<span className="inline-block w-2 h-2 rounded-full bg-primary-400 animate-pulse" />
<span>
+ {status.phase === 'thinking' &&
+ (status.iteration > 0
+ ? t('chat.thinkingIteration').replace('{n}', String(status.iteration))
+ : t('chat.thinkingDots'))}
{status.phase === 'tool_use' &&
`${
formatTimelineEntry(
diff --git a/app/src/lib/i18n/ar.ts b/app/src/lib/i18n/ar.ts
index 4175489737..833b1c4255 100644
--- a/app/src/lib/i18n/ar.ts
+++ b/app/src/lib/i18n/ar.ts
@@ -2274,6 +2274,8 @@ const messages: TranslationMap = {
'chat.newThreadShortcut': 'محادثة جديدة (/new)',
'chat.new': 'جديد',
'chat.failedToLoadMessages': 'فشل تحميل الرسائل',
+ 'chat.thinkingIteration': 'جارٍ التفكير... ({n})',
+ 'chat.thinkingDots': 'جارٍ التفكير...',
'chat.approachingLimit': 'الاقتراب من حد الاستخدام',
'chat.approachingLimitMsg': 'لقد استخدمت {pct}% من حصتك المتاحة.',
'chat.upgrade': 'الترقية',
diff --git a/app/src/lib/i18n/bn.ts b/app/src/lib/i18n/bn.ts
index 0b0b39bd41..12670e673e 100644
--- a/app/src/lib/i18n/bn.ts
+++ b/app/src/lib/i18n/bn.ts
@@ -2331,6 +2331,8 @@ const messages: TranslationMap = {
'chat.newThreadShortcut': 'নতুন থ্রেড (/new)',
'chat.new': 'নতুন',
'chat.failedToLoadMessages': 'বার্তা লোড করতে ব্যর্থ',
+ 'chat.thinkingIteration': 'ভাবছে... ({n})',
+ 'chat.thinkingDots': 'ভাবছে...',
'chat.approachingLimit': 'ব্যবহার সীমার কাছাকাছি',
'chat.approachingLimitMsg': 'আপনি আপনার উপলব্ধ কোটার {pct}% ব্যবহার করেছেন।',
'chat.upgrade': 'আপগ্রেড করুন',
diff --git a/app/src/lib/i18n/de.ts b/app/src/lib/i18n/de.ts
index 42f7c68893..5a6fef5b04 100644
--- a/app/src/lib/i18n/de.ts
+++ b/app/src/lib/i18n/de.ts
@@ -2398,6 +2398,8 @@ const messages: TranslationMap = {
'chat.newThreadShortcut': 'Neuer Thread (/new)',
'chat.new': 'Neu',
'chat.failedToLoadMessages': 'Nachrichten konnten nicht geladen werden',
+ 'chat.thinkingIteration': 'Denken... ({n})',
+ 'chat.thinkingDots': 'Denken...',
'chat.approachingLimit': 'Das Nutzungslimit nähert sich',
'chat.approachingLimitMsg': 'Du hast {pct} % deines verfügbaren Kontingents verwendet.',
'chat.upgrade': 'Upgrade',
diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.ts
index ef37fe6b0f..1138d031e8 100644
--- a/app/src/lib/i18n/en.ts
+++ b/app/src/lib/i18n/en.ts
@@ -2582,6 +2582,8 @@ const en: TranslationMap = {
'chat.newThreadShortcut': 'New thread (/new)',
'chat.new': 'New',
'chat.failedToLoadMessages': 'Failed to load messages',
+ 'chat.thinkingIteration': 'Thinking... ({n})',
+ 'chat.thinkingDots': 'Thinking...',
'chat.approachingLimit': 'Approaching usage limit',
'chat.approachingLimitMsg': 'You have used {pct}% of your available quota.',
'chat.upgrade': 'Upgrade',
diff --git a/app/src/lib/i18n/es.ts b/app/src/lib/i18n/es.ts
index 2b143f276e..3181c4d878 100644
--- a/app/src/lib/i18n/es.ts
+++ b/app/src/lib/i18n/es.ts
@@ -2375,6 +2375,8 @@ const messages: TranslationMap = {
'chat.newThreadShortcut': 'Nuevo hilo (/new)',
'chat.new': 'Nuevo',
'chat.failedToLoadMessages': 'No se pudieron cargar los mensajes',
+ 'chat.thinkingIteration': 'Pensando... ({n})',
+ 'chat.thinkingDots': 'Pensando...',
'chat.approachingLimit': 'Acercándote al límite de uso',
'chat.approachingLimitMsg': 'Has usado el {pct}% de tu cuota disponible.',
'chat.upgrade': 'Mejorar plan',
diff --git a/app/src/lib/i18n/fr.ts b/app/src/lib/i18n/fr.ts
index ec8712a377..617c4f74df 100644
--- a/app/src/lib/i18n/fr.ts
+++ b/app/src/lib/i18n/fr.ts
@@ -2395,6 +2395,8 @@ const messages: TranslationMap = {
'chat.newThreadShortcut': 'Nouveau fil (/new)',
'chat.new': 'Nouveau',
'chat.failedToLoadMessages': 'Échec du chargement des messages',
+ 'chat.thinkingIteration': 'Réflexion… ({n})',
+ 'chat.thinkingDots': 'Réflexion…',
'chat.approachingLimit': "Limite d'utilisation proche",
'chat.approachingLimitMsg': 'Tu as utilisé {pct}% de ton quota disponible.',
'chat.upgrade': 'Passer à la version supérieure',
diff --git a/app/src/lib/i18n/hi.ts b/app/src/lib/i18n/hi.ts
index f682bc9ce4..f7cb71e1f1 100644
--- a/app/src/lib/i18n/hi.ts
+++ b/app/src/lib/i18n/hi.ts
@@ -2330,6 +2330,8 @@ const messages: TranslationMap = {
'chat.newThreadShortcut': 'नई थ्रेड (/new)',
'chat.new': 'नई',
'chat.failedToLoadMessages': 'मैसेज लोड नहीं हो पाए',
+ 'chat.thinkingIteration': 'सोच रहा है... ({n})',
+ 'chat.thinkingDots': 'सोच रहा है...',
'chat.approachingLimit': 'उपयोग सीमा के करीब',
'chat.approachingLimitMsg': 'आपने अपने उपलब्ध कोटे का {pct}% इस्तेमाल कर लिया है।',
'chat.upgrade': 'अपग्रेड करें',
diff --git a/app/src/lib/i18n/id.ts b/app/src/lib/i18n/id.ts
index 742f06a366..a782252be1 100644
--- a/app/src/lib/i18n/id.ts
+++ b/app/src/lib/i18n/id.ts
@@ -2341,6 +2341,8 @@ const messages: TranslationMap = {
'chat.newThreadShortcut': 'Thread baru (/new)',
'chat.new': 'Baru',
'chat.failedToLoadMessages': 'Gagal memuat pesan',
+ 'chat.thinkingIteration': 'Berpikir... ({n})',
+ 'chat.thinkingDots': 'Berpikir...',
'chat.approachingLimit': 'Mendekati batas pemakaian',
'chat.approachingLimitMsg': 'Anda telah memakai {pct}% dari kuota yang tersedia.',
'chat.upgrade': 'Tingkatkan',
diff --git a/app/src/lib/i18n/it.ts b/app/src/lib/i18n/it.ts
index 9e6897c4bb..7fa87e5a22 100644
--- a/app/src/lib/i18n/it.ts
+++ b/app/src/lib/i18n/it.ts
@@ -2373,6 +2373,8 @@ const messages: TranslationMap = {
'chat.newThreadShortcut': 'Nuovo thread (/new)',
'chat.new': 'Nuovo',
'chat.failedToLoadMessages': 'Impossibile caricare i messaggi',
+ 'chat.thinkingIteration': 'Sto pensando... ({n})',
+ 'chat.thinkingDots': 'Sto pensando...',
'chat.approachingLimit': 'Limite di utilizzo in avvicinamento',
'chat.approachingLimitMsg': 'Hai usato il {pct}% della tua quota disponibile.',
'chat.upgrade': 'Aggiorna',
diff --git a/app/src/lib/i18n/ko.ts b/app/src/lib/i18n/ko.ts
index a2c739dd08..539c32d135 100644
--- a/app/src/lib/i18n/ko.ts
+++ b/app/src/lib/i18n/ko.ts
@@ -2300,6 +2300,8 @@ const messages: TranslationMap = {
'chat.newThreadShortcut': '새 스레드 (/new)',
'chat.new': '새로 만들기',
'chat.failedToLoadMessages': '메시지를 불러오지 못했습니다',
+ 'chat.thinkingIteration': '생각 중... ({n})',
+ 'chat.thinkingDots': '생각 중...',
'chat.approachingLimit': '사용 한도에 가까워지고 있습니다',
'chat.approachingLimitMsg': '사용 가능한 할당량의 {pct}%를 사용했습니다.',
'chat.upgrade': '업그레이드',
diff --git a/app/src/lib/i18n/pl.ts b/app/src/lib/i18n/pl.ts
index d8d04a3514..858f6a8f92 100644
--- a/app/src/lib/i18n/pl.ts
+++ b/app/src/lib/i18n/pl.ts
@@ -2357,6 +2357,8 @@ const messages: TranslationMap = {
'chat.newThreadShortcut': 'Nowy wątek (/new)',
'chat.new': 'Nowy',
'chat.failedToLoadMessages': 'Nie udało się wczytać wiadomości',
+ 'chat.thinkingIteration': 'Myślę... ({n})',
+ 'chat.thinkingDots': 'Myślę...',
'chat.approachingLimit': 'Zbliżasz się do limitu',
'chat.approachingLimitMsg': 'Wykorzystano {pct}% dostępnego limitu.',
'chat.upgrade': 'Podnieś plan',
diff --git a/app/src/lib/i18n/pt.ts b/app/src/lib/i18n/pt.ts
index e4fe461abd..c542e84946 100644
--- a/app/src/lib/i18n/pt.ts
+++ b/app/src/lib/i18n/pt.ts
@@ -2372,6 +2372,8 @@ const messages: TranslationMap = {
'chat.newThreadShortcut': 'Nova conversa (/new)',
'chat.new': 'Nova',
'chat.failedToLoadMessages': 'Falha ao carregar mensagens',
+ 'chat.thinkingIteration': 'Pensando... ({n})',
+ 'chat.thinkingDots': 'Pensando...',
'chat.approachingLimit': 'Aproximando-se do limite de uso',
'chat.approachingLimitMsg': 'Você usou {pct}% da sua cota disponível.',
'chat.upgrade': 'Fazer upgrade',
diff --git a/app/src/lib/i18n/ru.ts b/app/src/lib/i18n/ru.ts
index 606d75a7d0..f955c5488d 100644
--- a/app/src/lib/i18n/ru.ts
+++ b/app/src/lib/i18n/ru.ts
@@ -2350,6 +2350,8 @@ const messages: TranslationMap = {
'chat.newThreadShortcut': 'Новый чат (/new)',
'chat.new': 'Новый',
'chat.failedToLoadMessages': 'Не удалось загрузить сообщения',
+ 'chat.thinkingIteration': 'Думаю... ({n})',
+ 'chat.thinkingDots': 'Думаю...',
'chat.approachingLimit': 'Лимит использования близко',
'chat.approachingLimitMsg': 'Ты использовал {pct}% доступной квоты.',
'chat.upgrade': 'Улучшить',
diff --git a/app/src/lib/i18n/zh-CN.ts b/app/src/lib/i18n/zh-CN.ts
index 7486196c37..aeeab7e87b 100644
--- a/app/src/lib/i18n/zh-CN.ts
+++ b/app/src/lib/i18n/zh-CN.ts
@@ -2179,6 +2179,8 @@ const messages: TranslationMap = {
'chat.newThreadShortcut': '新建对话',
'chat.new': '新建',
'chat.failedToLoadMessages': '加载消息失败',
+ 'chat.thinkingIteration': '思考中...({n})',
+ 'chat.thinkingDots': '思考中...',
'chat.approachingLimit': '接近使用限制',
'chat.approachingLimitMsg': '你已使用了可用配额的{pct}%。',
'chat.upgrade': '升级',