Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { useMessageContext } from '~/Providers/MessageContext';
import { useShareContext } from '~/Providers/ShareContext';
import MessageIcon from '~/components/Share/MessageIcon';
import { MCPAppViews } from '~/components/MCPUIResource';
import { useMCPServerNames } from '~/hooks/MCP';
import { useLocalize } from '~/hooks';

const agentMessage = { endpoint: EModelEndpoint.agents, isCreatedByUser: false } as TMessage;
Expand All @@ -28,7 +27,6 @@ export default function SubagentCall(props: SubagentCallProps) {
const message = useMessageContext();
const share = useShareContext();
const agentsMap = useAgentsMapContext();
const mcpServerNames = useMCPServerNames();
const translate = useLocalize();
const localize = useCallback<SubagentCallContext['localize']>(
(key, values) => translate(key as TranslationKeys, values),
Expand All @@ -40,7 +38,6 @@ export default function SubagentCall(props: SubagentCallProps) {
{...share}
message={message}
agentsMap={agentsMap}
mcpServerNames={mcpServerNames}
localize={localize}
renderAgentIcon={renderAgentIcon}
renderAttachments={renderAttachments}
Expand Down
5 changes: 0 additions & 5 deletions client/src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -3500,11 +3500,6 @@
"com_ui_subagent_trigger_truncated": "Trigger summary shortened for display.",
"com_ui_subagent_turn": "Turn",
"com_ui_subagent_running": "Running agent",
"com_ui_subagent_ticker_error": "Error",
"com_ui_subagent_ticker_reasoning": "Reasoning",
"com_ui_subagent_ticker_tool_done": "done",
"com_ui_subagent_ticker_using": "Using",
"com_ui_subagent_ticker_writing": "Writing",
"com_ui_subagent_waiting": "Working…",
"com_ui_submit": "Submit",
"com_ui_submit_decisions": "Submit {{0}} decisions",
Expand Down
43 changes: 30 additions & 13 deletions e2e/specs/mock/subagent-activity.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,29 @@ test.describe('detached subagent activity', () => {
await expect(cards).toHaveCount(2, { timeout: 30_000 });
await expect(cards.first()).toHaveAttribute('data-subagent-thread', /.+/);
const firstThreadId = (await cards.first().getAttribute('data-subagent-thread')) ?? '';
const threadReadPromise = page.waitForResponse((candidate) => {
const read = THREAD_MESSAGES_PATH.exec(new URL(candidate.url()).pathname);
return read != null && decodeURIComponent(read[1]) === firstThreadId;
});
const attachesOf = (threadId: string) =>
streamAttaches.filter((attached) => attached === threadId).length;

/** With no panel open, each running child's card shows the row its thread is on: the
* thread's own content, drawn by the thread's renderer, one row at a time. The page
* follows each child once for that. */
const rows = page.locator('[data-subagent-preview]');
await expect(rows).toHaveCount(2, { timeout: 30_000 });
await expect(rows.first()).toContainText(/child-1-phase-\d+/);
await expect(rows.nth(1)).toContainText(/child-2-phase-\d+/);
await expect(cards.first()).toContainText('Running');
await expect.poll(() => messageReads).toContain(firstThreadId);
/** A collapsed group shows no cards and follows nothing, so the count so far depends on
* how long the group stood open before the parent's turn ended. What is fixed is that the
* child is being followed now, and that opening it adds no stream of its own. */
const followedByCard = attachesOf(firstThreadId);
expect(followedByCard).toBeGreaterThanOrEqual(1);
await cards.first().click();

/** The child's thread opens as a conversation: its messages, read through the parent, and
* its own generation stream while it runs. The bounded activity feed is not read at all. */
* the generation stream the card was already reading. The bounded activity feed is not
* read at all. */
const panel = childActivityPanel(page);
expect((await threadReadPromise).ok()).toBeTruthy();
await expect(panel).toBeVisible();
await expect(panel).toContainText('child-1-phase-10');
await expect(panel.getByText('Running', { exact: true })).toHaveCount(0);
Expand All @@ -182,12 +195,13 @@ test.describe('detached subagent activity', () => {
timeout: 30_000,
});
await expect(panel.getByText('Completed', { exact: true })).toHaveCount(0);
const attachesOf = (threadId: string) =>
streamAttaches.filter((attached) => attached === threadId).length;
/** At most one attachment, and none added once the run is over: a finished child is read
* from its stored messages, and a running one is followed by a single stream. */
/** One attachment for the card and the panel together, and none added once the run is
* over: a finished child is read from its stored messages. Its card drops its row. */
const attaches = attachesOf(firstThreadId);
expect(attaches).toBeLessThanOrEqual(1);
expect(attaches).toBe(followedByCard);
await expect(
cards.first().locator('xpath=..').locator('[data-subagent-preview]'),
).toHaveCount(0);
await page.waitForTimeout(ACTIVITY_RECONNECT_GUARD_MS);
expect(attachesOf(firstThreadId)).toBe(attaches);
expect(messageReads).toContain(firstThreadId);
Expand Down Expand Up @@ -228,9 +242,12 @@ test.describe('detached subagent activity', () => {
});
});

/** A subagent card's row is a picture of the child's thread, not part of this one: its folds
* take no pointer and are not this history's to expand. */
const NOT_A_PREVIEW = ':not([data-subagent-preview] *)';
const HISTORY_FOLDS =
'[data-fold-root] > div > button[aria-expanded="false"]:visible, ' +
'[data-testid="activity-phase-card"] > div > div > button[aria-expanded="false"]:visible';
`[data-fold-root] > div > button[aria-expanded="false"]${NOT_A_PREVIEW}:visible, ` +
`[data-testid="activity-phase-card"] > div > div > button[aria-expanded="false"]${NOT_A_PREVIEW}:visible`;

/** How long a click waits for a fold that was counted a moment ago. */
const FOLD_CLICK_TIMEOUT_MS = 1_000;
Expand Down
Loading
Loading