Skip to content

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

fix(chat): give a sub-agent awaiting the user its own state and a way to answer\n\n`onSubagentAwaitingUser` reached the assistant-ui surface, but nothing there\ncould tell the pause apart from ordinary work. `isActiveSubagentStatus` folds\n`awaiting_user` into `running`, and the surface passes `running` from\n`result === undefined`, which is true for a parked delegation too -- so a child\nblocked on a question rendered as a spinning "running" chip for as long as the\ngate stayed open. The question itself never left the socket event: the reducer\ntook only `{threadId, rowId}` and dropped `message`, which is the core's only\ncopy of it. There was no way to answer either: `SubagentDrawer` lives inside\nthe unreachable `legacyMainPanel`.\n\nThe data half. `subagentAwaitingUser` now carries the question onto\n`SubagentActivity.awaitingQuestion`, and `subagentSpawned` treats a republished\nspawn for an already-parked row as the resume signal it is -- `continue_subagent`\nresumes a paused child by republishing `subagent_spawned` for the same\ntask/agent, and the idempotency guard swallowed it wholesale, leaving the row\nstuck on `awaiting_user` for the rest of the run. It stays idempotent for a\nplain redelivery: no second row, and a `running` row is untouched.\n\nThe render half. `isAwaitingUserSubagentStatus` asks the question\n`isActiveSubagentStatus` cannot: not "is this in flight" but "is the blockage\nthe user". The card reads it from the activity rather than the `running` prop,\nshows a distinct chip instead of a spinner, pins its disclosure open while the\ngate is held, and renders the question with a reply box. The reply is an\nordinary user turn -- the orchestrator holds the `[SUBAGENT_AWAITING_USER]`\nenvelope and resumes the child with `continue_subagent` once the user answers\n-- so it appends through the runtime and out to the registered chat surface,\nthe same entry point as the composer's Send, which keeps the queued-vs-new-turn\ndecision in one place. `onAnswer` is opt-in, so the read-only surfaces that\nalso render this card (the process drawer, past-turn insights) get the question\nwithout a dead reply box.\n

