Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

Revert "fix(desktop): 优化自动运行失败提示并移除任务错误红点 (#4732)"

MagicLizi005680e60ea2
diff --git a/apps/desktop/src/renderer/__tests__/automationGeneratedSessions.test.ts b/apps/desktop/src/renderer/__tests__/automationGeneratedSessions.test.ts
index 0d5ebdd653..6f95053446 100644
--- a/apps/desktop/src/renderer/__tests__/automationGeneratedSessions.test.ts
+++ b/apps/desktop/src/renderer/__tests__/automationGeneratedSessions.test.ts
@@ -962,8 +962,8 @@ describe('automation-generated sessions', () => {
expect(source).toContain('ccAgent.sidebar.automationGroup.menu.resume');
expect(source).toContain('ccAgent.sidebar.automationGroup.menu.delete');
expect(source).toContain('scheduleFocusPath(group.scheduleId)');
- // 组头始终打开最新运行,错误运行通过独立子行打开。
- expect(source).toContain('const targetId = latestSessionId;');
+ // 组头点击:展开打开最新一条;收起且整组是红时打开贡献红点的那条。
+ expect(source).toContain('resolveCollapsedGroupHeaderSessionId({');
expect(source).toContain('onSessionClick(targetId)');
expect(source).toContain('getAutomationGroupLatestSession(group)');
expect(source).toContain('visibleSessionIds: visibleSessions.map((session) => session.id)');
diff --git a/apps/desktop/src/renderer/__tests__/botGroupLampRendering.test.tsx b/apps/desktop/src/renderer/__tests__/botGroupLampRendering.test.tsx
index 608c5f3482..685daad20d 100644
--- a/apps/desktop/src/renderer/__tests__/botGroupLampRendering.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/botGroupLampRendering.test.tsx
@@ -85,7 +85,7 @@ function activity(phase: typeof phases[number]) {
}
describe.each([false, true])('Bot groups with device grouping %s', (groupDevice) => {
- it.each(phases)('renders the collapsed Bot header indicator for remote %s', (phase) => {
+ it.each(phases)('renders the collapsed Bot header lamp for remote %s', (phase) => {
activity(phase);
render(<ProjectsSection {...props(groupDevice)} />);
expect(Boolean(screen.queryByText('Remote device'))).toBe(groupDevice);
@@ -99,12 +99,9 @@ describe.each([false, true])('Bot groups with device grouping %s', (groupDevice)
const marker = header.querySelector('[data-running-marker]')!;
expect(marker.getAttribute('data-running-marker')).toBe('ring');
expect(marker.className).toContain('ring-[var(--status-bar-accent)]');
- } else if (phase === 'error') {
- expect(header.querySelector('[class*="--card-status-"]')).toBeNull();
- expect(header.querySelector('[data-running-marker]')).toBeNull();
} else {
expect(header.querySelector('[data-running-marker]')).toBeNull();
- const tone = phase === 'needs-interaction' ? 'awaiting' : 'done';
+ const tone = phase === 'needs-interaction' ? 'awaiting' : phase === 'error' ? 'error' : 'done';
expect(header.querySelector(`[class*="--card-status-${tone}"]`)).not.toBeNull();
}
});
@@ -152,7 +149,7 @@ function deviceHeader(name: string) { return screen.getByText(name).closest('but
function expectLamp(header: Element, phase: typeof phases[number] | null) {
expect(Boolean(header.querySelector('.session-status-breathing'))).toBe(phase === 'running');
for (const tone of ['awaiting', 'error', 'done']) {
- const expected = phase === 'needs-interaction' ? 'awaiting' : phase === 'completed' ? 'done' : null;
+ const expected = phase === 'needs-interaction' ? 'awaiting' : phase === 'completed' ? 'done' : phase;
expect(Boolean(header.querySelector(`[class*="--card-status-${tone}"], [data-sidebar-right-status="${tone}"]`))).toBe(tone === expected);
}
}
diff --git a/apps/desktop/src/renderer/__tests__/projectCollapsedAttention.test.ts b/apps/desktop/src/renderer/__tests__/projectCollapsedAttention.test.ts
index c54b0c5e13..dfe4bcb5e7 100644
--- a/apps/desktop/src/renderer/__tests__/projectCollapsedAttention.test.ts
+++ b/apps/desktop/src/renderer/__tests__/projectCollapsedAttention.test.ts
@@ -7,6 +7,7 @@ import type { AttentionKind } from '@/lib/sessionAttentionStore';
import type { RemoteSessionActivityPhase } from '@/features/device-link/remoteSessionActivityStore';
import {
resolveCollapsedAttention,
+ resolveCollapsedGroupHeaderSessionId,
resolveCollapsedGroupRightStatus,
resolveCollapsedProjectAttentionTone,
} from '../features/cc-agent/sidebar/projectCollapsedAttention';
@@ -87,15 +88,15 @@ describe('collapsed project attention tone', () => {
expect(resolve({ remotePhases: [['session-1', 'completed']] })).toBe('done');
});
- it('does not show dots for local errors, urgent schedules, or remote errors', () => {
+ it('shows red for local errors, urgent schedules, and remote errors', () => {
expect(
resolve({ notifications: ['session-1'], attentionKinds: [['session-1', 'error']] }),
- ).toBe(null);
- expect(resolve({ urgent: ['session-1'] })).toBe(null);
- expect(resolve({ remotePhases: [['session-1', 'error']] })).toBe(null);
+ ).toBe('error');
+ expect(resolve({ urgent: ['session-1'] })).toBe('error');
+ expect(resolve({ remotePhases: [['session-1', 'error']] })).toBe('error');
});
- it('keeps successful unread results visible alongside errors', () => {
+ it('gives red priority when red and green children coexist', () => {
expect(
resolve({
ids: ['done', 'error'],
@@ -105,7 +106,7 @@ describe('collapsed project attention tone', () => {
['error', 'error'],
],
}),
- ).toBe('done');
+ ).toBe('error');
});
it('treats a remote running state as authoritative over stale local attention', () => {
@@ -130,7 +131,7 @@ describe('collapsed project attention tone', () => {
});
describe('collapsed attention alert ids', () => {
- it('keeps failed children discoverable without a red dot', () => {
+ it('names every child that contributes the red dot, across all three sources', () => {
const summary = summarize({
ids: ['local-error', 'urgent-schedule', 'remote-error', 'done-child', 'idle-child'],
notifications: ['local-error', 'done-child'],
@@ -141,7 +142,7 @@ describe('collapsed attention alert ids', () => {
urgent: ['urgent-schedule'],
remotePhases: [['remote-error', 'error']],
});
- expect(summary.tone).toBe('done');
+ expect(summary.tone).toBe('error');
expect([...summary.errorSessionIds]).toEqual([
'local-error',
'urgent-schedule',
@@ -231,9 +232,11 @@ describe('collapsed project attention wiring', () => {
});
it('feeds the automation group header and its collapsed rows from the same summary', () => {
- // 汇总仅补完成绿点;错误子行仍由同一份汇总记录决定。
+ // 组头红点与收起态提上来的告警行必须同源 —— 判据分家就会重演「项目行有红点、
+ // 展开后哪一行都没有」。
expect(automationGroupSource).toContain('resolveCollapsedAttention({');
expect(automationGroupSource).toContain('resolveCollapsedGroupRightStatus({');
+ expect(automationGroupSource).toContain('resolveCollapsedGroupHeaderSessionId({');
expect(automationGroupSource).toMatch(/tone:\s*collapsedAttention\.tone/);
expect(automationGroupSource).toMatch(/new Set\(collapsedAttention\.errorSessionIds\)/);
expect(automationGroupSource).toContain('alertSessionIds,');
@@ -253,6 +256,31 @@ describe('collapsed project attention wiring', () => {
expect(automationGroupSource).toMatch(/useRemoteSessionsPhaseMap\(group.sessions\)/);
});
+ it('opens the unread-failed session from a collapsed red group header', () => {
+ const attention = { tone: 'error' as const, errorSessionIds: ['run-old'] };
+ expect(
+ resolveCollapsedGroupHeaderSessionId({
+ collapsed: true,
+ latestSessionId: 'run-new',
+ attention,
+ }),
+ ).toBe('run-old');
+ expect(
+ resolveCollapsedGroupHeaderSessionId({
+ collapsed: false,
+ latestSessionId: 'run-new',
+ attention,
+ }),
+ ).toBe('run-new');
+ expect(
+ resolveCollapsedGroupHeaderSessionId({
+ collapsed: true,
+ latestSessionId: 'run-new',
+ attention: { tone: 'done', errorSessionIds: [] },
+ }),
+ ).toBe('run-new');
+ });
+
it('feeds both regular and pinned project rows from their displayed children', () => {
expect(projectsSectionSource).toContain(
'collapsed.has(project.projectKey) ? collapsedAttentionToneFor(project.sessions) : null',
diff --git a/apps/desktop/src/renderer/__tests__/projectLampMerge.test.tsx b/apps/desktop/src/renderer/__tests__/projectLampMerge.test.tsx
index 8dacf1da88..d354b10087 100644
--- a/apps/desktop/src/renderer/__tests__/projectLampMerge.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/projectLampMerge.test.tsx
@@ -78,7 +78,7 @@ describe('project lamp after upstream sidebar merge', () => {
});
it.each([null, 'done', 'error'] as const)(
- 'keeps awaiting visible alongside %s',
+ 'shows awaiting ahead of %s unless an error needs attention',
(collapsedAttentionTone) => {
const { container } = render(
<ProjectNode
@@ -88,7 +88,7 @@ describe('project lamp after upstream sidebar merge', () => {
/>,
);
const header = container.querySelector('[data-project-header]')!;
- const tone = 'awaiting';
+ const tone = collapsedAttentionTone === 'error' ? 'error' : 'awaiting';
expect(header.querySelector(`[data-sidebar-right-status="${tone}"]`)).not.toBeNull();
expect(header.querySelectorAll('.rounded-full')).toHaveLength(1);
},
diff --git a/apps/desktop/src/renderer/__tests__/remoteInterruptedAttention.test.ts b/apps/desktop/src/renderer/__tests__/remoteInterruptedAttention.test.ts
index 8ffa9699e6..fdf0555ddf 100644
--- a/apps/desktop/src/renderer/__tests__/remoteInterruptedAttention.test.ts
+++ b/apps/desktop/src/renderer/__tests__/remoteInterruptedAttention.test.ts
@@ -13,7 +13,7 @@ const interruption = {
};
describe('persisted interruption on remote Desktop', () => {
- it('keeps interrupted tasks without a red dot', () => {
+ it('keeps the red dot after reading without relying on the local notification store', () => {
const input = {
sessionId: 'remote',
interruption,
@@ -22,7 +22,7 @@ describe('persisted interruption on remote Desktop', () => {
isRunning: false,
hasAttentionNotification: false,
};
- expect(resolveSidebarRightStatus(projectSidebarSessionActivity(input))).toBe('time');
+ expect(resolveSidebarRightStatus(projectSidebarSessionActivity(input))).toBe('error');
expect(
resolveSidebarRightStatus(
projectSidebarSessionActivity({
@@ -42,7 +42,7 @@ describe('persisted interruption on remote Desktop', () => {
urgentSessionIds: new Set<string>(),
remotePhaseOf: () => undefined,
};
- expect(resolveCollapsedAttention(input)).toEqual({ tone: null, errorSessionIds: ['old'] });
+ expect(resolveCollapsedAttention(input)).toEqual({ tone: 'error', errorSessionIds: ['old'] });
expect(
resolveCollapsedAttention({
...input,
diff --git a/apps/desktop/src/renderer/__tests__/sidebarAttentionBadge.test.ts b/apps/desktop/src/renderer/__tests__/sidebarAttentionBadge.test.ts
index 99690d65de..b3c4c7b72e 100644
--- a/apps/desktop/src/renderer/__tests__/sidebarAttentionBadge.test.ts
+++ b/apps/desktop/src/renderer/__tests__/sidebarAttentionBadge.test.ts
@@ -4,7 +4,8 @@
* sidebarAttentionBadge.test.ts
* ---------------------------------------------------------------------------
* 回归覆盖:
- * - 任务入口隐藏 error,保留 awaiting > running > 完成未读(done)。
+ * - 右侧状态槽优先级必须是 error > awaiting > running > 完成未读(done)。
+ * error 与 awaiting 拆成两档(红 / TapTap 蓝),同为"需要处理"压过 spinner。
* - plan / ask-user / permission prompt 可能在会话仍标记 running 时到达,
* 左侧状态图标的关注状态点在这种状态下仍必须可见。
*/
@@ -19,9 +20,6 @@ import {
resolveSidebarRightStatus,
} from '../features/cc-agent/sidebar/sidebarRightStatus';
import { SessionStatusIcon } from '../features/cc-agent/sidebar/SessionStatusIcon';
-import { addSessionAttention, clearSessionAttention } from '@/lib/sessionAttentionStore';
-import { SessionAttentionUrgencyProvider } from '../features/cc-agent/contexts/SessionAttentionUrgencyContext';
-import { SidebarRightStatusIndicator } from '../features/cc-agent/sidebar/SidebarRightStatusIndicator';
const sidebarState = vi.hoisted(() => ({
hasDraft: false,
@@ -52,7 +50,6 @@ vi.mock('@/components/sidebar/VendorIcon', () => ({
afterEach(() => {
cleanup();
- clearSessionAttention(session.id, { intent: 'explicit' });
sidebarState.hasDraft = false;
sidebarState.hasPausedQueue = false;
});
@@ -72,49 +69,17 @@ function attentionDot(container: HTMLElement): Element | undefined {
}
describe('sidebar right status priority', () => {
- it('renders no error dot in either sidebar indicator', () => {
- for (const isActive of [false, true]) {
- const view = render(createElement(SidebarRightStatusIndicator, { kind: 'error', isActive }));
- expect(view.container.firstChild).toBeNull();
- view.unmount();
- }
- const view = render(createElement(SessionStatusIcon, {
- session, isRunning: false, isAttached: false, hasAttentionNotification: true,
- isActive: false, attentionToneOverride: 'error',
- }));
- expect(attentionDot(view.container)).toBeUndefined();
- });
- it.each([false, true])('keeps pending input visible with old failure urgency (running=%s)', (isRunning) => {
- for (const live of [false, true]) {
- const activity = projectSidebarSessionActivity({
- sessionId: session.id,
- attentionKind: live ? undefined : 'awaiting',
- liveActivity: live ? { phase: 'needs-interaction' } : null,
- isUrgentFromContext: true, isRunning, hasAttentionNotification: !live,
- });
- expect(activity.phase).toBe('error');
- expect(resolveSidebarRightStatus(activity)).toBe('awaiting');
- }
- addSessionAttention(session.id, 'awaiting');
- const view = render(createElement(SessionAttentionUrgencyProvider, {
- urgentSessionIds: new Set([session.id]),
- children: createElement(SessionStatusIcon, {
- session, isRunning, isAttached: false, hasAttentionNotification: true, isActive: false,
- }),
- }));
- expect(attentionDot(view.container)?.className).toContain('--card-status-awaiting');
- });
- it('hides errors while preserving running, awaiting and unread results', () => {
+ it('keeps error/awaiting above running and running above unread-done', () => {
const resolve = (input: Parameters<typeof projectSidebarSessionActivity>[0]) =>
resolveSidebarRightStatus(projectSidebarSessionActivity(input));
- // 错误不再显示红点;当前运行仍显示 spinner
+ // error(chat 侧错误终止)压过 running 与其它一切
expect(resolve({
sessionId: 'session-1',
attentionKind: 'error',
isUrgentFromContext: false,
isRunning: true,
hasAttentionNotification: true,
- })).toBe('running');
+ })).toBe('error');
const runningWithStaleError = projectSidebarSessionActivity({
sessionId: 'session-1',
attentionKind: 'error',
@@ -127,7 +92,7 @@ describe('sidebar right status priority', () => {
attention: true,
currentTurnActive: true,
});
- expect(resolveSidebarRightStatus(runningWithStaleError)).toBe('running');
+ expect(resolveSidebarRightStatus(runningWithStaleError)).toBe('error');
// device-link 镜像可以同时保留 stale error 与新一轮运行 facet;本地
// isRunning 对远程会话恒 false,仍须让左侧 vendor mark 保持呼吸。
const remoteRunningWithStaleError = projectSidebarSessionActivity({
@@ -147,7 +112,7 @@ describe('sidebar right status priority', () => {
attention: true,
currentTurnActive: true,
});
- expect(resolveSidebarRightStatus(remoteRunningWithStaleError)).toBe('running');
+ expect(resolveSidebarRightStatus(remoteRunningWithStaleError)).toBe('error');
// 定时任务失败未读(attentionKind 缺失,由 urgency context 注入)同样是 error 档
expect(resolve({
sessionId: 'session-1',
@@ -155,7 +120,7 @@ describe('sidebar right status priority', () => {
isUrgentFromContext: true,
isRunning: true,
hasAttentionNotification: true,
- })).toBe('running');
+ })).toBe('error');
expect(projectSidebarSessionActivity({
sessionId: 'session-1',
liveActivity: { phase: 'running' },
@@ -169,22 +134,22 @@ describe('sidebar right status priority', () => {
currentTurnActive: true,
});
// automation failure urgency is durable outside the notification store:
- // the activity retains the error, but the sidebar does not display a red dot.
+ // after restart, unread expiry or acknowledgement it must still stay red.
expect(resolve({
sessionId: 'session-1',
attentionKind: undefined,
isUrgentFromContext: true,
isRunning: false,
hasAttentionNotification: false,
- })).toBe('time');
+ })).toBe('error');
expect(resolve({
sessionId: 'session-1',
attentionKind: 'done',
isUrgentFromContext: true,
isRunning: false,
hasAttentionNotification: false,
- })).toBe('time');
- // awaiting(ask-user / 权限 / 计划审阅)不被旧错误或 running 遮住
+ })).toBe('error');
+ // awaiting(ask-user / 权限 / 计划审阅)压过 running,但低于 error
expect(resolve({
sessionId: 'session-1',
attentionKind: 'awaiting',
diff --git a/apps/desktop/src/renderer/__tests__/unreadFailedScheduleBanner.test.tsx b/apps/desktop/src/renderer/__tests__/unreadFailedScheduleBanner.test.tsx
index e7dfbe03d0..fd8cf6c706 100644
--- a/apps/desktop/src/renderer/__tests__/unreadFailedScheduleBanner.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/unreadFailedScheduleBanner.test.tsx
@@ -71,23 +71,6 @@ afterEach(() => {
});
describe('historical failed schedule notice', () => {
- it('opens the failed run automation without dismissing the notice', () => {
- const onViewDetails = vi.fn();
- render(<UnreadFailedScheduleBanner dataOwnerId="owner" sessionId="session"
- latestFailedRun={{ runId: 'failed', firedAt: 1, scheduleId: 'schedule-failed' }}
- onViewDetails={onViewDetails} />);
- fireEvent.click(screen.getByRole('button', { name: 'chat.unreadFailedScheduleBanner.viewDetails' }));
- expect(onViewDetails).toHaveBeenCalledWith('schedule-failed');
- expect(screen.queryByTestId('unread-failed-schedule-banner')).not.toBeNull();
- expect(localStorage.length).toBe(0);
- });
-
- it('has no details action when the schedule identity is unavailable', () => {
- render(<UnreadFailedScheduleBanner dataOwnerId="owner" sessionId="session"
- latestFailedRun={{ runId: 'legacy', firedAt: 1 }} onViewDetails={vi.fn()} />);
- expect(screen.queryByRole('button', { name: 'chat.unreadFailedScheduleBanner.viewDetails' })).toBeNull();
- });
-
it('distinguishes precheck failures while preserving the warning', () => {
render(<UnreadFailedScheduleBanner dataOwnerId="owner" sessionId="session"
latestFailedRun={{ runId: 'failed', firedAt: 1, failureKind: 'rate-limit', scheduleId: 'schedule' }} />);
diff --git a/apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx b/apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx
index f18482571f..102754a30b 100644
--- a/apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx
+++ b/apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx
@@ -16,7 +16,6 @@ interface BannerProps {
dataOwnerId: string | null;
sessionId: string;
latestFailedRun: FailedScheduleRunSnapshot;
- onViewDetails?: (scheduleId: string) => void;
className?: string;
style?: CSSProperties;
}
@@ -35,12 +34,10 @@ function FailedScheduleNotice({
dataOwnerId,
sessionId,
latestFailedRun,
- onViewDetails,
className,
style,
}: BannerProps) {
const { t } = useTranslation();
- const scheduleId = latestFailedRun.scheduleId;
// 关闭是本机 UI 偏好,不修改运行记录或已读回执。
const prefix = dataOwnerId ? failedScheduleDismissalPrefix(dataOwnerId, sessionId) : null;
const [dismissedRun, setDismissedRun] = useState(() =>
@@ -95,16 +92,6 @@ function FailedScheduleNotice({
<span className="flex-1 min-w-0 text-xs break-all text-[var(--error-fg)]">
{t(`chat.unreadFailedScheduleBanner.${scheduleFailureMessageKey(latestFailedRun)}`)}
</span>
- {scheduleId && onViewDetails && (
- <button
- type="button"
- data-split-pane-route-action=""
- onClick={() => onViewDetails(scheduleId)}
- className="shrink-0 cursor-pointer text-xs text-[var(--error-fg)] underline underline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--focus-ring)]"
- >
- {t('chat.unreadFailedScheduleBanner.viewDetails')}
- </button>
- )}
<Tip text={t('chat.unreadFailedScheduleBanner.dismissTitle')}>
<button
type="button"
diff --git a/apps/desktop/src/renderer/components/sidebar/AttentionDot.tsx b/apps/desktop/src/renderer/components/sidebar/AttentionDot.tsx
index 5712b908c9..0b67690510 100644
--- a/apps/desktop/src/renderer/components/sidebar/AttentionDot.tsx
+++ b/apps/desktop/src/renderer/components/sidebar/AttentionDot.tsx
@@ -10,8 +10,7 @@
* 不再区分颜色)。
* • awaiting → TapTap 蓝 `--card-status-awaiting`:等待用户回复/选择(Claude
* 权限 / AskUserQuestion / 计划审阅;Codex 无此态)。与灵动岛 needs-interaction 同色。
- * • error → 红 `--card-status-error`:运行历史等调用方的失败未读。
- * 任务入口是否显示错误点由调用方决定。
+ * • error → 红 `--card-status-error`:任务出错(终止错误)。红专职表示出错。
* running 不走本组件:橙(Thinking Orange)专职表达"正在跑"(vendor mark 呼吸 /
* spinner),不再用于任何"完成"语义。不用黑/前景色。
*
diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
index 65bcb5b5cb..8b3c8836d4 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
@@ -1,6 +1,5 @@
import { shouldShowOpenPathError } from '../../../shared/openPathResult';
import { shouldShowFailedScheduleNotice } from '@cindy/maker-shared/schedule-model';
-import { scheduleFocusPath } from '@/features/scheduler/lib/scheduleSessionBinding';
/**
* CCAgentSessionView
* ---------------------------------------------------------------------------
@@ -5018,9 +5017,6 @@ export function CCAgentSessionView({
dataOwnerId={dataOwnerId}
sessionId={sessionId}
latestFailedRun={scheduleSessionInfo.latestFailedRun}
- onViewDetails={canNavigateSession && !remoteDeviceId
- ? (scheduleId) => navigate(scheduleFocusPath(scheduleId))
- : undefined}
style={{ width: inputWidth }}
className="py-1"
/>
diff --git a/apps/desktop/src/renderer/features/cc-agent/lib/__tests__/sessionLampAggregation.test.ts b/apps/desktop/src/renderer/features/cc-agent/lib/__tests__/sessionLampAggregation.test.ts
index bbee677407..004a29a1a6 100644
--- a/apps/desktop/src/renderer/features/cc-agent/lib/__tests__/sessionLampAggregation.test.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/lib/__tests__/sessionLampAggregation.test.ts
@@ -3,7 +3,7 @@
* ---------------------------------------------------------------------------
* 该 helper 是 rail 段钮 / rail 浮层面板项目行 / 展开态项目行 / 「对话」组行 /
* 设备段头共用的唯一事实源。这里钉住三件事:
- * 1. 任务入口只显示 awaiting > done;urgent 不遮住 awaiting;
+ * 1. tone 优先级:error > awaiting > done;urgent(定时任务失败未读)提升为 error;
* 2. 未读集合之外的会话不点灯(attention kind 存在也不行);
* 3. device-link 远程镜像并入:running / needs-interaction / error / 完成未读
* 与本地链路合并取最高档(否则远程「行亮而上层入口不亮」)。
@@ -40,15 +40,9 @@ describe('dotToneOf', () => {
expect(dotToneOf('a', c.notifications, c.attentionKinds, c.urgentSessionIds)).toBeNull();
});
- it('失败的自动运行不显示提醒点', () => {
+ it('urgent 会话提升为 error(定时任务失败未读兜底)', () => {
const c = ctx({ notifications: ['a'], urgent: ['a'] });
- expect(dotToneOf('a', c.notifications, c.attentionKinds, c.urgentSessionIds)).toBeNull();
- });
-
- it('同一任务旧失败不遮住待回复,运行标记也保持独立', () => {
- const c = ctx({ notifications: ['a'], kinds: { a: 'awaiting' }, urgent: ['a'], running: ['a'] });
- expect(dotToneOf('a', c.notifications, c.attentionKinds, c.urgentSessionIds)).toBe('awaiting');
- expect(aggregateSessionLamps([{ id: 'a' }], c)).toEqual({ running: true, dotTone: 'awaiting' });
+ expect(dotToneOf('a', c.notifications, c.attentionKinds, c.urgentSessionIds)).toBe('error');
});
it('kind 缺失的未读回落绿 done', () => {
@@ -62,14 +56,14 @@ describe('aggregateSessionLamps', () => {
expect(aggregateSessionLamps([], ctx({}))).toEqual({ running: false, dotTone: null });
});
- it('错误不遮住等待回复与成功未读提醒', () => {
+ it('tone 取聚合最高档:done < awaiting < error', () => {
const c = ctx({
notifications: ['a', 'b', 'c'],
kinds: { b: 'awaiting', c: 'error' },
});
expect(aggregateSessionLamps([{ id: 'a' }], c).dotTone).toBe('done');
expect(aggregateSessionLamps([{ id: 'a' }, { id: 'b' }], c).dotTone).toBe('awaiting');
- expect(aggregateSessionLamps([{ id: 'a' }, { id: 'b' }, { id: 'c' }], c).dotTone).toBe('awaiting');
+ expect(aggregateSessionLamps([{ id: 'a' }, { id: 'b' }, { id: 'c' }], c).dotTone).toBe('error');
});
it('running 与未读点相互独立,可同时成立', () => {
@@ -92,7 +86,7 @@ describe('aggregateSessionLamps', () => {
expect(agg).toEqual({ running: true, dotTone: 'awaiting' });
});
- it('远程成功未读仍显示绿点,不被本地错误遮住', () => {
+ it('远程完成未读(attention 存续期条目)记绿 done;本地 error 仍压过它', () => {
applyRemoteSessionActivity('device-1', {
sessionId: 'remote-done',
phase: 'completed',
@@ -101,12 +95,12 @@ describe('aggregateSessionLamps', () => {
});
expect(aggregateSessionLamps([{ id: 'remote-done', deviceLinkDeviceId: 'device-1' }], ctx({})).dotTone).toBe('done');
const c = ctx({ notifications: ['local-err'], kinds: { 'local-err': 'error' } });
- expect(aggregateSessionLamps([{ id: 'remote-done', deviceLinkDeviceId: 'device-1' }, { id: 'local-err' }], c).dotTone).toBe('done');
+ expect(aggregateSessionLamps([{ id: 'remote-done', deviceLinkDeviceId: 'device-1' }, { id: 'local-err' }], c).dotTone).toBe('error');
});
});
describe('remoteLampOf', () => {
- it('无镜像与远程错误均不显示提醒点', () => {
+ it('无镜像条目 → null;error phase → error tone', () => {
expect(remoteLampOf('nope', undefined)).toBeNull();
applyRemoteSessionActivity('device-1', {
sessionId: 'remote-err',
@@ -114,7 +108,7 @@ describe('remoteLampOf', () => {
attention: true,
compactDetail: '',
});
- expect(remoteLampOf('remote-err', 'device-1')).toEqual({ running: false, tone: null });
+ expect(remoteLampOf('remote-err', 'device-1')).toEqual({ running: false, tone: 'error' });
});
});
diff --git a/apps/desktop/src/renderer/features/cc-agent/lib/appAttentionCount.ts b/apps/desktop/src/renderer/features/cc-agent/lib/appAttentionCount.ts
index ca04781974..a6cc288166 100644
--- a/apps/desktop/src/renderer/features/cc-agent/lib/appAttentionCount.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/lib/appAttentionCount.ts
@@ -1,9 +1,9 @@
import type { Session } from '@/lib/ccAgent.types';
import { isOrcaWorkerSession } from '@/lib/orcaSessionIdentity';
import type { AttentionKind } from '@/lib/sessionAttentionStore';
-import { resolveSessionRightStatus } from '@cindy/maker-shared/session-activity';
import {
projectSidebarSessionActivity,
+ resolveSidebarRightStatus,
type SidebarRightStatusInput,
} from '../sidebar/sidebarRightStatus';
import { isAutomationGeneratedSession } from './scheduledSessionGrouping';
@@ -18,7 +18,7 @@ export interface AppAttentionCountInput {
localSchedules: ReadonlyMap<string, ScheduleAttention>;
}
-/** 系统角标仍统计错误;不随侧栏隐藏错误红点、搜索或折叠改变。 */
+/** 与任务行的红/蓝/绿点同源,不随搜索、折叠或当前机器筛选改变。 */
export function countAppAttention(input: AppAttentionCountInput): number {
const attentionIds = new Set<string>();
for (const session of input.sessions) {
@@ -41,7 +41,7 @@ export function countAppAttention(input: AppAttentionCountInput): number {
isRunning: input.runningSessionIds.has(session.id),
hasAttentionNotification: input.attentionKinds.has(session.id),
});
- const status = resolveSessionRightStatus(activity);
+ const status = resolveSidebarRightStatus(activity);
// heartbeat 绑普通任务时 runner 保留 desktop 来源,完成会写入 done;
// 只压未读自动化 done,不连同之后的 awaiting / error 一起丢掉。
if (status === 'done' && input.localSchedules.get(session.id)?.hasUnreadRun === true) {
diff --git a/apps/desktop/src/renderer/features/cc-agent/lib/sessionLampAggregation.ts b/apps/desktop/src/renderer/features/cc-agent/lib/sessionLampAggregation.ts
index 5ddb41d025..f851abbff0 100644
--- a/apps/desktop/src/renderer/features/cc-agent/lib/sessionLampAggregation.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/lib/sessionLampAggregation.ts
@@ -1,10 +1,10 @@
/**
* sessionLampAggregation — 会话「灯语」聚合的唯一事实源
* ---------------------------------------------------------------------------
- * 灯语 = running(呼吸橙)+ 未读点 tone(蓝 awaiting > 绿 done,
+ * 灯语 = running(呼吸橙)+ 未读点 tone(红 error > 蓝 awaiting > 绿 done,
* AttentionDot 色表)。聚合口径:
* - 本地链路:runningSessionIds / notifications + attentionKinds + urgent
- * (普通错误与定时任务失败未读均不显示提醒点);
+ * (定时任务失败未读按 error 提升,与 SessionItem.isUrgentFromContext 同语义);
* - device-link 远程镜像(remoteLampOf):本地链路对被控端后台会话是盲区,
* 必须并入,否则「行亮而入口不亮」(codex review,rail 聚合灯先例)。
*
@@ -22,7 +22,6 @@ import { getRemoteSessionActivity } from '@/features/device-link/remoteSessionAc
import { getStartingSessionIds } from '@/lib/sessionStartingStore';
import { getSessionDeviceId } from '@/features/device-link/remoteProjectsStore';
import type { AttentionKind } from '@/lib/sessionAttentionStore';
-import { resolveSidebarAttentionTone } from '../sidebar/sidebarRightStatus';
const TONE_RANK: Record<AttentionKind, number> = { error: 3, awaiting: 2, done: 1 };
@@ -35,7 +34,7 @@ export function remoteLampOf(id: string, deviceId: string | null | undefined): {
return {
running: false,
tone:
- remote.phase === 'error' ? null : remote.phase === 'needs-interaction' ? 'awaiting' : 'done',
+ remote.phase === 'error' ? 'error' : remote.phase === 'needs-interaction' ? 'awaiting' : 'done',
};
}
@@ -47,7 +46,10 @@ export function dotToneOf(
urgentSessionIds: ReadonlySet<string>,
): AttentionKind | null {
if (!notifications.has(id)) return null;
- return resolveSidebarAttentionTone(attentionKinds.get(id), urgentSessionIds.has(id));
+ const kind = attentionKinds.get(id);
+ if (kind === 'error' || urgentSessionIds.has(id)) return 'error';
+ if (kind === 'awaiting') return 'awaiting';
+ return 'done';
}
export interface SessionLampContext {
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/AutomationSessionGroupItem.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/AutomationSessionGroupItem.tsx
index d8f5d96ee1..02e86a06ae 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/AutomationSessionGroupItem.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/AutomationSessionGroupItem.tsx
@@ -47,6 +47,7 @@ import {
} from './sidebarRightStatus';
import {
resolveCollapsedAttention,
+ resolveCollapsedGroupHeaderSessionId,
resolveCollapsedGroupRightStatus,
} from './projectCollapsedAttention';
import { AutomationTimerIcon } from './AutomationTimerIcon';
@@ -440,10 +441,14 @@ export const AutomationSessionGroupItem = withSidebarNavigation<AutomationSessio
[countdownText, runCountText, stoppedText],
);
- // 点击空白行区域或标题都打开最新运行;旧错误通过独立子行打开。
- // 行内控件各自 stopPropagation,不会误触发。
+ // 点击空白行区域 = 点击标题。展开态打开最新一条;收起且整组是红时打开
+ // 贡献红点的那条。行内控件各自 stopPropagation,不会误触发。
const openLatestSession = () => {
- const targetId = latestSessionId;
+ const targetId = resolveCollapsedGroupHeaderSessionId({
+ collapsed,
+ latestSessionId,
+ attention: collapsedAttention,
+ });
if (!targetId) return;
// 仅在展开 + 前 5 条态下冻结当前布局;收起态无子项可冻结。
if (!collapsed && !showAll) freezeCurrentLayout(targetId);
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionStatusIcon.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionStatusIcon.tsx
index 0f9754da1c..d0f428222f 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionStatusIcon.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionStatusIcon.tsx
@@ -8,7 +8,7 @@
* - orca-lead(协同) → UsersRound(与「+」菜单协同项同款)
* - 其余 → VendorIcon(Claude Code 像素脸 / Codex CLI 花形+`>_`)
* running:图标切 Thinking Orange + 呼吸;需关注:右上叠状态点(全端统一色表:
- * awaiting TapTap 蓝 / 完成未读绿,tone 按行精准订阅 attention store);
+ * error 红 / awaiting TapTap 蓝 / 完成未读绿,tone 按行精准订阅 attention store);
* 有未发送内容(草稿/暂停队列)且未选中:右下叠铅笔。
* idle 时图标照常显示——让用户一眼看出"这是哪一个 agent"。
*
@@ -26,7 +26,6 @@ import { useGhostSessionBusy } from '@/cindy-brain/ghostSessionActivityStore';
import { useSessionAttentionKind } from '@/lib/sessionAttentionStore';
import { useSessionAttentionUrgency } from '../contexts/SessionAttentionUrgencyContext';
import { AttentionDot } from '@/components/sidebar/AttentionDot';
-import { resolveSidebarAttentionTone } from './sidebarRightStatus';
import { VendorIcon, agentKindToVendor } from '@/components/sidebar/VendorIcon';
import { useCindyMakePreparing } from './useCindyMakePreparing';
@@ -79,15 +78,18 @@ export function SessionStatusIcon({
const vendor = agentKindToVendor(session.agentKind);
const isOrcaLead = isOrcaLeadSession(session);
const isArchived = session.status === 'archived';
- // 任务入口只显示 awaiting 蓝 / 完成未读绿,旧错误不能遮住待回复。
+ // 角标 tone:error(含定时任务失败的 urgency context)红 > awaiting 蓝 > 完成未读绿。
// 两个 hook 都是按 sessionId 的 primitive 精准订阅(性能不变量,见 SessionItem 头注),
// 本组件也被逐行挂载,禁止退回整表订阅。
const attentionKind = useSessionAttentionKind(session.id);
const isUrgentFromContext = useSessionAttentionUrgency(session.id);
- const attentionTone = resolveSidebarAttentionTone(
- attentionToneOverride ?? attentionKind,
- isUrgentFromContext,
- );
+ const attentionTone =
+ attentionToneOverride ??
+ (isUrgentFromContext || attentionKind === 'error'
+ ? 'error'
+ : attentionKind === 'awaiting'
+ ? 'awaiting'
+ : 'done');
// 有"未发送内容"(输入框草稿 或 被暂停的待发队列)且当前未选中 → 右下铅笔提示。
const hasDraft = useComposerDraftPresence(session.id);
const hasPausedQueue = useSessionPausedQueue(session.id);
@@ -148,7 +150,7 @@ export function SessionStatusIcon({
colorClassName={isActive ? 'text-[var(--sidebar-item-active-foreground)]' : undefined}
/>
)}
- {showAttentionDot && hasAttentionNotification && attentionTone && (
+ {showAttentionDot && hasAttentionNotification && (
<AttentionDot size={6} tone={attentionTone} className="absolute -top-0.5 -right-0.5" />
)}
{showDraftIndicator && (
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarRightStatusIndicator.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarRightStatusIndicator.tsx
index c0cae0f830..61cb3f6caf 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarRightStatusIndicator.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarRightStatusIndicator.tsx
@@ -18,7 +18,6 @@ export function SidebarRightStatusIndicator({
className?: string;
}) {
const { t } = useTranslation();
- if (kind === 'error') return null;
if (kind === 'running') {
return (
@@ -39,10 +38,17 @@ export function SidebarRightStatusIndicator({
}
const label =
- kind === 'awaiting'
- ? t('ccAgent.sidebar.status.needsAttention', 'Awaiting your input')
- : t('ccAgent.sidebar.status.done', 'Completed — click to view');
- const color = kind === 'awaiting' ? 'var(--card-status-awaiting)' : 'var(--card-status-done)';
+ kind === 'error'
+ ? t('ccAgent.sidebar.status.error', 'Failed — click to view')
+ : kind === 'awaiting'
+ ? t('ccAgent.sidebar.status.needsAttention', 'Awaiting your input')
+ : t('ccAgent.sidebar.status.done', 'Completed — click to view');
+ const color =
+ kind === 'error'
+ ? 'var(--card-status-error)'
+ : kind === 'awaiting'
+ ? 'var(--card-status-awaiting)'
+ : 'var(--card-status-done)';
return (
<span
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts
index 57bfea2992..6b48da1738 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts
@@ -898,7 +898,7 @@ describe('SessionCard visual cases', () => {
['done', 'var(--card-status-done)'],
['awaiting', 'var(--card-status-awaiting)'],
['error', 'var(--card-status-error)'],
- ] as const)('renders %s attention in list mode, with errors hidden', (kind, color) => {
+ ] as const)('moves the %s attention dot to the list bottom-right corner', (kind, color) => {
const visualCase = sessionCardVisualCases.find((item) => item.id === 'attention-dot');
if (!visualCase) throw new Error('Missing attention visual case');
mocks.attentionKindBySession.set(visualCase.session.id, kind);
@@ -921,15 +921,11 @@ describe('SessionCard visual cases', () => {
);
const rightStatus = container.querySelector(`[data-sidebar-right-status="${kind}"]`);
- if (kind === 'error') {
- expect(rightStatus).toBeNull();
- } else {
- expect(rightStatus?.className).toContain('right-2.5');
- expect(rightStatus?.className).toContain('bottom-2');
- expect((rightStatus?.firstElementChild as HTMLElement | null)?.style.backgroundColor).toBe(
- color,
- );
- }
+ expect(rightStatus?.className).toContain('right-2.5');
+ expect(rightStatus?.className).toContain('bottom-2');
+ expect((rightStatus?.firstElementChild as HTMLElement | null)?.style.backgroundColor).toBe(
+ color,
+ );
const title = Array.from(container.querySelectorAll('span')).find(
(node) =>
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/automationGroupCollapsedAlerts.test.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/automationGroupCollapsedAlerts.test.tsx
index b125328bd5..27b163118a 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/automationGroupCollapsedAlerts.test.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/automationGroupCollapsedAlerts.test.tsx
@@ -9,7 +9,7 @@
* 收尾的定时任务运行)既不上组头、也不成行,而项目折叠头是按**全部**子任务汇总的。
*
* 本测试钉住修复后的两条:
- * 1. 收起态组头不再显示错误红点;
+ * 1. 收起态组头按整组汇总点红(不是只看最新一条);
* 2. 收起态把带告警的那条运行提上来单独成行,用户能直接点开处置。
* 都从同一份判据(resolveCollapsedAttention)出发,所以不可能再「汇总说有、列表没有」。
*/
@@ -196,12 +196,12 @@ describe('AutomationSessionGroupItem — 收起态的未处理告警', () => {
expect(screen.queryByLabelText('Failed — click to view')).toBeNull();
});
- it('组内非最新一条留下告警时,组头不点红但该条仍被提上来成行', () => {
+ it('组内非最新一条留下告警时,组头点红且该条被提上来成行', () => {
// run-2 = 「第 3 新、turn 从未收尾」的那条;组头代表的是 run-0。
addSessionAttention('run-2', 'error');
const { container } = renderGroup({ notifications: ['run-2'] });
- expect(screen.queryByLabelText('Failed — click to view')).toBeNull();
+ expect(screen.getByLabelText('Failed — click to view')).toBeTruthy();
expect(childRunIds(container)).toEqual(['run-2']);
});
@@ -211,7 +211,7 @@ describe('AutomationSessionGroupItem — 收起态的未处理告警', () => {
urgentSessionIds: new Set(['run-3']),
});
- expect(screen.queryByLabelText('Failed — click to view')).toBeNull();
+ expect(screen.getByLabelText('Failed — click to view')).toBeTruthy();
expect(screen.queryByLabelText('Completed — click to view')).toBeNull();
expect(childRunIds(container)).toEqual(['run-3']);
});
@@ -225,18 +225,16 @@ describe('AutomationSessionGroupItem — 收起态的未处理告警', () => {
expect(childRunIds(container)).toEqual([]);
});
- it.each(['done', 'awaiting'] as const)('最新运行为 %s 且存在旧错误时,组头仍打开最新运行', (kind) => {
- addSessionAttention('run-0', kind);
+ it('收起且整组是红时,点组头打开告警那条而不是最新一条', () => {
const onSessionClick = vi.fn();
renderGroup({
urgentSessionIds: new Set(['run-3']),
- notifications: ['run-0'],
onSessionClick,
});
fireEvent.click(screen.getByText('产品决策巡检'));
- expect(onSessionClick).toHaveBeenCalledWith('run-0');
- expect(onSessionClick).not.toHaveBeenCalledWith('run-3');
+ expect(onSessionClick).toHaveBeenCalledWith('run-3');
+ expect(onSessionClick).not.toHaveBeenCalledWith('run-0');
});
it('等待回复的旧运行单独成行,组头仍代表最新运行', () => {
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/projectCollapsedAttention.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/projectCollapsedAttention.ts
index ac049a12c4..1ec235faa8 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/projectCollapsedAttention.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/projectCollapsedAttention.ts
@@ -25,18 +25,24 @@ interface CollapsedAttentionInput {
}
export interface CollapsedAttentionSummary {
- /** 折叠容器的成功未读档位;没有则 null(回落最新状态或时间文字)。 */
+ /** 折叠容器右侧状态槽要显示的档位;两者都没有则 null(回落时间文字)。 */
tone: CollapsedAttentionTone | null;
/**
- * 未处理错误的子任务 id。保留收起态下错误条目的可达性,
- * 但不再据此显示红点或遮住其它子任务的成功未读提示。
+ * 贡献红点的子任务 id —— **未处理告警**的集合。
+ *
+ * ⚠️ 这个列表存在的理由:折叠容器一旦汇总出红点,用户必须能找到那条子任务。
+ * 项目行展开后子任务各自成行,天然可达;定时任务分组收起时子行整片不渲染,
+ * 组头此前只代表「最新一条」运行,于是「组里第 3 新的运行有未处理告警」会变成
+ * 「项目折叠头亮红点、展开却哪儿都找不到」(实测:一条被 App 重启打断、turn 从未
+ * 收尾的定时任务运行)。分组收起态据此把告警行提上来,与本函数的 tone 同源,
+ * 不可能再出现「汇总说有、列表没有」。
*/
errorSessionIds: readonly string[];
}
/**
- * 折叠容器汇总成功未读绿点,并保留错误子任务的可达性。
- * 错误不显示红点;等待回复与运行态不在此处升格。
+ * 折叠容器(项目行 / 定时任务分组头)汇总子任务实际可见的红/绿状态点。等待回复(蓝)
+ * 与运行态不在此处升格;若红绿同时存在,错误红点优先。
*
* 这是折叠态「什么算告警」的**唯一**判据:项目折叠头取 tone,定时任务分组头同时取
* tone 与 errorSessionIds(见该字段注释)。要改语义就只改这里,别在消费侧另写一份。
@@ -66,7 +72,7 @@ export function resolveCollapsedAttention({
if (remotePhase === 'error') errorSessionIds.push(session.id);
else if (remotePhase === 'completed') hasDone = true;
// 远程活动镜像是远程行右侧状态的权威来源;running / needs-interaction
- // 分别显示 spinner / 蓝点,不能再被本地残留状态误汇总成完成绿点。
+ // 分别显示 spinner / 蓝点,不能再被本地残留状态误汇总成红绿点。
continue;
}
@@ -86,8 +92,7 @@ export function resolveCollapsedAttention({
}
return {
- // Keep failed children discoverable, but no longer advertise failures with a dot.
- tone: hasDone ? 'done' : null,
+ tone: errorSessionIds.length > 0 ? 'error' : hasDone ? 'done' : null,
errorSessionIds,
};
}
@@ -100,8 +105,33 @@ export function resolveCollapsedProjectAttentionTone(
}
/**
- * 定时任务分组头沿用最新运行的状态,折叠时仅在最新状态为 time 时补成功未读绿点。
- * 本地汇总不产生 error;共享解析器保留其它端的错误汇总行为。
- * 等待回复不在此处升格,错误子任务通过独立子行保持可达。
+ * 定时任务分组头右侧状态槽的最终档位。
+ *
+ * 组头平时是「最新一条运行的代理」(状态 / loading / 点击目标都跟最新那条一致,
+ * 2026-08 既有裁决),展开态照此不变;收起态它代表的却是**整组**,于是按整组汇总补两档:
+ * - 汇总出 error → 强制红。压过 latest 的 running spinner,与全端色表
+ * error > awaiting > running > done 一致 ——「等你处理」永远最高。
+ * - 汇总出 done → 只在组头自身无状态可显(time)时补绿。绿点若压掉 spinner 会造成
+ * 「仍在跑却看起来已完成」的错觉(sidebarRightStatus 里有同款告警)。
+ * awaiting(蓝)刻意不升格,与项目折叠头口径一致。
*/
export { resolveCollapsedGroupRightStatus } from '@cindy/maker-shared/session-activity';
+
+/**
+ * 组头点击打开哪一条。展开态仍打开最新一条;收起且整组是红时,
+ * 打开贡献红点的那条,避免点红进到后来成功的巡检。
+ */
+export function resolveCollapsedGroupHeaderSessionId({
+ collapsed,
+ latestSessionId,
+ attention,
+}: {
+ collapsed: boolean;
+ latestSessionId: string | undefined;
+ attention: Pick<CollapsedAttentionSummary, 'tone' | 'errorSessionIds'>;
+}): string | undefined {
+ if (collapsed && attention.tone === 'error' && attention.errorSessionIds[0]) {
+ return attention.errorSessionIds[0];
+ }
+ return latestSessionId;
+}
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectNode.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectNode.tsx
index f3bd832b98..f19f577b58 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectNode.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectNode.tsx
@@ -300,12 +300,12 @@ const ProjectHeader = memo(function ProjectHeader({
// 常驻在标题左侧;展开/收起指示箭头移到标题右侧、hover 才渐显(见下方 Chevron)。
const FolderIcon = isCollapsed ? Folder : FolderOpen;
const Chevron = isCollapsed ? ChevronRight : ChevronDown;
- // 错误不显示红点,也不能遮住待回复或成功未读提示。
+ // 红绿汇总保留既有判据;收起文件夹还需承接机器展开后下放的待回复提示。
const collapsedStatusTone =
- lamp?.dotTone === 'awaiting'
- ? 'awaiting'
- : collapsedAttentionTone === 'error'
- ? null
+ collapsedAttentionTone === 'error'
+ ? 'error'
+ : lamp?.dotTone === 'awaiting'
+ ? 'awaiting'
: collapsedAttentionTone;
// 右键菜单:参照 ChatImageView 的 controlled DropdownMenu + 隐形定位 trigger 模式,
// 鼠标点击位置即菜单出现位置。
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sidebarRightStatus.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/sidebarRightStatus.ts
index a24f2ad57c..9bf73d1132 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sidebarRightStatus.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sidebarRightStatus.ts
@@ -1,29 +1,12 @@
import {
projectSessionActivity,
- resolveSessionRightStatus,
type SessionActivitySnapshot,
type SessionInterruptionState,
} from '@cindy/maker-shared/session-activity';
import type { AttentionKind } from '@/lib/sessionAttentionStore';
-/** Desktop task-entry tones; stale failures must not hide pending input. */
-export function resolveSidebarAttentionTone(
- kind: AttentionKind | undefined,
- urgent: boolean,
-): 'awaiting' | 'done' | null {
- if (kind === 'awaiting') return 'awaiting';
- return urgent || kind === 'error' ? null : 'done';
-}
-
-type SidebarSessionActivity = SessionActivitySnapshot & { waitingForUser?: boolean };
-
-/** Errors stay in the task; the sidebar only signals running, input and unread results. */
-export function resolveSidebarRightStatus(activity: SidebarSessionActivity) {
- if (activity.waitingForUser) return 'awaiting';
- if (activity.phase === 'error') return activity.currentTurnActive ? 'running' : 'time';
- return resolveSessionRightStatus(activity);
-}
+export { resolveSessionRightStatus as resolveSidebarRightStatus } from '@cindy/maker-shared/session-activity';
export type { SessionRightStatus as SidebarRightStatusKind } from '@cindy/maker-shared/session-activity';
export interface SidebarRightStatusInput {
@@ -65,12 +48,12 @@ export function projectSidebarSessionActivity({
isUrgentFromContext,
isRunning,
hasAttentionNotification,
-}: SidebarRightStatusInput): SidebarSessionActivity {
+}: SidebarRightStatusInput): SessionActivitySnapshot {
const errorAttention =
isUrgentFromContext || (hasAttentionNotification && attentionKind === 'error');
const awaitingAttention = hasAttentionNotification && attentionKind === 'awaiting';
const doneAttention = hasAttentionNotification && !errorAttention && !awaitingAttention;
- const activity = projectSessionActivity({
+ return projectSessionActivity({
interruption,
sessionId,
recordStatus: liveActivity?.recordStatus ?? recordStatus,
@@ -86,14 +69,7 @@ export function projectSidebarSessionActivity({
interactionKind: liveActivity?.interactionKind,
// Automation failure urgency intentionally lives outside the regular
// attention-notification store. Preserve it in the canonical projection so
- // restart/expiry/acknowledgement cannot erase the error itself. The sidebar
- // status resolver hides its dot without changing this activity projection.
+ // restart/expiry/acknowledgement cannot erase the existing red error state.
attention: liveActivity?.attention === true || hasAttentionNotification || isUrgentFromContext,
});
- // Renderer-only facet: retain pending input lost behind canonical error priority.
- // Canonical phase/attention remain intact for system notification counts.
- return {
- ...activity,
- waitingForUser: awaitingAttention || liveActivity?.phase === 'needs-interaction',
- };
}
diff --git a/apps/desktop/src/renderer/features/scheduler/components/__tests__/RunHistoryCard.test.tsx b/apps/desktop/src/renderer/features/scheduler/components/__tests__/RunHistoryCard.test.tsx
index 97f6454428..b9b0d329be 100644
--- a/apps/desktop/src/renderer/features/scheduler/components/__tests__/RunHistoryCard.test.tsx
+++ b/apps/desktop/src/renderer/features/scheduler/components/__tests__/RunHistoryCard.test.tsx
@@ -187,21 +187,3 @@ describe('RunHistoryCard 费用展示', () => {
expect(screen.getByText('scheduler.runs.runCost')).toBeTruthy();
});
});
-
-describe('RunHistoryCard 未读失败标记', () => {
- it.each(['failed', 'interrupted'] as const)('%s 保留图标角标,已读后消失', (status) => {
- const run = { id: 'run-unread', scheduleId: 'schedule-1', firedAt: 1, finishedAt: 11, status };
- const view = renderRun(run);
- const dot = () =>
- Array.from(view.container.querySelectorAll('span')).find((node) =>
- node.className.includes('bg-[var(--card-status-error)]'),
- );
- expect(dot()?.className).toContain('absolute -top-0.5 -right-0.5');
- view.rerender(
- <MemoryRouter>
- <RunHistoryCard run={{ ...run, readAt: 12 }} agentKind="codex" />
- </MemoryRouter>,
- );
- expect(dot()).toBeUndefined();
- });
-});
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index e918f42815..77eaefbfa0 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -8856,10 +8856,9 @@
},
"unreadFailedScheduleBanner": {
"text": "An automatic run failed.",
- "precheck": "A previous automatic run did not start because its pre-run check failed.",
- "rateLimited": "A previous automatic run did not start because its pre-run check was rate-limited.",
- "dismissTitle": "Dismiss past failure notice",
- "viewDetails": "View Details"
+ "precheck": "Automatic checks are temporarily blocked.",
+ "rateLimited": "Automatic checks are temporarily blocked by a request rate limit.",
+ "dismissTitle": "Dismiss past failure notice"
},
"worktreeRestoreBanner": {
"text": "This session's worktree has been cleaned up (directory missing).",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 5c0739026d..eafc366be1 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -8850,10 +8850,9 @@
},
"unreadFailedScheduleBanner": {
"text": "自動実行に失敗した記録があります。",
- "precheck": "実行前チェックに失敗したため、以前の自動実行は開始されませんでした。",
- "rateLimited": "実行前チェックでリクエスト制限に達したため、以前の自動実行は開始されませんでした。",
- "dismissTitle": "過去の失敗通知を閉じる",
- "viewDetails": "詳細を見る"
+ "precheck": "自動チェックが一時的に停止しています。",
+ "rateLimited": "リクエスト制限により自動チェックが一時的に停止しています。",
+ "dismissTitle": "過去の失敗通知を閉じる"
},
"worktreeRestoreBanner": {
"text": "このセッションのワークツリーは回収されました(ディレクトリが存在しません)。",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 013c3f9ae8..0e1a0dd1fd 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -8850,10 +8850,9 @@
},
"unreadFailedScheduleBanner": {
"text": "실패한 자동 실행이 있습니다.",
- "precheck": "실행 전 확인에 실패하여 이전 자동 실행이 시작되지 않았습니다.",
- "rateLimited": "실행 전 확인 중 요청 한도에 도달하여 이전 자동 실행이 시작되지 않았습니다.",
- "dismissTitle": "이전 실패 알림 닫기",
- "viewDetails": "상세 보기"
+ "precheck": "자동 확인이 일시적으로 차단되었습니다.",
+ "rateLimited": "요청 한도 초과로 자동 확인이 일시적으로 차단되었습니다.",
+ "dismissTitle": "이전 실패 알림 닫기"
},
"worktreeRestoreBanner": {
"text": "이 세션의 워크트리가 정리되었습니다(디렉터리가 존재하지 않음).",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index 10c4f946af..b7b72991f1 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -8850,10 +8850,9 @@
},
"unreadFailedScheduleBanner": {
"text": "此前有自动运行失败。",
- "precheck": "此前一次自动运行未启动:运行前检查失败。",
- "rateLimited": "此前一次自动运行未启动:检查时请求被限流。",
- "dismissTitle": "关闭历史失败提示",
- "viewDetails": "查看详情"
+ "precheck": "自动检查暂时受阻。",
+ "rateLimited": "自动检查暂时受阻:请求限流。",
+ "dismissTitle": "关闭历史失败提示"
},
"worktreeRestoreBanner": {
"text": "该任务的 worktree 已被回收(目录不存在)。",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index 31c0ddef70..3fc3ae7d57 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -8849,10 +8849,9 @@
},
"unreadFailedScheduleBanner": {
"text": "先前有自動執行失敗。",
- "precheck": "先前一次自動執行未啟動:執行前檢查失敗。",
- "rateLimited": "先前一次自動執行未啟動:檢查時請求受到速率限制。",
- "dismissTitle": "關閉歷史失敗提示",
- "viewDetails": "查看詳情"
+ "precheck": "自動檢查暫時受阻。",
+ "rateLimited": "自動檢查暫時受阻:請求限流。",
+ "dismissTitle": "關閉歷史失敗提示"
},
"worktreeRestoreBanner": {
"text": "該任務的 worktree 已被回收(目錄不存在)。",
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index 61c06d29a4..91590ca1db 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -84,8 +84,6 @@ Small interactive chips (button backgrounds, tag pills, avatar fills, selected-n
Toast loading is neutral: use the shared 16×16 Spinner in `--text-secondary`, with polite status semantics. Keep it visible until the operation settles and explicitly dismiss it; only failures use the error variant.
-Desktop task errors do not display reminder dots in task rows, pinned cards, or project/device aggregates. Keep running, awaiting-input, and successful-unread indicators; stale failure urgency must not hide pending input. Automation run-history cards retain their unread failure dots, and the shared dot primitive remains tone-driven. Errors and interrupted runs remain available inside the task; automatic-run failure notices link to the corresponding automation with “View Details”. This does not change native Agent Island, mobile, or OS notification behavior.
-
The grayscale rule is near-absolute. The following are the **only** sanctioned non-gray colors in the system — each tightly scoped to a specific surface. New semantic colors must not be introduced without being recorded here first.
- **Focus Blue** (`#417CDD` at 50%; tokens `--focus-ring` / `--focus-ring-soft`): the keyboard-accessibility focus ring, finalized 2026-07-17 (replaces Tailwind's default `#3b82f6`). Never visible in normal interaction flow.