Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ export function AgentTaskCard({
: resultIsClaudeLaunchReceipt
? detailText(update?.summary)
: detailText(result, update?.summary);
const showEmptyCodexDetails = isSubagent && provider === 'codex'
&& !description && !summary && !update?.lastToolName && !update?.outputFile;
const piResultNeedsCollapse = Boolean(
isPiDurableSubagent
&& summary
Expand Down Expand Up @@ -612,6 +614,7 @@ export function AgentTaskCard({
expanded={expanded}
/>
)}
{showEmptyCodexDetails && <p>{t('chat.agentTask.noDetailsAvailable')}</p>}
{description && <p className="mb-1">{description}</p>}
{summary && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
// Codex 此前没有数据源、只能渲染一句「已启动」就地收口。补上子线程实时事件后,两者必须
// 长得一样 —— 同样的 provider·状态·tokens·工具调用数·耗时,且 codex 不多出冗余文案。

import { render } from '@testing-library/react';
import type { ReactNode } from 'react';
import { fireEvent, render } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';

vi.mock('react-i18next', () => ({
Expand All @@ -17,10 +16,6 @@ vi.mock('react-i18next', () => ({
}),
}));

vi.mock('@/hooks/useExpandedBlockMemory', () => ({
useExpandedBlockMemory: () => ({ expanded: false, setExpanded: vi.fn() }),
}));

vi.mock('@/lib/makerTransport', () => ({
getWorkflowProgressFor: vi.fn(async () => null),
isRemoteSessionSticky: () => false,
Expand All @@ -46,10 +41,6 @@ vi.mock('@/features/cc-agent/embeddedSessionNavigation', () => ({
useSidebarPanelReachable: () => false,
}));

vi.mock('@/components/ui/collapse', () => ({
Collapse: ({ children }: { children: ReactNode }) => <>{children}</>,
}));

vi.mock('@/lib/modelShortLabel', () => ({
formatModelShortLabel: (model?: string | null) => model ?? undefined,
}));
Expand Down Expand Up @@ -107,7 +98,8 @@ describe('AgentTaskCard codex subagent live state', () => {

it('keeps the localized receipt for history replay (no live update)', () => {
// 历史回放拿不到 live update(agent_task_update 不落库),回执是唯一可读摘要。
const { container } = render(<AgentTaskCard toolCall={spawnToolCall()} result="/root/scout" />);
const { container, getByRole } = render(<AgentTaskCard toolCall={{ ...spawnToolCall(), clientId: 'history' }} result="/root/scout" />);
fireEvent.click(getByRole('button', { name: 'chat.agentTask.showDetails' }));
expect(container.textContent ?? '').toContain('chat.agentTask.subagentStarted');
expect(container.textContent ?? '').not.toContain('/root/');
});
Expand All @@ -124,4 +116,22 @@ describe('AgentTaskCard codex subagent live state', () => {
expect(text).toContain('chat.agentTask.status.completed');
expect(text).not.toContain('chat.agentTask.status.running');
});
it.each(['running', 'completed'] as const)('gives an expanded %s Codex card a useful empty state', (status) => {
const toolCall = { ...spawnToolCall(), clientId: `empty-${status}` };
const { getByRole, getByText, queryByText, rerender } = render(
<AgentTaskCard toolCall={toolCall} result="/root/scout" update={{ ...liveCodexUpdate, status }} />,
);
const emptyDetails = 'chat.agentTask.noDetailsAvailable';
expect(queryByText(emptyDetails)).toBeNull();

fireEvent.click(getByRole('button', { name: 'chat.agentTask.showDetails' }));

expect(getByText(emptyDetails)).toBeTruthy();
rerender(
<AgentTaskCard toolCall={toolCall} result="/root/scout"
update={{ ...liveCodexUpdate, status: 'completed', summary: 'R=42' }} />,
);
expect(getByText('R=42')).toBeTruthy();
expect(queryByText(emptyDetails)).toBeNull();
});
});
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/i18n/locales/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -15163,6 +15163,7 @@
"subagentStarted": "Subagent {{name}} gestartet",
"showDetails": "Subagent-Details anzeigen",
"hideDetails": "Subagent-Details ausblenden",
"noDetailsAvailable": "Keine Details verfügbar.",
"showFullResult": "Vollständiges Ergebnis anzeigen",
"hideFullResult": "Ergebnis einklappen",
"provider": {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -15200,6 +15200,7 @@
"subagentStarted": "Subagent {{name}} started",
"showDetails": "Show subagent details",
"hideDetails": "Hide subagent details",
"noDetailsAvailable": "No details available.",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 为详情空态补充可执行的下一步

当用户展开只有状态和计数的 Codex 卡片时,尤其是已经完成的卡片,唯一反馈只是“暂无可展示的详情”,没有说明用户接下来可以做什么。根 AGENTS.md 指定的权威规范 docs/design-rules/DESIGN.md §11.1 明确要求空态指向第一步操作,不能仅说明无数据。请根据现有能力补充可行的结果查看指引或下一步,并同步全部语言;不要承诺尚未实现的正文采集或无依据的重试。

AGENTS.md reference: AGENTS.md:L58-L59

Useful? React with 👍 / 👎.

"showFullResult": "Show full result",
"hideFullResult": "Collapse result",
"provider": {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/i18n/locales/es/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -15290,6 +15290,7 @@
"subagentStarted": "Subagent {{name}} iniciado",
"showDetails": "Mostrar detalles de Subagent",
"hideDetails": "Ocultar detalles de Subagent",
"noDetailsAvailable": "No hay detalles disponibles.",
"showFullResult": "Mostrar resultado completo",
"hideFullResult": "Contraer resultado",
"provider": {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/i18n/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -15290,6 +15290,7 @@
"subagentStarted": "Sous-Agent {{name}} démarré",
"showDetails": "Afficher les détails du sous-Agent",
"hideDetails": "Masquer les détails du sous-Agent",
"noDetailsAvailable": "Aucun détail disponible.",
"showFullResult": "Afficher le résultat complet",
"hideFullResult": "Réduire le résultat",
"provider": {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/i18n/locales/ja/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -15139,6 +15139,7 @@
"subagentStarted": "サブエージェント {{name}} を起動しました",
"showDetails": "サブエージェント詳細を表示",
"hideDetails": "サブエージェント詳細を隠す",
"noDetailsAvailable": "表示できる詳細はありません。",
"showFullResult": "結果をすべて表示",
"hideFullResult": "結果を折りたたむ",
"provider": {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/i18n/locales/ko/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -15139,6 +15139,7 @@
"subagentStarted": "하위 에이전트 {{name}} 시작됨",
"showDetails": "하위 에이전트 세부 정보 보기",
"hideDetails": "하위 에이전트 세부 정보 숨기기",
"noDetailsAvailable": "표시할 세부 정보가 없습니다.",
"showFullResult": "전체 결과 보기",
"hideFullResult": "결과 접기",
"provider": {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/i18n/locales/pt-BR/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -15290,6 +15290,7 @@
"subagentStarted": "Subagent {{name}} iniciado",
"showDetails": "Mostrar detalhes do Subagent",
"hideDetails": "Ocultar detalhes do Subagent",
"noDetailsAvailable": "Não há detalhes disponíveis.",
"showFullResult": "Mostrar resultado completo",
"hideFullResult": "Recolher resultado",
"provider": {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/i18n/locales/pt-PT/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -15290,6 +15290,7 @@
"subagentStarted": "Subagent {{name}} iniciado",
"showDetails": "Mostrar detalhes do Subagent",
"hideDetails": "Ocultar detalhes do Subagent",
"noDetailsAvailable": "Não há detalhes disponíveis.",
"showFullResult": "Mostrar resultado completo",
"hideFullResult": "Recolher resultado",
"provider": {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -15139,6 +15139,7 @@
"subagentStarted": "Subagent {{name}} 已启动",
"showDetails": "展开 Subagent 详情",
"hideDetails": "收起 Subagent 详情",
"noDetailsAvailable": "暂无可展示的详情",
"showFullResult": "展开完整结果",
"hideFullResult": "收起结果",
"provider": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15130,6 +15130,7 @@
"subagentStarted": "Subagent {{name}} 已启",
"showDetails": "展 Subagent 详情",
"hideDetails": "收 Subagent 详情",
"noDetailsAvailable": "暂无详情可示。",
"showFullResult": "展全果",
"hideFullResult": "收其果",
"provider": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15130,6 +15130,7 @@
"subagentStarted": "Subagent {{name}} 已啟",
"showDetails": "展 Subagent 詳情",
"hideDetails": "收 Subagent 詳情",
"noDetailsAvailable": "暫無詳情可示。",
"showFullResult": "展全果",
"hideFullResult": "收其果",
"provider": {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -15138,6 +15138,7 @@
"subagentStarted": "Subagent {{name}} 已啟動",
"showDetails": "展開 Subagent 詳情",
"hideDetails": "收起 Subagent 詳情",
"noDetailsAvailable": "暫無可顯示的詳細資料",
"showFullResult": "展開完整結果",
"hideFullResult": "收起結果",
"provider": {
Expand Down
Loading