M3gA-Mind5c28836f5d80
diff --git a/app/src/features/conversations/components/AssistantUiSubagentCall.awaitingUser.test.tsx b/app/src/features/conversations/components/AssistantUiSubagentCall.awaitingUser.test.tsx
new file mode 100644
index 0000000000..e0f6f1655a
--- /dev/null
+++ b/app/src/features/conversations/components/AssistantUiSubagentCall.awaitingUser.test.tsx
@@ -0,0 +1,226 @@
+/**
+ * A sub-agent that stops to ask the user a question must look different from
+ * one that is working, and the user must be able to answer it.
+ *
+ * Both halves regressed in the assistant-ui migration. `onSubagentAwaitingUser`
+ * reached the surface, but the row rendered through `isActiveSubagentStatus`,
+ * which folds `awaiting_user` into `running`: the delegation card showed a
+ * spinning "running" chip for as long as the gate stayed open, the question was
+ * never carried out of the socket event at all, and the only surface that could
+ * have shown it (`SubagentDrawer`) lives inside the unreachable
+ * `legacyMainPanel`.
+ */
+import { combineReducers, configureStore } from '@reduxjs/toolkit';
+import { act, render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { Provider } from 'react-redux';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+
+import { AssistantUiRuntimeProvider } from '../../../providers/AssistantUiRuntimeProvider';
+import { __resetChatSurfaces, registerChatSurface } from '../../../providers/chatSurfaceHandlers';
+import chatRuntimeReducer, {
+ type SubagentActivity,
+ subagentAwaitingUser,
+ subagentSpawned,
+} from '../../../store/chatRuntimeSlice';
+import threadReducer from '../../../store/threadSlice';
+import { AssistantUiSubagentCall } from './AssistantUiSubagentCall';
+import { SubagentCall } from './ChatToolParts';
+
+vi.mock('../../../services/api/threadApi', () => ({
+ threadApi: {
+ getDerivedTranscript: vi
+ .fn()
+ .mockResolvedValue({
+ threadId: 't-await',
+ items: [],
+ total: 0,
+ hasMore: false,
+ hasTranscript: false,
+ }),
+ },
+}));
+
+const THREAD_ID = 't-await';
+const ROW_ID = `${THREAD_ID}:subagent:sub-1:researcher`;
+
+const activity: SubagentActivity = {
+ taskId: 'sub-1',
+ agentId: 'researcher',
+ displayName: 'Researcher',
+ toolCalls: [],
+};
+
+function buildStore() {
+ return configureStore({
+ reducer: combineReducers({ thread: threadReducer, chatRuntime: chatRuntimeReducer }),
+ preloadedState: {
+ thread: {
+ threads: [],
+ selectedThreadId: THREAD_ID,
+ activeThreadIds: {},
+ welcomeThreadId: null,
+ messagesByThreadId: { [THREAD_ID]: [] },
+ messages: [],
+ isLoadingThreads: false,
+ isLoadingMessages: false,
+ messagesError: null,
+ },
+ } as never,
+ });
+}
+
+/** Drive the row through the real reducers, exactly as the socket does. */
+function parkTheDelegation(store: ReturnType<typeof buildStore>, question: string) {
+ store.dispatch(
+ subagentSpawned({
+ threadId: THREAD_ID,
+ round: 1,
+ rowId: ROW_ID,
+ taskId: 'sub-1',
+ agentId: 'researcher',
+ displayName: 'Researcher',
+ })
+ );
+ store.dispatch(subagentAwaitingUser({ threadId: THREAD_ID, rowId: ROW_ID, question }));
+}
+
+afterEach(() => __resetChatSurfaces());
+
+describe('sub-agent awaiting user', () => {
+ describe('the data half', () => {
+ it('carries the question out of the socket event onto the timeline row', () => {
+ const store = buildStore();
+ parkTheDelegation(store, 'Which of the two repos should I patch?');
+
+ const row = store.getState().chatRuntime.toolTimelineByThread[THREAD_ID]?.[0];
+ expect(row?.status).toBe('awaiting_user');
+ expect(row?.subagent?.status).toBe('awaiting_user');
+ // Before the fix the reducer took only {threadId, rowId} and the
+ // question — the entire content of the pause — was dropped on the floor.
+ expect(row?.subagent?.awaitingQuestion).toBe('Which of the two repos should I patch?');
+ });
+
+ it('unparks the row when continue_subagent republishes the spawn', () => {
+ const store = buildStore();
+ parkTheDelegation(store, 'Which repo?');
+
+ // `continue_subagent` resumes a paused child by republishing
+ // `subagent_spawned` for the SAME task/agent, so the row id is identical.
+ // The idempotency guard used to swallow it wholesale, leaving the card
+ // asking a question the user had already answered for the rest of the run.
+ store.dispatch(
+ subagentSpawned({
+ threadId: THREAD_ID,
+ round: 1,
+ rowId: ROW_ID,
+ taskId: 'sub-1',
+ agentId: 'researcher',
+ displayName: 'Researcher',
+ })
+ );
+
+ const rows = store.getState().chatRuntime.toolTimelineByThread[THREAD_ID] ?? [];
+ expect(rows).toHaveLength(1); // still idempotent: no duplicate row
+ expect(rows[0]?.status).toBe('running');
+ expect(rows[0]?.subagent?.status).toBe('running');
+ expect(rows[0]?.subagent?.awaitingQuestion).toBeUndefined();
+ });
+ });
+
+ describe('the render half', () => {
+ it('renders a parked delegation as awaiting input, not as a running spinner', () => {
+ render(
+ <AssistantUiSubagentCall
+ activity={{
+ ...activity,
+ status: 'awaiting_user',
+ awaitingQuestion: 'Which of the two repos should I patch?',
+ }}
+ // The assistant-ui surface passes `running` from `result === undefined`,
+ // which is true for a parked delegation too. The card must not believe it.
+ running
+ />
+ );
+
+ expect(screen.getByTestId('subagent-awaiting-chip')).toBeInTheDocument();
+ expect(screen.queryByText('running')).not.toBeInTheDocument();
+ expect(screen.getByTestId('subagent-awaiting-question')).toHaveTextContent(
+ 'Which of the two repos should I patch?'
+ );
+ // The question is worthless if the card stays collapsed around it.
+ expect(screen.getByTestId('assistant-ui-subagent-call')).toHaveAttribute(
+ 'data-state',
+ 'open'
+ );
+ });
+
+ it('still renders an ordinary running delegation as running', () => {
+ render(<AssistantUiSubagentCall activity={{ ...activity, status: 'running' }} running />);
+ expect(screen.getByText('running')).toBeInTheDocument();
+ expect(screen.queryByTestId('subagent-awaiting-chip')).not.toBeInTheDocument();
+ expect(screen.queryByTestId('subagent-awaiting-user')).not.toBeInTheDocument();
+ });
+
+ it('offers no reply box on a read-only surface', () => {
+ render(
+ <AssistantUiSubagentCall
+ activity={{ ...activity, status: 'awaiting_user', awaitingQuestion: 'Which repo?' }}
+ />
+ );
+ expect(screen.getByTestId('subagent-awaiting-question')).toBeInTheDocument();
+ expect(screen.queryByTestId('subagent-answer-input')).not.toBeInTheDocument();
+ });
+ });
+
+ describe('answering', () => {
+ it('sends the answer through the thread the composer sends through', async () => {
+ const send = vi.fn(async () => {});
+ registerChatSurface(THREAD_ID, { send });
+ const store = buildStore();
+
+ render(
+ <Provider store={store}>
+ <AssistantUiRuntimeProvider>
+ <SubagentCall
+ type="tool-call"
+ toolName="task"
+ toolCallId={ROW_ID}
+ args={
+ {
+ subagent_type: 'researcher',
+ progress: {
+ ...activity,
+ status: 'awaiting_user',
+ awaitingQuestion: 'Which repo?',
+ },
+ } as never
+ }
+ argsText="{}"
+ result={undefined}
+ status={{ type: 'running' }}
+ addResult={() => {}}
+ resume={() => {}}
+ respondToApproval={() => {}}
+ />
+ </AssistantUiRuntimeProvider>
+ </Provider>
+ );
+
+ expect(screen.getByTestId('subagent-awaiting-chip')).toBeInTheDocument();
+
+ await act(async () => {
+ await userEvent.type(screen.getByTestId('subagent-answer-input'), 'the second one');
+ });
+ await act(async () => {
+ await userEvent.click(screen.getByTestId('subagent-answer-send'));
+ });
+
+ // The orchestrator is holding the [SUBAGENT_AWAITING_USER] envelope and
+ // resumes the child with continue_subagent once the user answers, so the
+ // answer is an ordinary user turn on the registered chat surface.
+ await waitFor(() => expect(send).toHaveBeenCalledWith('the second one'));
+ expect(screen.getByTestId('subagent-answer-sent')).toBeInTheDocument();
+ });
+ });
+});
diff --git a/app/src/features/conversations/components/AssistantUiSubagentCall.tsx b/app/src/features/conversations/components/AssistantUiSubagentCall.tsx
index fc0b29b3f7..ab8d75dd3a 100644
--- a/app/src/features/conversations/components/AssistantUiSubagentCall.tsx
+++ b/app/src/features/conversations/components/AssistantUiSubagentCall.tsx
@@ -1,4 +1,12 @@
-import { CheckIcon, ChevronDownIcon, CircleXIcon, Loader2Icon, WorkflowIcon } from 'lucide-react';
+import {
+ CheckIcon,
+ ChevronDownIcon,
+ CircleXIcon,
+ Loader2Icon,
+ MessageCircleQuestionIcon,
+ WorkflowIcon,
+} from 'lucide-react';
+import { useState } from 'react';
import { cn } from '../../../components/assistant-ui/lib/utils';
import {
@@ -6,6 +14,7 @@ import {
CollapsibleContent,
CollapsibleTrigger,
} from '../../../components/assistant-ui/ui/collapsible';
+import { Button } from '../../../components/ui';
import Badge from '../../../components/ui/Badge';
import WorktreeActions from '../../../components/worktree/WorktreeActions';
import { useT } from '../../../lib/i18n/I18nContext';
@@ -168,42 +177,180 @@ function isFailedSubagentStatus(status: string | undefined): boolean {
return status === 'failed' || status === 'cancelled';
}
+/**
+ * The delegation is parked on `ask_user_clarification` and cannot progress
+ * until the user answers.
+ *
+ * Deliberately NOT a sub-case of {@link isActiveSubagentStatus}: both are true
+ * at once and they answer different questions. "Active" decides whether the row
+ * is still in flight (dashed border, no success check); "awaiting" decides
+ * whether the blockage is *the user*. Folding the second into the first is what
+ * rendered a child asking a question as an ordinary spinner labelled "running"
+ * for as long as the gate stayed open.
+ */
+export function isAwaitingUserSubagentStatus(status: string | undefined): boolean {
+ return status === 'awaiting_user';
+}
+
+/**
+ * The child's question plus, when the host supplies `onAnswer`, a reply box.
+ *
+ * The answer is an ordinary user turn: the orchestrator is holding a
+ * `[SUBAGENT_AWAITING_USER]` envelope that instructs it to relay the question
+ * and resume with `continue_subagent` once the user responds
+ * (`orchestration/tools/awaiting_user.rs`). So sending here goes through the
+ * same composer path as typing the answer by hand, which is what makes the
+ * queued-vs-new-turn decision in one place.
+ *
+ * `onAnswer` is optional because this card also renders on read-only,
+ * historical surfaces (the process drawer, past-turn insights). Those pass no
+ * handler and get the question without a dead reply box.
+ */
+function SubagentAwaitingUser({
+ question,
+ onAnswer,
+}: {
+ question?: string;
+ onAnswer?: (text: string) => void;
+}) {
+ const { t } = useT();
+ const [draft, setDraft] = useState('');
+ // Local, optimistic: the core has no "answer received" event for this row.
+ // It resumes by republishing `subagent_spawned`, which flips the status back
+ // to running and unmounts this panel; until then the user needs to see that
+ // their answer went somewhere.
+ const [sent, setSent] = useState(false);
+
+ const submit = () => {
+ const text = draft.trim();
+ if (!text || !onAnswer) return;
+ onAnswer(text);
+ setDraft('');
+ setSent(true);
+ };
+
+ return (
+ <div
+ data-testid="subagent-awaiting-user"
+ className="mt-1 space-y-1.5 rounded-lg border border-amber-300/70 bg-amber-50/70 p-2 dark:border-amber-400/30 dark:bg-amber-500/10">
+ <p className="text-[12px] font-medium text-amber-800 dark:text-amber-200">
+ {t('conversations.subagent.awaitingTitle')}
+ </p>
+ {question ? (
+ // Plain text, not markdown: this is sub-agent-authored free text and
+ // the card gains nothing from rendering links or images out of it.
+ <p
+ data-testid="subagent-awaiting-question"
+ className="wrap-break-word whitespace-pre-wrap text-[12px] text-content-secondary">
+ {question}
+ </p>
+ ) : null}
+ {onAnswer ? (
+ sent ? (
+ <p className="text-[11px] text-content-muted" data-testid="subagent-answer-sent">
+ {t('conversations.subagent.answerSent')}
+ </p>
+ ) : (
+ <div className="flex items-end gap-1.5">
+ <textarea
+ rows={1}
+ value={draft}
+ data-testid="subagent-answer-input"
+ aria-label={t('conversations.subagent.answerPlaceholder')}
+ placeholder={t('conversations.subagent.answerPlaceholder')}
+ onChange={event => setDraft(event.target.value)}
+ onKeyDown={event => {
+ // Enter sends, Shift+Enter is a newline. Matches the composer.
+ if (event.key === 'Enter' && !event.shiftKey) {
+ event.preventDefault();
+ submit();
+ }
+ }}
+ className="min-h-[28px] flex-1 resize-y rounded-md border border-line bg-surface px-2 py-1 text-[12px] text-content-primary outline-none focus:border-primary-500"
+ />
+ <Button
+ type="button"
+ size="xs"
+ variant="primary"
+ analyticsId="subagent-answer-send"
+ data-testid="subagent-answer-send"
+ disabled={draft.trim().length === 0}
+ onClick={submit}>
+ {t('conversations.subagent.answerSend')}
+ </Button>
+ </div>
+ )
+ ) : null}
+ </div>
+ );
+}
+
export function AssistantUiSubagentCall({
activity,
running,
description,
onView,
+ onAnswer,
defaultOpen = false,
}: {
activity: SubagentActivity;
running?: boolean;
description?: string;
onView?: () => void;
+ /**
+ * Send the user's reply to a delegation parked on `ask_user_clarification`.
+ * Supplied only by the live chat surface; omit on read-only/historical
+ * renders so no dead reply box appears.
+ */
+ onAnswer?: (text: string) => void;
defaultOpen?: boolean;
}) {
+ const { t } = useT();
const name = activity.displayName ?? activity.agentId ?? 'subagent';
// Default to the activity's own lifecycle rather than `false`: most call
// sites pass no `running` prop at all, and treating every non-running
// activity as finished-successfully is what rendered a failed delegation
// with a success check.
const active = running ?? isActiveSubagentStatus(activity.status);
+ // Read from the activity, never from `running`: the assistant-ui surface
+ // passes `running={result === undefined}`, which is `true` for a parked
+ // delegation too, so a caller-supplied `running` cannot distinguish the two.
+ const awaiting = isAwaitingUserSubagentStatus(activity.status);
const failed = !active && isFailedSubagentStatus(activity.status);
+ const [open, setOpen] = useState(defaultOpen);
+ // A question the user cannot see is a question they cannot answer, and the
+ // row is normally already mounted (and collapsed) as `running` by the time
+ // the pause arrives, so `defaultOpen` is too late. Derived rather than an
+ // effect that forces the state: the disclosure is pinned open only for as
+ // long as the delegation is actually blocked on the user, and the user's own
+ // open/closed choice is remembered underneath and restored on resume.
+ const disclosureOpen = open || awaiting;
return (
<Collapsible
- defaultOpen={defaultOpen}
+ open={disclosureOpen}
+ onOpenChange={setOpen}
data-slot="aui_subagent-call"
data-testid="assistant-ui-subagent-call"
data-status={activity.status ?? (active ? 'running' : 'completed')}
className={cn(
'aui-subagent-call border-border/60 dark:border-muted-foreground/15 rounded-xl border',
- active && 'border-dashed'
+ active && 'border-dashed',
+ awaiting && 'border-solid border-amber-300 dark:border-amber-400/40'
)}>
<CollapsibleTrigger className="group/subagent text-muted-foreground hover:text-foreground flex w-full items-center gap-2 px-3 py-2 text-sm transition-colors">
<WorkflowIcon className="size-4 shrink-0" />
<span className="text-start leading-none">
Delegated to <b className="text-foreground">{name}</b>
</span>
- {active ? (
+ {awaiting ? (
+ // Not a spinner: the child is not working, it is blocked on the user.
+ <span
+ data-testid="subagent-awaiting-chip"
+ className="flex shrink-0 items-center gap-1.5 rounded-full bg-amber-100 px-2 py-0.5 text-[11px] leading-none text-amber-800 dark:bg-amber-500/20 dark:text-amber-200">
+ <MessageCircleQuestionIcon className="size-3" />
+ {t('conversations.subagent.statusAwaitingUser')}
+ </span>
+ ) : active ? (
<span className="bg-muted text-muted-foreground flex shrink-0 items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] leading-none">
<Loader2Icon className="size-3 animate-spin [animation-duration:0.6s]" /> running
</span>
@@ -220,6 +367,9 @@ export function AssistantUiSubagentCall({
</CollapsibleTrigger>
<CollapsibleContent className="px-3 pb-3">
{description ? <p className="text-muted-foreground text-xs">{description}</p> : null}
+ {awaiting ? (
+ <SubagentAwaitingUser question={activity.awaitingQuestion} onAnswer={onAnswer} />
+ ) : null}
<SubagentDetails subagent={activity} onView={onView} />
</CollapsibleContent>
</Collapsible>
diff --git a/app/src/features/conversations/components/ChatToolParts.tsx b/app/src/features/conversations/components/ChatToolParts.tsx
index 1069e6477d..4358ac0fa7 100644
--- a/app/src/features/conversations/components/ChatToolParts.tsx
+++ b/app/src/features/conversations/components/ChatToolParts.tsx
@@ -1,5 +1,5 @@
-import type { ToolCallMessagePartComponent } from '@assistant-ui/react';
-import type { FC, PropsWithChildren } from 'react';
+import { type ToolCallMessagePartComponent, useAui } from '@assistant-ui/react';
+import { type FC, type PropsWithChildren, useCallback } from 'react';
import type { ThreadGroupPart } from '../../../components/assistant-ui/thread';
import {
@@ -42,6 +42,7 @@ function readSubagentState(
/** Adapt an assistant-ui `task` part onto the shared delegation card. */
export const SubagentCall: ToolCallMessagePartComponent = ({ args, result }) => {
+ const aui = useAui();
const { activity, running } = readSubagentState(args, result);
const description = (args as { description?: string } | undefined)?.description;
const fallbackAgent = (args as { subagent_type?: string } | undefined)?.subagent_type;
@@ -50,8 +51,26 @@ export const SubagentCall: ToolCallMessagePartComponent = ({ args, result }) =>
agentId: fallbackAgent ?? 'subagent',
toolCalls: [],
};
+ // A delegation parked on `ask_user_clarification` is unblocked by an ordinary
+ // user turn: the orchestrator is holding the `[SUBAGENT_AWAITING_USER]`
+ // envelope and resumes the child with `continue_subagent` once the user
+ // answers. Appending through the runtime routes to the external store's
+ // `onNew` and out to the registered chat surface, i.e. the same entry point
+ // as the composer's Send, so queueing behind an in-flight turn is decided in
+ // one place rather than duplicated here.
+ const answer = useCallback(
+ (text: string) => {
+ void aui.thread.append({ role: 'user', content: [{ type: 'text', text }] });
+ },
+ [aui]
+ );
return (
- <AssistantUiSubagentCall activity={resolved} running={running} description={description} />
+ <AssistantUiSubagentCall
+ activity={resolved}
+ running={running}
+ description={description}
+ onAnswer={answer}
+ />
);
};
diff --git a/app/src/lib/i18n/ar.ts b/app/src/lib/i18n/ar.ts
index fe1c7ff736..e3721c426e 100644
--- a/app/src/lib/i18n/ar.ts
+++ b/app/src/lib/i18n/ar.ts
@@ -3286,6 +3286,10 @@ const messages: TranslationMap = {
'conversations.subagent.statusFailed': 'فشل',
'conversations.subagent.statusAwaitingUser': 'في انتظار المستخدم',
'conversations.subagent.statusCancelled': 'أُلغيت',
+ 'conversations.subagent.awaitingTitle': 'في انتظار إجابتك',
+ 'conversations.subagent.answerPlaceholder': 'اكتب إجابتك',
+ 'conversations.subagent.answerSend': 'إرسال الإجابة',
+ 'conversations.subagent.answerSent': 'تم إرسال الإجابة',
'conversations.agentTaskInsights.title': 'رؤى مهام الوكيل',
'conversations.agentTaskInsights.response': 'الرد',
'conversations.agentTaskInsights.processSourceTitle': 'مصدر عملية الوكيل',
diff --git a/app/src/lib/i18n/bn.ts b/app/src/lib/i18n/bn.ts
index 6ae2a65470..9154fd6c6b 100644
--- a/app/src/lib/i18n/bn.ts
+++ b/app/src/lib/i18n/bn.ts
@@ -3362,6 +3362,10 @@ const messages: TranslationMap = {
'conversations.subagent.statusFailed': 'ব্যর্থ',
'conversations.subagent.statusAwaitingUser': 'ব্যবহারকারীর অপেক্ষায়',
'conversations.subagent.statusCancelled': 'বাতিল হয়েছে',
+ 'conversations.subagent.awaitingTitle': 'আপনার উত্তরের অপেক্ষায়',
+ 'conversations.subagent.answerPlaceholder': 'আপনার উত্তর লিখুন',
+ 'conversations.subagent.answerSend': 'উত্তর পাঠান',
+ 'conversations.subagent.answerSent': 'উত্তর পাঠানো হয়েছে',
'conversations.agentTaskInsights.title': 'এজেন্ট টাস্ক অন্তর্দৃষ্টি',
'conversations.agentTaskInsights.response': 'প্রতিক্রিয়া',
'conversations.agentTaskInsights.processSourceTitle': 'এজেন্ট প্রক্রিয়া উৎস',
diff --git a/app/src/lib/i18n/de.ts b/app/src/lib/i18n/de.ts
index 8f5fafdc15..959b9d624c 100644
--- a/app/src/lib/i18n/de.ts
+++ b/app/src/lib/i18n/de.ts
@@ -3459,6 +3459,10 @@ const messages: TranslationMap = {
'conversations.subagent.statusFailed': 'fehlgeschlagen',
'conversations.subagent.statusAwaitingUser': 'warte auf Benutzer',
'conversations.subagent.statusCancelled': 'abgebrochen',
+ 'conversations.subagent.awaitingTitle': 'Wartet auf deine Antwort',
+ 'conversations.subagent.answerPlaceholder': 'Antwort eingeben',
+ 'conversations.subagent.answerSend': 'Antwort senden',
+ 'conversations.subagent.answerSent': 'Antwort gesendet',
'conversations.agentTaskInsights.title': 'Agenten-Aufgabeneinblicke',
'conversations.agentTaskInsights.response': 'Antwort',
'conversations.agentTaskInsights.processSourceTitle': 'Agentenprozess-Quelle',
diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.ts
index 8e816cab95..a15914387c 100644
--- a/app/src/lib/i18n/en.ts
+++ b/app/src/lib/i18n/en.ts
@@ -3878,6 +3878,10 @@ const en: TranslationMap = {
'conversations.subagent.statusFailed': 'failed',
'conversations.subagent.statusAwaitingUser': 'awaiting user',
'conversations.subagent.statusCancelled': 'cancelled',
+ 'conversations.subagent.awaitingTitle': 'Waiting for your answer',
+ 'conversations.subagent.answerPlaceholder': 'Type your answer',
+ 'conversations.subagent.answerSend': 'Send answer',
+ 'conversations.subagent.answerSent': 'Answer sent',
'conversations.agentTaskInsights.title': 'Agentic task insights',
'conversations.agentTaskInsights.response': 'Response',
'conversations.agentTaskInsights.processSourceTitle': 'Agent Process Source',
diff --git a/app/src/lib/i18n/es.ts b/app/src/lib/i18n/es.ts
index 13a9bb57c8..f91d84f2b0 100644
--- a/app/src/lib/i18n/es.ts
+++ b/app/src/lib/i18n/es.ts
@@ -3424,6 +3424,10 @@ const messages: TranslationMap = {
'conversations.subagent.statusFailed': 'fallido',
'conversations.subagent.statusAwaitingUser': 'esperando al usuario',
'conversations.subagent.statusCancelled': 'cancelado',
+ 'conversations.subagent.awaitingTitle': 'Esperando tu respuesta',
+ 'conversations.subagent.answerPlaceholder': 'Escribe tu respuesta',
+ 'conversations.subagent.answerSend': 'Enviar respuesta',
+ 'conversations.subagent.answerSent': 'Respuesta enviada',
'conversations.agentTaskInsights.title': 'Información de tareas del agente',
'conversations.agentTaskInsights.response': 'Respuesta',
'conversations.agentTaskInsights.processSourceTitle': 'Fuente del proceso del agente',
diff --git a/app/src/lib/i18n/fr.ts b/app/src/lib/i18n/fr.ts
index 557ff3bdbe..80616121de 100644
--- a/app/src/lib/i18n/fr.ts
+++ b/app/src/lib/i18n/fr.ts
@@ -3449,6 +3449,10 @@ const messages: TranslationMap = {
'conversations.subagent.statusFailed': 'échoué',
'conversations.subagent.statusAwaitingUser': "en attente de l'utilisateur",
'conversations.subagent.statusCancelled': 'annulé',
+ 'conversations.subagent.awaitingTitle': 'En attente de votre réponse',
+ 'conversations.subagent.answerPlaceholder': 'Saisissez votre réponse',
+ 'conversations.subagent.answerSend': 'Envoyer la réponse',
+ 'conversations.subagent.answerSent': 'Réponse envoyée',
'conversations.agentTaskInsights.title': "Aperçu des tâches de l'agent",
'conversations.agentTaskInsights.response': 'Réponse',
'conversations.agentTaskInsights.processSourceTitle': "Source du processus de l'agent",
diff --git a/app/src/lib/i18n/hi.ts b/app/src/lib/i18n/hi.ts
index f2cb6c40f2..166baecce1 100644
--- a/app/src/lib/i18n/hi.ts
+++ b/app/src/lib/i18n/hi.ts
@@ -3365,6 +3365,10 @@ const messages: TranslationMap = {
'conversations.subagent.statusFailed': 'विफल',
'conversations.subagent.statusAwaitingUser': 'उपयोगकर्ता की प्रतीक्षा',
'conversations.subagent.statusCancelled': 'रद्द किया गया',
+ 'conversations.subagent.awaitingTitle': 'आपके उत्तर की प्रतीक्षा',
+ 'conversations.subagent.answerPlaceholder': 'अपना उत्तर लिखें',
+ 'conversations.subagent.answerSend': 'उत्तर भेजें',
+ 'conversations.subagent.answerSent': 'उत्तर भेजा गया',
'conversations.agentTaskInsights.title': 'एजेंट कार्य अंतर्दृष्टि',
'conversations.agentTaskInsights.response': 'प्रतिक्रिया',
'conversations.agentTaskInsights.processSourceTitle': 'एजेंट प्रक्रिया स्रोत',
diff --git a/app/src/lib/i18n/id.ts b/app/src/lib/i18n/id.ts
index 6a29e24434..d58249cf98 100644
--- a/app/src/lib/i18n/id.ts
+++ b/app/src/lib/i18n/id.ts
@@ -3378,6 +3378,10 @@ const messages: TranslationMap = {
'conversations.subagent.statusFailed': 'gagal',
'conversations.subagent.statusAwaitingUser': 'menunggu pengguna',
'conversations.subagent.statusCancelled': 'dibatalkan',
+ 'conversations.subagent.awaitingTitle': 'Menunggu jawaban Anda',
+ 'conversations.subagent.answerPlaceholder': 'Ketik jawaban Anda',
+ 'conversations.subagent.answerSend': 'Kirim jawaban',
+ 'conversations.subagent.answerSent': 'Jawaban terkirim',
'conversations.agentTaskInsights.title': 'Wawasan tugas agen',
'conversations.agentTaskInsights.response': 'Respons',
'conversations.agentTaskInsights.processSourceTitle': 'Sumber proses agen',
diff --git a/app/src/lib/i18n/it.ts b/app/src/lib/i18n/it.ts
index 3f9a9e9487..425f28f98f 100644
--- a/app/src/lib/i18n/it.ts
+++ b/app/src/lib/i18n/it.ts
@@ -3421,6 +3421,10 @@ const messages: TranslationMap = {
'conversations.subagent.statusFailed': 'non riuscito',
'conversations.subagent.statusAwaitingUser': "in attesa dell'utente",
'conversations.subagent.statusCancelled': 'annullato',
+ 'conversations.subagent.awaitingTitle': 'In attesa della tua risposta',
+ 'conversations.subagent.answerPlaceholder': 'Scrivi la tua risposta',
+ 'conversations.subagent.answerSend': 'Invia risposta',
+ 'conversations.subagent.answerSent': 'Risposta inviata',
'conversations.agentTaskInsights.title': 'Approfondimenti attività agente',
'conversations.agentTaskInsights.response': 'Risposta',
'conversations.agentTaskInsights.processSourceTitle': "Origine del processo dell'agente",
diff --git a/app/src/lib/i18n/ko.ts b/app/src/lib/i18n/ko.ts
index 2a8e01ce65..22028fc5ab 100644
--- a/app/src/lib/i18n/ko.ts
+++ b/app/src/lib/i18n/ko.ts
@@ -3330,6 +3330,10 @@ const messages: TranslationMap = {
'conversations.subagent.statusFailed': '실패',
'conversations.subagent.statusAwaitingUser': '사용자 대기 중',
'conversations.subagent.statusCancelled': '취소됨',
+ 'conversations.subagent.awaitingTitle': '답변을 기다리는 중',
+ 'conversations.subagent.answerPlaceholder': '답변을 입력하세요',
+ 'conversations.subagent.answerSend': '답변 보내기',
+ 'conversations.subagent.answerSent': '답변을 보냈습니다',
'conversations.agentTaskInsights.title': '에이전트 작업 인사이트',
'conversations.agentTaskInsights.response': '응답',
'conversations.agentTaskInsights.processSourceTitle': '에이전트 프로세스 소스',
diff --git a/app/src/lib/i18n/pl.ts b/app/src/lib/i18n/pl.ts
index 9dfb955250..c4d3453525 100644
--- a/app/src/lib/i18n/pl.ts
+++ b/app/src/lib/i18n/pl.ts
@@ -3407,6 +3407,10 @@ const messages: TranslationMap = {
'conversations.subagent.statusFailed': 'niepowodzenie',
'conversations.subagent.statusAwaitingUser': 'oczekiwanie na użytkownika',
'conversations.subagent.statusCancelled': 'anulowano',
+ 'conversations.subagent.awaitingTitle': 'Czeka na Twoją odpowiedź',
+ 'conversations.subagent.answerPlaceholder': 'Wpisz swoją odpowiedź',
+ 'conversations.subagent.answerSend': 'Wyślij odpowiedź',
+ 'conversations.subagent.answerSent': 'Odpowiedź wysłana',
'conversations.agentTaskInsights.title': 'Wgląd w zadania agenta',
'conversations.agentTaskInsights.response': 'Odpowiedź',
'conversations.agentTaskInsights.processSourceTitle': 'Źródło procesu agenta',
diff --git a/app/src/lib/i18n/pt.ts b/app/src/lib/i18n/pt.ts
index 968177ecbc..ac48185134 100644
--- a/app/src/lib/i18n/pt.ts
+++ b/app/src/lib/i18n/pt.ts
@@ -3420,6 +3420,10 @@ const messages: TranslationMap = {
'conversations.subagent.statusFailed': 'falhou',
'conversations.subagent.statusAwaitingUser': 'aguardando usuário',
'conversations.subagent.statusCancelled': 'cancelado',
+ 'conversations.subagent.awaitingTitle': 'Aguardando sua resposta',
+ 'conversations.subagent.answerPlaceholder': 'Digite sua resposta',
+ 'conversations.subagent.answerSend': 'Enviar resposta',
+ 'conversations.subagent.answerSent': 'Resposta enviada',
'conversations.agentTaskInsights.title': 'Insights de tarefas do agente',
'conversations.agentTaskInsights.response': 'Resposta',
'conversations.agentTaskInsights.processSourceTitle': 'Fonte do processo do agente',
diff --git a/app/src/lib/i18n/ru.ts b/app/src/lib/i18n/ru.ts
index a93515fe9b..3ddebdc7bb 100644
--- a/app/src/lib/i18n/ru.ts
+++ b/app/src/lib/i18n/ru.ts
@@ -3391,6 +3391,10 @@ const messages: TranslationMap = {
'conversations.subagent.statusFailed': 'ошибка',
'conversations.subagent.statusAwaitingUser': 'ожидание пользователя',
'conversations.subagent.statusCancelled': 'отменено',
+ 'conversations.subagent.awaitingTitle': 'Ожидание вашего ответа',
+ 'conversations.subagent.answerPlaceholder': 'Введите ваш ответ',
+ 'conversations.subagent.answerSend': 'Отправить ответ',
+ 'conversations.subagent.answerSent': 'Ответ отправлен',
'conversations.agentTaskInsights.title': 'Сведения о задачах агента',
'conversations.agentTaskInsights.response': 'Ответ',
'conversations.agentTaskInsights.processSourceTitle': 'Источник процесса агента',
diff --git a/app/src/lib/i18n/zh-CN.ts b/app/src/lib/i18n/zh-CN.ts
index ed2129d007..346eb6f9b0 100644
--- a/app/src/lib/i18n/zh-CN.ts
+++ b/app/src/lib/i18n/zh-CN.ts
@@ -3177,6 +3177,10 @@ const messages: TranslationMap = {
'conversations.subagent.statusFailed': '失败',
'conversations.subagent.statusAwaitingUser': '等待用户',
'conversations.subagent.statusCancelled': '已取消',
+ 'conversations.subagent.awaitingTitle': '等待你的回答',
+ 'conversations.subagent.answerPlaceholder': '输入你的回答',
+ 'conversations.subagent.answerSend': '发送回答',
+ 'conversations.subagent.answerSent': '回答已发送',
'conversations.agentTaskInsights.title': '智能体任务洞察',
'conversations.agentTaskInsights.response': '回复',
'conversations.agentTaskInsights.processSourceTitle': '智能体处理来源',
diff --git a/app/src/providers/ChatRuntimeProvider.tsx b/app/src/providers/ChatRuntimeProvider.tsx
index 65d0d82d3d..9bc2535233 100644
--- a/app/src/providers/ChatRuntimeProvider.tsx
+++ b/app/src/providers/ChatRuntimeProvider.tsx
@@ -672,6 +672,10 @@ const ChatRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
subagentAwaitingUser({
threadId: event.thread_id,
rowId: `${event.thread_id}:subagent:${event.skill_id}:${event.tool_name}`,
+ // The core puts the child's `ask_user_clarification` question in
+ // `message` (progress_bridge.rs:1055). It is the only copy of the
+ // question the frontend ever receives.
+ question: event.message,
})
);
},
diff --git a/app/src/store/chatRuntimeSlice.ts b/app/src/store/chatRuntimeSlice.ts
index 5f3c7e4017..6bbfe75430 100644
--- a/app/src/store/chatRuntimeSlice.ts
+++ b/app/src/store/chatRuntimeSlice.ts
@@ -65,6 +65,15 @@ export interface SubagentActivity {
agentId: string;
/** High-level status: `"running"`, `"awaiting_user"`, `"completed"`, `"failed"`. */
status?: string;
+ /**
+ * The question the sub-agent asked via `ask_user_clarification`, carried on
+ * the `subagent_awaiting_user` event's `message`. Present only while
+ * `status === 'awaiting_user'`; cleared when the delegation resumes.
+ *
+ * Without it the pause is unreadable: the UI can say the child is blocked
+ * but not what on, and the user has nothing to answer.
+ */
+ awaitingQuestion?: string;
/** Human-readable display name from the agent registry (e.g. "Researcher"). */
displayName?: string;
/**
@@ -1468,7 +1477,23 @@ const chatRuntimeSlice = createSlice({
// Idempotent: a socket redelivery must not append a second row with the
// same id (later updates find only the first). Not gated by the provider's
// event-seen map, so guard here.
- if (entries.some(e => e.id === rowId)) return;
+ const existing = entries.find(e => e.id === rowId);
+ if (existing) {
+ // ...with one exception. `continue_subagent` republishes
+ // `subagent_spawned` for the SAME task/agent when it resumes a paused
+ // child (continue_subagent.rs:330), and that is the only signal the
+ // frontend gets that the pause is over. Swallowing it left the row
+ // stuck on `awaiting_user` for the rest of the run: the card kept
+ // asking a question the user had already answered.
+ if (existing.status === 'awaiting_user') {
+ existing.status = 'running';
+ if (existing.subagent) {
+ existing.subagent.status = 'running';
+ existing.subagent.awaitingQuestion = undefined;
+ }
+ }
+ return;
+ }
const pending = findPendingDelegationContext(entries, round);
// Collapse the parent spawn/delegate row into the subagent row so the
// timeline shows one entry per delegation.
@@ -1501,13 +1526,22 @@ const chatRuntimeSlice = createSlice({
})
);
},
- subagentAwaitingUser: (state, action: PayloadAction<{ threadId: string; rowId: string }>) => {
+ subagentAwaitingUser: (
+ state,
+ action: PayloadAction<{ threadId: string; rowId: string; question?: string }>
+ ) => {
const entry = state.toolTimelineByThread[action.payload.threadId]?.find(
e => e.id === action.payload.rowId && e.status === 'running'
);
if (!entry) return;
entry.status = 'awaiting_user';
- if (entry.subagent) entry.subagent.status = 'awaiting_user';
+ if (entry.subagent) {
+ entry.subagent.status = 'awaiting_user';
+ // The question is the whole point of the pause. Keep the previous one
+ // if this event carried none rather than blanking a readable prompt.
+ const question = action.payload.question?.trim();
+ if (question) entry.subagent.awaitingQuestion = question;
+ }
},
subagentDone: (
state,