Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(bots): 统一群执行收尾与失败状态展示 (#5736)
boboc68e9097f2d3
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/botGroupChatService.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/botGroupChatService.test.tsindex 728a8ee350..3dfad1fa16 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/botGroupChatService.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/botGroupChatService.test.ts@@ -395,6 +395,37 @@ describe('botGroupChatService', () => {.toEqual([['member-failed', '咪咪']]);});+ it('preserves a safe dispatch failure category for a local-only group', async () => {+ const harness = createHarness(() => null, {+ dispatch: async () => ({ ok: false, errorCode: 'INTERNAL', message: 'authentication_failed private credential' }),+ });+ const groupId = await createGroup(harness, ['mimi', 'abu']);+ await harness.service.sendMessage({ groupId, text: '@咪咪 hello', mentions: { all: false, botIds: ['mimi'] }, clientId: 'rejected-input' });+ const group = await waitForIdle(harness, groupId);+ expect(group.messages.filter(message => message.kind === 'notice')).toEqual([+ expect.objectContaining({ noticeCode: 'member-failed', runtimeFailureCode: 'AUTH_REQUIRED' }),+ ]);+ expect(JSON.stringify(group.messages)).not.toContain('private credential');+ });++ it.each([+ ['NO_MODEL', 'MODEL_UNAVAILABLE'],+ ['MEMBER_UNAVAILABLE', undefined],+ ] as const)('preserves the preparation reason %s for a local group without dispatching', async (errorCode, failureCode) => {+ const harness = createHarness(() => null, {+ ensureLane: async () => ({ ok: false, errorCode, message: 'private preparation details' }),+ });+ const groupId = await createGroup(harness, ['mimi', 'abu']);+ await harness.service.sendMessage({ groupId, text: '@咪咪 hello', mentions: { all: false, botIds: ['mimi'] }, clientId: 'no-lane' });+ const group = await waitForIdle(harness, groupId);+ expect(harness.dispatches).toEqual([]);+ expect(group.round.speakers).toEqual([]);+ expect(group.messages.filter(message => message.kind === 'notice')).toEqual([+ expect.objectContaining({ noticeCode: 'member-unavailable', runtimeFailureCode: failureCode }),+ ]);+ expect(JSON.stringify(group.messages)).not.toContain('private preparation details');+ });+it('a round superseded while a member prepares never dispatches and never steals the new waiter', async () => {let releaseSync!: () => void;const syncGate = new Promise<void>((resolve) => { releaseSync = resolve; });@@ -450,6 +481,7 @@ describe('botGroupChatService', () => {expect(harness.abortLane).toHaveBeenCalledWith('lane-mimi');expect(group.messages.filter((m) => m.kind === 'notice').map((m) => [m.noticeCode, m.authorName])).toEqual([['member-timeout', '咪咪']]);+ expect(group.messages.find((m) => m.kind === 'notice')?.runtimeFailureCode).toBe('RUNTIME_TIMEOUT');expect(harness.dispatches.map((call) => call.botId)).toEqual(['mimi', 'xiaoman', 'abu']);});@@ -705,6 +737,40 @@ describe('botGroupChatService 分工', () => {.toEqual({ text: '帮我给官网做一个介绍页' });});+ it('preserves the timeout category when a local plan step times out', async () => {+ vi.useFakeTimers({ shouldAdvanceTime: true });+ const harness = createHarness(() => null, { decidePlan: async () => THREE_STEPS, workDir: fakeWorkDir(), stepTurnTimeoutMs: 1_000 });+ const groupId = await createGroup(harness);+ const plan = await proposePlan(harness, groupId);+ await harness.service.startPlan({ groupId, planId: plan.id });+ await vi.waitFor(() => expect(harness.dispatches.at(-1)?.sessionId).toBe('plan-mimi'));+ await vi.advanceTimersByTimeAsync(1_100);+ const group = await waitForIdle(harness, groupId);+ expect(harness.abortLane).toHaveBeenCalledWith('plan-mimi');+ expect(openPlan(group).steps[0].status).toBe('failed');+ expect(group.messages.find((message) => message.kind === 'notice' && message.planId === plan.id))+ .toMatchObject({ noticeCode: 'member-timeout', runtimeFailureCode: 'RUNTIME_TIMEOUT', content: '' });+ });++ it.each([+ ['NO_MODEL', 'MODEL_UNAVAILABLE'],+ ['MEMBER_UNAVAILABLE', undefined],+ ] as const)('preserves the preparation reason %s for a local plan without dispatching', async (errorCode, failureCode) => {+ const harness = createHarness(() => null, { decidePlan: async () => THREE_STEPS, workDir: fakeWorkDir(),+ ensureLane: async () => ({ ok: false, errorCode, message: 'private preparation details' }),+ });+ const groupId = await createGroup(harness);+ const plan = await proposePlan(harness, groupId);+ await harness.service.startPlan({ groupId, planId: plan.id });+ const group = await waitForIdle(harness, groupId);+ expect(harness.dispatches).toEqual([]);+ expect(openPlan(group).status).toBe('waiting');+ expect(openPlan(group).steps[0].status).toBe('failed');+ expect(group.messages.find(message => message.kind === 'notice' && message.planId === plan.id))+ .toMatchObject({ noticeCode: 'member-unavailable', runtimeFailureCode: failureCode, content: '' });+ expect(JSON.stringify(group.messages)).not.toContain('private preparation details');+ });+it('runs the steps one at a time in the plan work directory and stops after each', async () => {const replies: Record<string, string> = { mimi: '策划做完了', xiaoman: '设计好了', abu: '写好了' };const workDir = fakeWorkDir();diff --git a/apps/desktop/src/main/maker-ipc/__tests__/botGroupRemoteResourceProvider.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/botGroupRemoteResourceProvider.test.tsindex 4cb3fa222f..baecf35b11 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/botGroupRemoteResourceProvider.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/botGroupRemoteResourceProvider.test.ts@@ -195,6 +195,16 @@ describe('bot group remote resources', () => {expect(plain.blocks?.[0]?.fallbackMarkdown).toContain('**阿布**: 写好了');});+ it('projects current failures for existing phones without putting notices into the message cache', () => {+ const group = detail();+ const source = group.messages[0]!;+ group.executionFailures = [{ executionId: 'run', epoch: 1, sourceMessageId: source.id,+ botId: 'abu', botName: '阿布', code: 'AUTH_REQUIRED', planId: null }];+ expect(botGroupRemoteChatData(group).messages).toContainEqual(expect.objectContaining({ id: 'execution-failure:run:1', runtimeFailureCode: 'AUTH_REQUIRED' }));+ expect(group.messages).not.toContainEqual(expect.objectContaining({ kind: 'notice' }));+ expect(botGroupRemoteChatData({ ...group, executionFailures: [] }).messages).toEqual(group.messages);+ });+it.each(['member-joined', null] as const)('keeps system notices (%s) visible to old phones through the plain fallback', async noticeCode => {const joined = { ...detail().messages[0]!, kind: 'notice' as const, authorKind: 'system' as const,noticeCode, authorName: 'Taylor', content: 'Taylor joined the group' };diff --git a/apps/desktop/src/main/maker-ipc/__tests__/botGroupRuntimeFailure.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/botGroupRuntimeFailure.test.tsnew file mode 100644index 0000000000..a34eadd398--- /dev/null+++ b/apps/desktop/src/main/maker-ipc/__tests__/botGroupRuntimeFailure.test.ts@@ -0,0 +1,94 @@+import { describe, expect, it, vi } from 'vitest';+import { botGroupRuntimeFailureCode, readBotGroupRuntimeFailureDetail, settleUndispatchedBotGroupTurn } from '../botGroupRuntimeFailure.js';++describe('group runtime failure diagnostics', () => {+ it.each([+ ['NO_MODEL', 'MODEL_UNAVAILABLE'],+ ['Selected model is at capacity. Please try a different model.', 'UPSTREAM_OVERLOADED'],+ ['overloaded_error', 'UPSTREAM_OVERLOADED'],+ ['the private queue is overloaded', 'RUNTIME_ERROR'],+ ['[PI_IMAGE_INPUT_UNSUPPORTED] private model details', 'IMAGE_INPUT_UNSUPPORTED'],+ ['[MODEL_NOT_FOUND] private route', 'MODEL_UNAVAILABLE'],+ ['[INVALID_TOKEN] private token', 'AUTH_REQUIRED'],+ ['[RATE_LIMIT_EXCEEDED] private response', 'RATE_LIMITED'],+ ['[INSUFFICIENT_BALANCE] private account', 'QUOTA_EXCEEDED'],+ ['ECONNRESET private endpoint', 'NETWORK_ERROR'],+ ['RUNTIME_TIMEOUT', 'RUNTIME_TIMEOUT'],+ ['pi rpc timeout after 30000ms: prompt', 'RUNTIME_TIMEOUT'],+ ['pi rpc timeout after 30000ms: set_model', 'RUNTIME_ERROR'],+ ['Request rejected (429): ExceededBudget private account', 'QUOTA_EXCEEDED'],+ ['budget_exceeded private account', 'QUOTA_EXCEEDED'],+ ['quota exceeded private account', 'QUOTA_EXCEEDED'],+ ['unknown private prompt, path and credentials', 'RUNTIME_ERROR'],+ ])('classifies %s without returning the diagnostic text', (error, code) => {+ expect(botGroupRuntimeFailureCode(new Error(error))).toBe(code);+ });++ it.each([+ [{ message: '[PI_IMAGE_INPUT_UNSUPPORTED] private model details' }, 'IMAGE_INPUT_UNSUPPORTED'],+ [{ code: 'INVALID_TOKEN', message: 'private response' }, 'AUTH_REQUIRED'],+ [{ reason: 'rate_limit_error', message: 'private response' }, 'RATE_LIMITED'],+ [{ code: 'ECONNRESET', message: 'private endpoint' }, 'NETWORK_ERROR'],+ [{ message: 'Authorization: [REDACTED]', errorStatus: 429, usageLimit: true }, 'QUOTA_EXCEEDED'],+ [{ sdkError: 'billing_error' }, 'QUOTA_EXCEEDED'],+ [{ reason: 'provider_quota_limit' }, 'QUOTA_EXCEEDED'],+ [{ errorStatus: 402 }, 'QUOTA_EXCEEDED'],+ [{ errorStatus: 401 }, 'AUTH_REQUIRED'],+ [{ errorStatus: 403 }, 'AUTH_REQUIRED'],+ [{ sdkError: 'authentication_failed' }, 'AUTH_REQUIRED'],+ [{ reason: 'provider_auth_or_access' }, 'AUTH_REQUIRED'],+ [{ sdkError: 'rate_limit', errorStatus: 429, usageLimit: true }, 'RATE_LIMITED'],+ [{ reason: 'provider_rate_limit', usageLimit: true }, 'RATE_LIMITED'],+ [{ errorStatus: 429, usageLimit: false }, 'RATE_LIMITED'],+ [{ message: 'Too many requests', errorStatus: 429, usageLimit: true }, 'RATE_LIMITED'],+ [{ sdkError: 'rate_limit', message: 'ExceededBudget', errorStatus: 429, usageLimit: true }, 'QUOTA_EXCEEDED'],+ [{ sdkError: 'model_not_found' }, 'MODEL_UNAVAILABLE'],+ [{ code: 'NO_MODEL', message: 'private preparation details' }, 'MODEL_UNAVAILABLE'],+ [{ codexErrorInfo: 'serverOverloaded', message: '[REDACTED]' }, 'UPSTREAM_OVERLOADED'],+ [{ reason: 'upstream-overload', message: '[REDACTED]' }, 'UPSTREAM_OVERLOADED'],+ [{ errorStatus: 529, message: '[REDACTED]' }, 'UPSTREAM_OVERLOADED'],+ [{ modelAccessDenied: true, errorStatus: 403 }, 'MODEL_UNAVAILABLE'],+ [{ sdkError: 'user_model_access_denied' }, 'MODEL_UNAVAILABLE'],+ [{ codexErrorInfo: 'usageLimitExceeded', message: '[REDACTED]' }, 'QUOTA_EXCEEDED'],+ [{ codexErrorInfo: 'sessionBudgetExceeded', message: '[REDACTED]' }, 'QUOTA_EXCEEDED'],+ [{ codexErrorInfo: 'unauthorized', message: '[REDACTED]' }, 'AUTH_REQUIRED'],+ [{ codexErrorInfo: 'usageLimitExceeded', errorStatus: 401, sdkError: 'rate_limit' }, 'QUOTA_EXCEEDED'],+ [{ codexErrorInfo: 'unauthorized', sdkError: 'billing_error' }, 'AUTH_REQUIRED'],+ [{ codexErrorInfo: 'httpConnectionFailed', message: '[REDACTED]' }, 'NETWORK_ERROR'],+ [{ codexErrorInfo: 'responseStreamConnectionFailed' }, 'NETWORK_ERROR'],+ [{ codexErrorInfo: 'responseStreamDisconnected' }, 'NETWORK_ERROR'],+ [{ codexErrorInfo: 'httpConnectionFailed', errorStatus: 401 }, 'AUTH_REQUIRED'],+ [{ codexErrorInfo: 'unknown private diagnostic' }, 'RUNTIME_ERROR'],+ [{ reason: 'turn_no_event_timeout', message: '[REDACTED]' }, 'RUNTIME_TIMEOUT'],+ [{ reason: 'bridge_turn_no_event_timeout' }, 'RUNTIME_TIMEOUT'],+ [{ reason: 'upstream_response_idle_timeout', message: '[REDACTED]' }, 'RUNTIME_TIMEOUT'],+ [{ reason: 'bridge_upstream_response_idle_timeout' }, 'RUNTIME_TIMEOUT'],+ [{ reason: 'pi-prompt-timeout', message: '[REDACTED]' }, 'RUNTIME_TIMEOUT'],+ [{ sdkError: 'pi rpc timeout after 60000ms: prompt' }, 'RUNTIME_TIMEOUT'],+ [{ code: 'unknown', message: 'private prompt' }, 'RUNTIME_ERROR'],+ ])('classifies structured terminal diagnostics %j', (error, code) => {+ expect(botGroupRuntimeFailureCode(error)).toBe(code);+ });++ it('accepts only exact public codes from stored failure details', () => {+ expect(readBotGroupRuntimeFailureDetail('cindy-runtime-error:IMAGE_INPUT_UNSUPPORTED')).toBe('IMAGE_INPUT_UNSUPPORTED');+ for (const value of ['raw private error', 'cindy-runtime-error:secret-token', 'cindy-runtime-error:AUTH_REQUIRED private data', null]) {+ expect(readBotGroupRuntimeFailureDetail(value)).toBeUndefined();+ }+ });++ it('settles the exact failed input and leaves explicit cancellation to Stop', async () => {+ const service = { settleLaneTurn: vi.fn(async () => true) };+ expect(await settleUndispatchedBotGroupTurn(service, 'lane', 'failed-input', 'failed', '[PI_IMAGE_INPUT_UNSUPPORTED] private details')).toBe(true);+ expect(service.settleLaneTurn).toHaveBeenCalledExactlyOnceWith({ sessionId: 'lane', activeInputClientId: 'failed-input', outcome: 'error', resultText: '', failureCode: 'IMAGE_INPUT_UNSUPPORTED', undispatched: true });+ expect(await settleUndispatchedBotGroupTurn(service, 'lane', 'stopped-input', 'cancelled', 'private details')).toBe(false);+ expect(service.settleLaneTurn).toHaveBeenCalledTimes(1);+ });++ it('uses the same Pi prompt timeout signal for an undispatched input without exposing diagnostics', async () => {+ const service = { settleLaneTurn: vi.fn(async () => true) };+ await settleUndispatchedBotGroupTurn(service, 'lane', 'input', 'failed', 'pi rpc timeout after 30000ms: prompt /private/path');+ expect(service.settleLaneTurn).toHaveBeenCalledExactlyOnceWith({ sessionId: 'lane', activeInputClientId: 'input',+ outcome: 'error', resultText: '', failureCode: 'RUNTIME_TIMEOUT', undispatched: true });+ });+});diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.tsindex 07c97929b1..ae0453345f 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts@@ -42,6 +42,8 @@ vi.mock('ws', async () => {} };});import { withChatServer } from '../chatServer.js';+import { projectBotGroupExecutionFailures } from '@cindy/maker-shared/botGroupPresentation';+import { botGroupRuntimeFailureCode, settleUndispatchedBotGroupTurn } from '../botGroupRuntimeFailure.js';import { authorizeGroupTool } from '../botGroupToolAuthorization.js';import type { BotGroupChatService, BotGroupChatServiceDeps } from '../botGroupChatService.js';@@ -99,7 +101,7 @@ describe('Chat Server result delivery and refresh', () => {return { body: { execution: next } };}if (route.endsWith('/snapshot')) return { body: { room: room(route.split('/')[2]), members: [], messages: [], cursor: '1' } };- if (route.includes('/messages?') || route.endsWith('/executions') || route.includes('/plans')) return { body: [] };+ if (route.includes('/messages?') || route.endsWith('/executions') || route.includes('/execution-failures?') || route.includes('/plans')) return { body: [] };return { body: {} };}beforeEach(() => {@@ -118,6 +120,25 @@ describe('Chat Server result delivery and refresh', () => {service = withChatServer({ listGroups: vi.fn(async () => ({ ok: true, groups: [] })), settleLaneTurn: vi.fn(async () => false), dispose: vi.fn() } as unknown as BotGroupChatService, deps);});afterEach(() => { service.dispose(); vi.useRealTimers(); vi.unstubAllEnvs(); fixture.config = ''; vi.clearAllMocks(); });+ it.each(['structured', 'old-marker', 'chat-forgery'])('projects imported runtime notices safely: %s', async shape => {+ const imported = { id: '60000000-0000-4000-8000-000000000001', seq: '1', authorId: selfId,+ author: { kind: 'human', name: 'Owner' }, origin: shape === 'chat-forgery' ? 'chat' : 'import', deleted: false, threadRootId: null,+ content: [{ type: 'text', text: shape === 'structured' ? 'group activity' : 'cindy-runtime-error:AUTH_REQUIRED' },+ { type: 'card', namespace: 'cindy.local-history', schemaRevision: 1, fallback: 'group activity',+ data: { kind: 'notice', authorKind: 'system', authorName: 'Bot', noticeCode: 'member-failed',+ ...(shape !== 'old-marker' ? { runtimeFailureCode: 'AUTH_REQUIRED' } : {}) } }] };+ fixture.handle.mockImplementation(route => route.includes('/messages?') ? { body: [imported] } : response(route));+ const result = await service.getGroup(roomId);+ expect(result.ok).toBe(true);+ if (!result.ok) throw new Error('Expected group');+ if (shape === 'chat-forgery') {+ expect(result.group.messages[0]).toMatchObject({ kind: 'message', authorKind: 'user' });+ expect(result.group.messages[0].runtimeFailureCode).toBeUndefined();+ } else {+ expect(result.group.messages[0]).toMatchObject({ kind: 'notice', authorKind: 'system', authorName: 'Bot', runtimeFailureCode: 'AUTH_REQUIRED', content: '' });+ expect(JSON.stringify(result.group.messages)).not.toContain('cindy-runtime-error:');+ }+ });it.each(['ATTACHMENT_UNAVAILABLE', 'INVALID_PARAMS'] as const)('keeps a useful reason for prepare %s', async (errorCode) => {deps.prepareAttachments = vi.fn(async () => ({ ok: false as const, errorCode, message: 'private details' }));deps.log = { warn: vi.fn() };@@ -173,6 +194,249 @@ describe('Chat Server result delivery and refresh', () => {}const terminal = { sessionId: 'lane', activeInputClientId: null, outcome: 'done' as const, resultText: 'Finished reply' };const deliveries = () => fixture.handle.mock.calls.filter(([, , body]) => body?.action === 'complete');++ it.each([{ codexErrorInfo: 'serverOverloaded' }, { reason: 'upstream-overload' }, { errorStatus: 529 }])+ ('submits only the capacity category after the SDK terminal %j', async signals => {+ await start();+ const failureCode = botGroupRuntimeFailureCode({ ...signals, message: 'private endpoint and credential' });+ await service.settleLaneTurn({ ...terminal, outcome: 'error', resultText: '', failureCode });+ const failures = fixture.handle.mock.calls.filter(([, , body]) => body?.action === 'fail');+ expect(failures).toHaveLength(1);+ expect(failures[0][2]).toMatchObject({ detail: 'cindy-runtime-error:UPSTREAM_OVERLOADED' });+ expect(JSON.stringify(failures)).not.toContain('private endpoint and credential');+ expect(deps.abortLane).not.toHaveBeenCalled();+ });++ it.each([+ ['NO_MODEL', 'MODEL_UNAVAILABLE'],+ ['MEMBER_UNAVAILABLE', 'RUNTIME_ERROR'],+ ])('settles the lane preparation failure %s without dispatching or exposing details', async (errorCode, failureCode) => {+ fixture.profiles = [{ id: 'local-bot', displayName: 'Bot', avatar: null, status: 'active' }];+ deps.ensureLane = vi.fn(async () => ({ ok: false as const, errorCode, message: 'private preparation details' }));+ await vi.advanceTimersByTimeAsync(2000);+ expect(deps.dispatch).not.toHaveBeenCalled();+ expect(deps.abortLane).not.toHaveBeenCalled();+ const failures = fixture.handle.mock.calls.filter(([, , body]) => body?.action === 'fail');+ expect(failures).toHaveLength(1);+ expect(failures[0][2]).toMatchObject({ detail: `cindy-runtime-error:${failureCode}` });+ expect(JSON.stringify(failures)).not.toContain('private preparation details');+ });++ it.each([+ ['authentication_failed private credential', 'AUTH_REQUIRED'],+ ['ECONNRESET private endpoint', 'NETWORK_ERROR'],+ ['pi rpc timeout after 30000ms: prompt /private/path', 'RUNTIME_TIMEOUT'],+ ])('classifies an unqueued dispatch rejection from its local message: %s', async (message, code) => {+ deps.dispatch = vi.fn(async () => ({ ok: false as const, errorCode: 'INTERNAL', message }));+ await start();+ const failures = fixture.handle.mock.calls.filter(([, , body]) => body?.action === 'fail');+ expect(failures).toHaveLength(1);+ expect(failures[0][2]).toMatchObject({ detail: `cindy-runtime-error:${code}` });+ expect(JSON.stringify(failures)).not.toContain(message);+ expect(deps.abortLane).toHaveBeenCalledExactlyOnceWith('lane');+ });++ it('immediately fails an undispatched group input without waiting for an Agent event or timeout', async () => {+ deps.dispatch = vi.fn(async input => {+ await input.onAccepted();+ await settleUndispatchedBotGroupTurn(service, input.targetSessionId, input.clientId, 'failed', '[PI_IMAGE_INPUT_UNSUPPORTED] private path and token');+ return { ok: true as const, targetSessionId: input.targetSessionId, wakeKind: 'queued' };+ });+ await start();+ const failures = () => fixture.handle.mock.calls.filter(([, , body]) => body?.action === 'fail');+ expect(failures()).toHaveLength(1);+ expect(failures()[0][2]).toMatchObject({ detail: 'cindy-runtime-error:IMAGE_INPUT_UNSUPPORTED' });+ expect(deps.abortLane).toHaveBeenCalledExactlyOnceWith('lane');+ const heartbeats = fixture.handle.mock.calls.filter(([, , body]) => body?.action === 'heartbeat').length;+ await vi.advanceTimersByTimeAsync(45_000);+ expect(failures()).toHaveLength(1);+ expect(fixture.handle.mock.calls.filter(([, , body]) => body?.action === 'heartbeat')).toHaveLength(heartbeats);+ expect(JSON.stringify(failures())).not.toContain('private path and token');+ });++ it('rejects an old undispatched input instead of failing its replacement', async () => {+ await start();+ expect(await settleUndispatchedBotGroupTurn(service, 'lane', 'old-input', 'failed', 'MODEL_NOT_FOUND')).toBe(false);+ expect(fixture.handle.mock.calls.some(([, , body]) => body?.action === 'fail')).toBe(false);+ expect(deps.abortLane).not.toHaveBeenCalled();+ await service.settleLaneTurn(terminal);+ expect(deliveries()).toHaveLength(1);+ });++ it('retries a lost failure receipt without rerunning the Agent or changing the failure body', async () => {+ let failures = 0;+ fixture.handle.mockImplementation((route, method, body) => {+ if (body?.action === 'fail' && ++failures === 1) throw new Error('ECONNRESET');+ return response(route);+ });+ deps.dispatch = vi.fn(async input => {+ await settleUndispatchedBotGroupTurn(service, input.targetSessionId, input.clientId, 'failed', 'MODEL_NOT_FOUND');+ return { ok: true as const, targetSessionId: input.targetSessionId, wakeKind: 'queued' };+ });+ await start();+ await vi.advanceTimersByTimeAsync(16_000);+ const attempts = fixture.handle.mock.calls.filter(([, , body]) => body?.action === 'fail');+ expect(attempts).toHaveLength(2);+ expect(attempts[1][2]).toEqual(attempts[0][2]);+ expect(attempts[0][2]).toMatchObject({ detail: 'cindy-runtime-error:MODEL_UNAVAILABLE' });+ expect(deps.dispatch).toHaveBeenCalledOnce();+ });++ it('settles once when a pre-dispatch rejection is followed by a late dispatch exception and SDK terminal', async () => {+ let failures = 0;+ fixture.handle.mockImplementation((route, method, body) => {+ if (body?.action === 'fail' && ++failures === 1) throw new Error('ECONNRESET');+ return response(route);+ });+ deps.dispatch = vi.fn(async input => {+ await settleUndispatchedBotGroupTurn(service, input.targetSessionId, input.clientId, 'failed', '[PI_IMAGE_INPUT_UNSUPPORTED] local diagnostic');+ throw new Error('late network error');+ });+ await start();+ await service.settleLaneTurn({ ...terminal, activeInputClientId: vi.mocked(deps.dispatch).mock.calls[0][0].clientId, outcome: 'error', failureCode: 'NETWORK_ERROR' });+ expect(deps.abortLane).toHaveBeenCalledExactlyOnceWith('lane');+ await vi.advanceTimersByTimeAsync(16_000);+ const attempts = fixture.handle.mock.calls.filter(([, , body]) => body?.action === 'fail');+ expect(attempts).toHaveLength(2);+ expect(attempts[1][2]).toEqual(attempts[0][2]);+ expect(attempts[1][2]).toMatchObject({ detail: 'cindy-runtime-error:IMAGE_INPUT_UNSUPPORTED' });+ expect(deliveries()).toEqual([]);+ expect(deps.dispatch).toHaveBeenCalledOnce();+ });++ it.each(['IMAGE_INPUT_UNSUPPORTED', 'private token and path'])('projects a failed execution from its visible source with a safe code %s', async code => {+ const source = { id: execution.source_message_id, seq: '7', authorId: selfId, author: { kind: 'human', name: 'Owner' },+ content: [{ type: 'text', text: 'Question' }], origin: 'user', deleted: false, threadRootId: null, createdAt: '2026-10-03T00:00:00Z' };+ fixture.handle.mockImplementation((route, method, body) => {+ if (route.endsWith('/snapshot')) return { body: { room: room(roomId), members: [], messages: [source], cursor: '7' } };+ if (route.includes('/messages?')) return { body: [source] };+ if (route.endsWith('/executions') || route.includes('/execution-failures?')) return { body: [{ ...execution, status: 'failed', failure_code: code }] };+ return response(route);+ });+ const result = await service.getGroup(roomId);+ expect(result).toMatchObject({ ok: true, group: { round: { status: 'idle', speakers: [] } } });+ if (!result.ok) throw new Error('group missing');+ expect(result.group.messages).toHaveLength(1);+ const notice = projectBotGroupExecutionFailures(result.group.messages, result.group.executionFailures)[1];+ expect(notice).toMatchObject({ sequence: 7, authorName: 'Bot', runtimeFailureCode: code === 'IMAGE_INPUT_UNSUPPORTED' ? code : 'RUNTIME_ERROR' });+ expect(JSON.stringify(notice)).not.toContain('private token and path');+ });++ it.each(['failed', 'queued', 'running', 'succeeded', 'cancelled'])('returns failure state separately from the requested message page (status: %s)', async status => {+ fixture.handle.mockImplementation(route => {+ if (route.endsWith('/members')) return { body: [] };+ if (route.endsWith(`/messages/${execution.source_message_id}`)) return { body: { id: execution.source_message_id, seq: '7',+ authorId: selfId, author: { kind: 'human', name: 'Owner' }, content: [], origin: 'user', deleted: false,+ threadRootId: null, createdAt: '2026-10-03T00:00:00Z' } };+ if (route.includes('/messages?')) return { body: [] };+ if (route.endsWith('/executions') || route.includes('/execution-failures?')) return { body: [{ ...execution, status, epoch: 2, failure_code: 'AUTH_REQUIRED' }] };+ return response(route);+ });+ const result = await service.getGroup(roomId, { sourceMessageIds: [execution.source_message_id] });+ if (!result.ok) throw new Error('group missing');+ expect(result.group.messages).toEqual([]);+ expect(result.group.executionFailures).toEqual(status === 'failed' ? [expect.objectContaining({ executionId: execution.id, epoch: 2, code: 'AUTH_REQUIRED' })] : []);+ const thread = await service.chatServer!.thread({ groupId: roomId, rootId: execution.source_message_id });+ expect(thread).toMatchObject({ ok: true, executionFailures: result.group.executionFailures });+ });++ it('queries only displayed sources in batches without truncating older loaded history', async () => {+ const ids = Array.from({ length: 250 }, (_, n) => `00000000-0000-4000-8000-${String(n).padStart(12, '0')}`);+ const sourceId = ids[249];+ fixture.handle.mockImplementation(route => {+ if (route.includes('/execution-failures?')) {+ const requested = new URLSearchParams(route.split('?')[1]).get('sourceIds')!.split(',');+ return { body: [{ ...execution, source_message_id: execution.source_message_id, failure_code: 'AUTH_REQUIRED', status: 'failed' },+ ...requested.includes(sourceId) ? [{ ...execution, source_message_id: sourceId, failure_code: 'AUTH_REQUIRED', status: 'failed' }] : []] };+ }+ return response(route);+ });+ const result = await service.getGroup(roomId, { sourceMessageIds: [...ids, sourceId] });+ expect(result).toMatchObject({ ok: true, group: { executionFailures: [{ sourceMessageId: sourceId, code: 'AUTH_REQUIRED' }] } });+ const scopes = fixture.handle.mock.calls.filter(([route]) => route.includes('/execution-failures?'))+ .map(([route]) => new URLSearchParams(route.split('?')[1]).get('sourceIds')!.split(','));+ expect(scopes.map(ids => ids.length)).toEqual([100, 100, 50]);+ expect(scopes.flat()).toEqual(ids);+ });++ it('reads old failures from the authoritative snapshot even when absent from the recent execution list', async () => {+ fixture.handle.mockImplementation(route => {+ if (route.endsWith('/executions')) return { body: Array.from({ length: 100 }, (_, n) => ({ ...execution, id: `newer-${n}`, status: 'succeeded' })) };+ if (route.includes('/execution-failures?')) return { body: [{ id: execution.id, conversation_id: roomId,+ bot_id: botId, source_message_id: execution.source_message_id, epoch: 3, failure_code: 'AUTH_REQUIRED' }] };+ return response(route);+ });+ const result = await service.getGroup(roomId, { sourceMessageIds: [execution.source_message_id] });+ expect(result).toMatchObject({ ok: true, group: { messages: [], executionFailures: [+ { executionId: execution.id, epoch: 3, sourceMessageId: execution.source_message_id, code: 'AUTH_REQUIRED' },+ ] } });+ });++ it('does not turn a failure snapshot denial into an empty state or legacy fallback', async () => {+ fixture.handle.mockImplementation(route => route.includes('/execution-failures?')+ ? { status: 403, body: { code: 'NOT_MEMBER' } } : response(route));+ const result = await service.getGroup(roomId, { sourceMessageIds: [execution.source_message_id] });+ expect(result.ok).toBe(false);+ // One recent-list read is needed for round status; a denial must not read it again as fallback.+ expect(fixture.handle.mock.calls.filter(([route]) => route.endsWith('/executions'))).toHaveLength(1);+ });++ it.each([false, true])('does not project failures for paged-out or deleted sources (deleted: %s)', async deleted => {+ const source = { id: execution.source_message_id, seq: '7', authorId: selfId, author: { kind: 'human', name: 'Owner' },+ content: [], origin: 'user', deleted, threadRootId: null, createdAt: '2026-10-03T00:00:00Z' };+ fixture.handle.mockImplementation((route, method, body) => {+ if (route.includes('/messages?')) return { body: deleted ? [source] : [] };+ if (route.endsWith('/executions') || route.includes('/execution-failures?')) return { body: [{ ...execution, status: 'failed', failure_code: 'IMAGE_INPUT_UNSUPPORTED' }] };+ return response(route);+ });+ const result = await service.getGroup(roomId);+ if (!result.ok) throw new Error('group missing');+ expect(projectBotGroupExecutionFailures(result.group.messages, result.group.executionFailures).some(message => message.kind === 'notice')).toBe(false);+ });++ it.each([false, true])('uses the same failure snapshot for root and replies without affecting pagination and clears them on retry (deleted: %s)', async deleted => {+ const root = { id: execution.source_message_id, seq: '7', authorId: selfId, author: { kind: 'human', name: 'Owner' },+ content: [{ type: 'text', text: 'Root question' }], origin: 'user', deleted, threadRootId: null, createdAt: '2026-10-03T00:00:00Z' };+ const replies = Array.from({ length: 50 }, (_, i) => ({ ...root, id: `reply-${i}`, seq: String(i + 8), deleted: false, threadRootId: root.id }));+ let status = 'failed';+ fixture.handle.mockImplementation(route => {+ if (route.endsWith(`/messages/${root.id}`)) return { body: root };+ if (route.includes('/messages?')) return { body: [...replies].reverse() };+ if (route.endsWith('/members')) return { body: [] };+ if (route.endsWith('/executions') || route.includes('/execution-failures?')) return { body: [{ ...execution, status, failure_code: 'IMAGE_INPUT_UNSUPPORTED' }] };+ return response(route);+ });+ const result = await service.chatServer!.thread({ groupId: roomId, rootId: root.id });+ if (!result.ok) throw new Error('thread missing');+ expect(result.hasMore).toBe(true);+ expect(result.replies).toHaveLength(50);+ expect(result.replies.some(message => message.kind === 'notice')).toBe(false);+ expect(projectBotGroupExecutionFailures([result.root], result.executionFailures).slice(1)).toEqual(deleted ? [] : [expect.objectContaining({ sequence: 7, runtimeFailureCode: 'IMAGE_INPUT_UNSUPPORTED' })]);+ status = 'queued';+ const retry = await service.chatServer!.thread({ groupId: roomId, rootId: root.id, before: 8 });+ expect(retry).toMatchObject({ ok: true, executionFailures: [], hasMore: true });+ });++ it('keeps the specific local failure on an older server and clears the notice after retry', async () => {+ await start();+ await service.settleLaneTurn({ ...terminal, outcome: 'error', failureCode: 'IMAGE_INPUT_UNSUPPORTED' });+ const source = { id: execution.source_message_id, seq: '7', authorId: selfId, author: { kind: 'human', name: 'Owner' },+ content: [{ type: 'text', text: 'Question' }], origin: 'user', deleted: false, threadRootId: null, createdAt: '2026-10-03T00:00:00Z' };+ let status = 'failed';+ fixture.handle.mockImplementation((route, method, body) => {+ if (route.includes('/messages?')) return { body: [source] };+ if (route.includes('/execution-failures?')) return { status: 404, body: { code: 'NOT_FOUND' } };+ if (route.endsWith('/executions')) return { body: [{ ...execution, status }] };+ return response(route);+ });+ const failed = await service.getGroup(roomId);+ if (!failed.ok) throw new Error('group missing');+ expect(projectBotGroupExecutionFailures(failed.group.messages, failed.group.executionFailures)[1]).toMatchObject({ runtimeFailureCode: 'IMAGE_INPUT_UNSUPPORTED' });+ status = 'queued';+ const retrying = await service.getGroup(roomId);+ if (!retrying.ok) throw new Error('group missing');+ expect(projectBotGroupExecutionFailures(retrying.group.messages, retrying.group.executionFailures).some(message => message.kind === 'notice')).toBe(false);+ });const joinedTrigger = () => ({ type: 'member.joined', messageId: execution.source_message_id, actorId: selfId, displayName: 'New member' });const joinedSource = () => ({ id: execution.source_message_id, seq: '1', authorId: selfId,author: { kind: 'human', name: 'New member' }, origin: 'system', deleted: false, threadRootId: null,@@ -362,7 +626,7 @@ describe('Chat Server result delivery and refresh', () => {it('keeps welcome executions out of the continue-discussion source selection', async () => {fixture.handle.mockImplementation(route => {- if (route.endsWith('/executions')) return { body: [{ ...execution, status: 'succeeded', trigger_type: 'member.joined', trigger: joinedTrigger() }] };+ if (route.endsWith('/executions') || route.includes('/execution-failures?')) return { body: [{ ...execution, status: 'succeeded', trigger_type: 'member.joined', trigger: joinedTrigger() }] };if (route.endsWith('/snapshot')) return { body: { ...response(route).body, messages: [joinedSource()] } };if (route.includes('/messages?')) return { body: [joinedSource()] };return response(route);diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServerMigration.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServerMigration.test.tsindex d0e75cc8ee..21b139cd9f 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServerMigration.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServerMigration.test.ts@@ -28,6 +28,22 @@ function fixture() {return { deps, rows, committed, offline: () => { online = false; } };}describe('local groups upgrade', () => {+ it.each(['stored', 'projected'])('imports %s runtime notices as safe metadata rather than marker text', async shape => {+ const f = fixture(); f.rows.splice(1);+ Object.assign(f.rows[0], { kind: 'notice', authorKind: 'system', authorName: 'Bot', noticeCode: 'member-failed',+ content: shape === 'stored' ? 'cindy-runtime-error:AUTH_REQUIRED' : '',+ ...(shape === 'projected' ? { runtimeFailureCode: 'AUTH_REQUIRED' } : {}) });+ await migrateLocalGroups(f.deps);+ const row = [...f.committed.values()][0] as { content: Array<{ type: string; data?: Record<string, unknown> }> };+ expect(row.content.find(block => block.type === 'card')?.data).toMatchObject({ kind: 'notice', authorKind: 'system', runtimeFailureCode: 'AUTH_REQUIRED' });+ expect(row.content.some(block => block.type === 'text')).toBe(false);+ expect(JSON.stringify(row)).not.toContain('cindy-runtime-error:');+ });+ it('keeps marker-shaped user text as ordinary history', async () => {+ const f = fixture(); f.rows.splice(1); f.rows[0].content = 'cindy-runtime-error:AUTH_REQUIRED';+ await migrateLocalGroups(f.deps);+ expect(JSON.stringify([...f.committed.values()])).toContain('cindy-runtime-error:AUTH_REQUIRED');+ });it('imports every page in order with original authors/time, then resumes without reposting', async () => {const f = fixture();expect((await migrateLocalGroups(f.deps)).get(groupId)).toBe(roomId);diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServerParity.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServerParity.test.tsindex 8b438bbfbe..0710a13f0f 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServerParity.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServerParity.test.ts@@ -63,7 +63,7 @@ describe('server group feature parity', () => {return { body: { execution: next } };}if (route.endsWith('/snapshot')) return { body: { room: room(route.split('/')[2]), members: [], messages: [], cursor: '1' } };- if (route.includes('/messages?') || route.endsWith('/executions') || route.includes('/plans')) return { body: [] };+ if (route.includes('/messages?') || route.endsWith('/executions') || route.includes('/execution-failures?') || route.includes('/plans')) return { body: [] };return { body: {} };}beforeEach(() => {@@ -192,7 +192,7 @@ describe('server group feature parity', () => {finish({ needsPlan: true, steps }); await flush();expect(planPosts()).toHaveLength(0);const view = await service.getGroup(roomId);- expect(view.ok && view.group.planningBotId).toBeNull();+ expect(view).toMatchObject({ ok: true, group: { planningBotId: null } });});it('keeps @all on an existing proposal as discussion, not a revision', async () => {arrange(proposed);diff --git a/apps/desktop/src/main/maker-ipc/__tests__/sessionEventPipeline.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/sessionEventPipeline.test.tsindex c45f9928e4..d74347089c 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/sessionEventPipeline.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/sessionEventPipeline.test.ts@@ -1696,6 +1696,32 @@ describe('Bot adapters in the shared event pipeline', () => {await h.dispose();});+ it.each([+ [{ message: 'Authorization: [REDACTED]', errorStatus: 429, usageLimit: true }, 'QUOTA_EXCEEDED'],+ [{ errorStatus: 401 }, 'AUTH_REQUIRED'],+ [{ sdkError: 'authentication_failed' }, 'AUTH_REQUIRED'],+ [{ sdkError: 'rate_limit', errorStatus: 429, usageLimit: true }, 'RATE_LIMITED'],+ [{ codexErrorInfo: 'usageLimitExceeded', message: '[REDACTED]' }, 'QUOTA_EXCEEDED'],+ [{ codexErrorInfo: 'sessionBudgetExceeded', message: '[REDACTED]' }, 'QUOTA_EXCEEDED'],+ [{ codexErrorInfo: 'unauthorized', message: '[REDACTED]' }, 'AUTH_REQUIRED'],+ [{ codexErrorInfo: 'responseStreamDisconnected', message: '[REDACTED]' }, 'NETWORK_ERROR'],+ [{ reason: 'turn_no_event_timeout', message: '[REDACTED]' }, 'RUNTIME_TIMEOUT'],+ [{ reason: 'bridge_turn_no_event_timeout', message: '[REDACTED]' }, 'RUNTIME_TIMEOUT'],+ [{ reason: 'upstream_response_idle_timeout', message: '[REDACTED]' }, 'RUNTIME_TIMEOUT'],+ [{ reason: 'bridge_upstream_response_idle_timeout', message: '[REDACTED]' }, 'RUNTIME_TIMEOUT'],+ ])('settles a group terminal error with the safe category from structured signals %j', async (data, failureCode) => {+ const h = harness();+ const settleLaneTurn = vi.fn(async () => true);+ (h.deps as unknown as { botGroupChatServiceHolder: unknown }).botGroupChatServiceHolder = { settleLaneTurn };+ h.deps.agentInputCoordinatorHolder.getActiveInputClientId.mockReturnValue('bot-group:g1:turn:bot-a');+ h.emit(event('error', { ...data, isTerminal: true }));+ await microtasks();+ expect(settleLaneTurn).toHaveBeenCalledWith(expect.objectContaining({+ sessionId: 'task', activeInputClientId: 'bot-group:g1:turn:bot-a', outcome: 'error', failureCode,+ }));+ await h.dispose();+ });+it('carries a pending follow-up into task settlement and remembers compact boundaries without rebuilding early', async () => {const h = harness();h.emit(event('compact_boundary'));diff --git a/apps/desktop/src/main/maker-ipc/botGroupChatService.ts b/apps/desktop/src/main/maker-ipc/botGroupChatService.tsindex 70896c636a..86b6e494fe 100644--- a/apps/desktop/src/main/maker-ipc/botGroupChatService.ts+++ b/apps/desktop/src/main/maker-ipc/botGroupChatService.ts@@ -24,6 +24,7 @@ import {type PlanDecisionMode,} from './botGroupDivision.js';import type { BotGroupWorkDir } from './botGroupWorkDir.js';+import { botGroupRuntimeFailureCode, botGroupRuntimeFailureDetail, readBotGroupRuntimeFailureDetail } from './botGroupRuntimeFailure.js';import {BOT_GROUP_ATTACHMENTS_MAX,BOT_GROUP_CLIENT_ID,@@ -53,6 +54,7 @@ import {type BotGroupMessageView,type BotGroupMutationResult,type BotGroupNoticeCode,+ type BotGroupRuntimeFailureCode,type BotGroupPlanAction,type BotGroupPlanStatus,type BotGroupPlanStepStatus,@@ -98,6 +100,9 @@ export interface BotGroupLaneTerminal {outcome: 'done' | 'error';resultText: string;resultMessageClientId?: string | null;+ failureCode?: BotGroupRuntimeFailureCode;+ /** Delivery failed before an Agent turn existed; discard the hidden queued input. */+ undispatched?: boolean;}export interface BotGroupChatServiceDeps {@@ -213,9 +218,15 @@ type StepRow = typeof botGroupPlanSteps.$inferSelect;type TurnOutcome =| { kind: 'reply'; text: string }| { kind: 'silent' }- | { kind: 'failed'; notice: BotGroupNoticeCode }+ | { kind: 'failed'; notice: BotGroupNoticeCode; failureCode?: BotGroupRuntimeFailureCode }| { kind: 'cancelled' };+function unavailableLaneOutcome(errorCode: string): Extract<TurnOutcome, { kind: 'failed' }> {+ const failureCode = botGroupRuntimeFailureCode({ code: errorCode });+ // Keep the existing unavailable-member notice when preparation has no specific recovery category.+ return { kind: 'failed', notice: 'member-unavailable', ...(failureCode !== 'RUNTIME_ERROR' ? { failureCode } : {}) };+}+interface LaneWaiter {groupId: string;clientId: string;@@ -600,9 +611,10 @@ export function createBotGroupChatService(deps: BotGroupChatServiceDeps) {authorKind: row.authorKind,authorBotId: row.authorBotId,authorName: row.authorName,- content: row.content,+ content: row.kind === 'notice' && readBotGroupRuntimeFailureDetail(row.content) ? '' : row.content,mentions: parseMentions(row.mentionsJson),noticeCode: (row.noticeCode as BotGroupNoticeCode | null) ?? null,+ ...(row.kind === 'notice' ? { runtimeFailureCode: readBotGroupRuntimeFailureDetail(row.content) } : {}),planId: row.planId ?? null,files: parseFiles(row.filesJson),attachments: parseAttachments(row.attachmentsJson),@@ -817,9 +829,10 @@ export function createBotGroupChatService(deps: BotGroupChatServiceDeps) {createdAt: now(),});- const postNotice = async (groupId: string, member: MemberRow, notice: BotGroupNoticeCode, scope?: DataOwnerBroadcastScope) => {+ const postNotice = async (groupId: string, member: MemberRow, notice: BotGroupNoticeCode, scope?: DataOwnerBroadcastScope, failureCode?: BotGroupRuntimeFailureCode) => {if (!scopeIsCurrent(scope)) return;- await appendMessage({ groupId, kind: 'notice', authorKind: 'system', authorBotId: member.botId, authorName: member.name, noticeCode: notice });+ await appendMessage({ groupId, kind: 'notice', authorKind: 'system', authorBotId: member.botId, authorName: member.name, noticeCode: notice,+ ...(failureCode ? { content: botGroupRuntimeFailureDetail(failureCode) } : {}) });emit(groupId, 'messages', scope);};@@ -865,7 +878,7 @@ export function createBotGroupChatService(deps: BotGroupChatServiceDeps) {if (waiters.get(sessionId) === waiter) waiters.delete(sessionId);interruptedLanes.add(sessionId);void deps.abortLane(sessionId).catch(() => undefined);- resolve({ kind: 'failed', notice: 'member-timeout' });+ resolve({ kind: 'failed', notice: 'member-timeout', failureCode: 'RUNTIME_TIMEOUT' });}, timeoutMs);};arm();@@ -885,7 +898,7 @@ export function createBotGroupChatService(deps: BotGroupChatServiceDeps) {): Promise<TurnOutcome> => {const lane = await deps.ensureLane({ botId: member.botId, groupId: group.id, title: group.name });if (round.cancelled || !scopeIsCurrent(scope)) return { kind: 'cancelled' };- if (!lane.ok) return { kind: 'failed', notice: 'member-unavailable' };+ if (!lane.ok) return unavailableLaneOutcome(lane.errorCode);// A lane must never act on a stale, looser permission profile than its Bot now has.try {await deps.syncLanePermission?.(lane.sessionId, member.botId);@@ -1014,7 +1027,8 @@ export function createBotGroupChatService(deps: BotGroupChatServiceDeps) {if (waiters.get(turn.sessionId) === waiter) waiters.delete(turn.sessionId);deps.log?.warn('Bot group turn was not accepted', { groupId: turn.groupId, errorCode: dispatched.errorCode });if (turn.isCancelled()) return { kind: 'cancelled' };- return { kind: 'failed', notice: dispatched.errorCode === 'BOT_GROUP_WORKDIR_UNAVAILABLE' ? 'workdir-unavailable' : 'member-failed' };+ return { kind: 'failed', notice: dispatched.errorCode === 'BOT_GROUP_WORKDIR_UNAVAILABLE' ? 'workdir-unavailable' : 'member-failed',+ ...(dispatched.errorCode !== 'BOT_GROUP_WORKDIR_UNAVAILABLE' ? { failureCode: botGroupRuntimeFailureCode({ code: dispatched.errorCode, message: dispatched.message }) } : {}) };}await turn.afterDispatch?.().catch(() => undefined);if (turn.isCancelled()) {@@ -1069,7 +1083,7 @@ export function createBotGroupChatService(deps: BotGroupChatServiceDeps) {emit(input.groupId, 'messages', input.scope);} else if (outcome.kind === 'failed') {round.dropped.add(botId);- await postNotice(input.groupId, member, outcome.notice, input.scope);+ await postNotice(input.groupId, member, outcome.notice, input.scope, outcome.failureCode);}emit(input.groupId, 'round', input.scope);return spoke;@@ -1360,7 +1374,7 @@ export function createBotGroupChatService(deps: BotGroupChatServiceDeps) {let inFlight: StepNote[] = initialNotes?.notes ?? [];const live = () => !active.cancelled && !disposed && scopeIsCurrent(scope) && runtime.step === active;- const settle = async (outcome: { kind: 'done'; text: string; files: string[] } | { kind: 'failed'; notice: BotGroupNoticeCode }) => {+ const settle = async (outcome: { kind: 'done'; text: string; files: string[] } | { kind: 'failed'; notice: BotGroupNoticeCode; failureCode?: BotGroupRuntimeFailureCode }) => {if (!live()) return;if (outcome.kind === 'failed') {const unused = [...inFlight, ...active.notes.splice(0)];@@ -1397,6 +1411,7 @@ export function createBotGroupChatService(deps: BotGroupChatServiceDeps) {authorBotId: step.botId,authorName,noticeCode: outcome.notice,+ ...(outcome.failureCode ? { content: botGroupRuntimeFailureDetail(outcome.failureCode) } : {}),planId,}),endMessage: done && isLast ? messageRow({ groupId, kind: 'plan-end', authorKind: 'system', planId }) : null,@@ -1460,7 +1475,7 @@ export function createBotGroupChatService(deps: BotGroupChatServiceDeps) {plan: { planId, workDir, sessionId: ownerSessionId },});if (!live()) return;- if (!lane.ok) return await settle({ kind: 'failed', notice: 'member-unavailable' });+ if (!lane.ok) return await settle(unavailableLaneOutcome(lane.errorCode));active.sessionId = lane.sessionId;emit(groupId, 'round', scope);try {@@ -1495,7 +1510,7 @@ export function createBotGroupChatService(deps: BotGroupChatServiceDeps) {isCancelled: () => !live(),});if (!live() || outcome.kind === 'cancelled') return;- if (outcome.kind === 'failed') return await settle({ kind: 'failed', notice: outcome.notice });+ if (outcome.kind === 'failed') return await settle({ kind: 'failed', notice: outcome.notice, failureCode: outcome.failureCode });text = outcome.kind === 'reply' ? outcome.text : '';if (active.notes.length === 0) {files = deps.workDir ? await deps.workDir.changedFiles(workDir, before).catch(() => []) : [];@@ -1677,7 +1692,8 @@ export function createBotGroupChatService(deps: BotGroupChatServiceDeps) {}waiters.delete(terminal.sessionId);if (terminal.outcome === 'error') {- waiter.settle({ kind: 'failed', notice: 'member-failed' });+ if (terminal.undispatched) await deps.abortLane(terminal.sessionId).catch(() => undefined);+ waiter.settle({ kind: 'failed', notice: 'member-failed', failureCode: terminal.failureCode ?? 'RUNTIME_ERROR' });return true;}let text = terminal.resultText;diff --git a/apps/desktop/src/main/maker-ipc/botGroupRemoteResourceProvider.ts b/apps/desktop/src/main/maker-ipc/botGroupRemoteResourceProvider.tsindex 6cbf9d43d7..4e5e9a347a 100644--- a/apps/desktop/src/main/maker-ipc/botGroupRemoteResourceProvider.ts+++ b/apps/desktop/src/main/maker-ipc/botGroupRemoteResourceProvider.ts@@ -46,6 +46,7 @@ import {type BotGroupSummary,} from '../../shared/botGroupChat.js';import type { BotGroupChatService } from './botGroupChatService.js';+import { projectBotGroupExecutionFailures } from '@cindy/maker-shared/botGroupPresentation';const FALLBACK_MESSAGES = 20;const FALLBACK_MESSAGE_CHARS = 280;@@ -184,7 +185,8 @@ export function botGroupRemoteChatData(detail: BotGroupDetail): BotGroupRemoteChprojectDir: null,projectDirName: detail.projectDir ? path.basename(detail.projectDir) : null,plans: detail.plans.map((plan) => ({ ...plan, workDir: null })),- messages: detail.messages.map((message) => (message.attachments.length > 0+ // Older phones consume message views only; derive from this read's state here.+ messages: projectBotGroupExecutionFailures(detail.messages, detail.executionFailures).map((message) => (message.attachments.length > 0? { ...message, attachments: message.attachments.map((attachment) => ({ ...attachment, path: null })) }: message)),supportsAttachments: true,diff --git a/apps/desktop/src/main/maker-ipc/botGroupRuntimeFailure.ts b/apps/desktop/src/main/maker-ipc/botGroupRuntimeFailure.tsnew file mode 100644index 0000000000..fc278a0020--- /dev/null+++ b/apps/desktop/src/main/maker-ipc/botGroupRuntimeFailure.ts@@ -0,0 +1,54 @@+import { isBotGroupRuntimeFailureCode, type BotGroupRuntimeFailureCode } from '../../shared/botGroupChat.js';+import { isPiImageInputUnsupportedError, isPiPromptRpcTimeoutError } from '../../shared/inputError.js';+import { extractNonSecretErrorSignals, matchesDeterministicUsageExhaustionText } from '@cindy/maker-shared/error-redaction';+import type { BotGroupChatService } from './botGroupChatService.js';+import { parseOverloadError, UPSTREAM_OVERLOAD_REASON } from '@cindy/maker-core';++export { BOT_GROUP_RUNTIME_FAILURE_PREFIX, botGroupRuntimeFailureDetail, readBotGroupRuntimeFailureDetail } from '../../shared/botGroupChat.js';++/** Classify on the executor. Only the fixed category is visible to other group members. */+export function botGroupRuntimeFailureCode(error: unknown): BotGroupRuntimeFailureCode {+ if (isPiImageInputUnsupportedError(error)) return 'IMAGE_INPUT_UNSUPPORTED';+ const data = error && typeof error === 'object' ? error as {+ code?: unknown; reason?: unknown; message?: unknown; sdkError?: unknown;+ errorStatus?: unknown; usageLimit?: unknown; modelAccessDenied?: unknown; codexErrorInfo?: unknown;+ } : null;+ const values = [data?.code, data?.reason, data?.sdkError, data?.message, error instanceof Error ? error.message : error];+ for (const value of values) {+ if (typeof value === 'string' && isPiImageInputUnsupportedError(value)) return 'IMAGE_INPUT_UNSUPPORTED';+ if (isBotGroupRuntimeFailureCode(value)) return value;+ }+ // Codex translators publish the stable tag even when message text is redacted.+ if (data?.codexErrorInfo === 'usageLimitExceeded' || data?.codexErrorInfo === 'sessionBudgetExceeded') return 'QUOTA_EXCEEDED';+ if (data?.codexErrorInfo === 'unauthorized') return 'AUTH_REQUIRED';+ if (data?.reason === 'pi-prompt-timeout' || isPiPromptRpcTimeoutError(data ?? { message: error })+ || (typeof data?.reason === 'string' && /^(?:bridge_)?(?:turn_no_event_timeout|upstream_response_idle_timeout)$/.test(data.reason))) return 'RUNTIME_TIMEOUT';+ const text = values.filter((value): value is string => typeof value === 'string').join('\n');+ const status = typeof data?.errorStatus === 'number' ? data.errorStatus : extractNonSecretErrorSignals(text).errorStatus;+ if (data?.modelAccessDenied === true || /\b(?:NO_MODEL|MODEL_NOT_FOUND|MODEL_UNAVAILABLE|NO_AVAILABLE_MODEL|BOT_MODEL_REQUIRED|MODEL_REQUIRED|user_model_access_denied)\b/i.test(text)) return 'MODEL_UNAVAILABLE';+ if (status === 401 || status === 403 || /\b(?:AUTH_REQUIRED|INVALID_TOKEN|TOKEN_EXPIRED|UNAUTHORIZED|invalid_api_key|authentication_error|authentication_failed|provider_auth_or_access)\b/i.test(text)) return 'AUTH_REQUIRED';+ if (data?.reason === UPSTREAM_OVERLOAD_REASON+ || parseOverloadError(text, status, typeof data?.codexErrorInfo === 'string' ? data.codexErrorInfo : undefined)) return 'UPSTREAM_OVERLOADED';+ if (status === 402 || matchesDeterministicUsageExhaustionText(text) || /\b(?:QUOTA_EXCEEDED|USAGE_LIMIT_EXCEEDED|INSUFFICIENT_BALANCE|insufficient_quota|billing_error|provider_quota_limit|usageLimitExceeded|sessionBudgetExceeded)\b/i.test(text)) return 'QUOTA_EXCEEDED';+ // usageLimit also accompanies temporary rate limits; an explicit rate signal wins.+ if (/\b(?:RATE_LIMITED|RATE_LIMIT_EXCEEDED|rate_limit_error|rate_limit|provider_rate_limit)\b|rate limit(?:ed|ing)?|too many requests/i.test(text)) return 'RATE_LIMITED';+ if (data?.usageLimit === true) return 'QUOTA_EXCEEDED';+ if (status === 429) return 'RATE_LIMITED';+ if (data?.codexErrorInfo === 'httpConnectionFailed' || data?.codexErrorInfo === 'responseStreamConnectionFailed'+ || data?.codexErrorInfo === 'responseStreamDisconnected') return 'NETWORK_ERROR';+ if (/\b(?:ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|REQUEST_TIMEOUT)\b|fetch failed|socket hang up/i.test(text)) return 'NETWORK_ERROR';+ return 'RUNTIME_ERROR';+}++/** A persisted input can fail without producing any Agent terminal event. */+export async function settleUndispatchedBotGroupTurn(+ service: Pick<BotGroupChatService, 'settleLaneTurn'> | null,+ sessionId: string,+ clientId: string,+ disposition: 'failed' | 'cancelled',+ error: unknown,+): Promise<boolean> {+ if (disposition !== 'failed' || !service) return false;+ return service.settleLaneTurn({ sessionId, activeInputClientId: clientId, outcome: 'error',+ resultText: '', failureCode: botGroupRuntimeFailureCode(error), undispatched: true });+}diff --git a/apps/desktop/src/main/maker-ipc/chatServer.ts b/apps/desktop/src/main/maker-ipc/chatServer.tsindex e823930047..cbcae495f6 100644--- a/apps/desktop/src/main/maker-ipc/chatServer.ts+++ b/apps/desktop/src/main/maker-ipc/chatServer.ts@@ -27,10 +27,15 @@ import { UI_ACTION_TRIGGER_PREFIX } from '../../shared/interruptedTurn.js';import { untrustedJsonBlock } from '../../shared/untrustedPrompt.js';import {BOT_GROUP_CLIENT_ID, isBotGroupNoReplyText,+ isBotGroupRuntimeFailureCode, type BotGroupRuntimeFailureCode,+ readImportedBotGroupRuntimeFailureCode,+ readBotGroupExecutionFailure, type BotGroupExecutionFailureView,type BotGroupDetail, type BotGroupPlanView, type BotGroupFailure, type BotGroupMessageView, type BotGroupAttachment, type ChatServerApi,} from '../../shared/botGroupChat.js';import type { BotGroupChatService, BotGroupChatServiceDeps, BotGroupLaneTerminal } from './botGroupChatService.js';import { readPersistedReplyText } from './botGroupChatService.js';+import { botGroupRuntimeFailureCode, botGroupRuntimeFailureDetail } from './botGroupRuntimeFailure.js';+import { botGroupExecutionFailureBatches } from '@cindy/maker-shared/botGroupPresentation';interface Actor { id: string; kind: string; externalId: string; name: string; avatar?: string | null; avatarSource?: string | null }interface Member { id: string; kind: 'human' | 'bot' | 'integration'; name: string; state: string; role: 'owner' | 'admin' | 'member' | 'guest';@@ -49,6 +54,7 @@ interface Snapshot { room: Room; members: Member[]; messages: Message[]; cursor:interface Execution {id: string; conversation_id: string; source_message_id: string; bot_id: string;requester_id?: string;+ failure_code?: unknown; updated_at?: string;plan_id?: string | null; plan_step?: number | null;trigger?: unknown; trigger_type?: string | null;context_seq: string; attachment_after_seq?: string; epoch: number; status: string; access_mode: 'owner' | 'chat' | 'tools'; access_revision: number;@@ -85,7 +91,7 @@ const memberJoinedTrigger = z.object({ type: z.literal('member.joined'), messagetype ExecutionContext = { kind: 'message' } | { kind: 'member.joined'; trigger: z.infer<typeof memberJoinedTrigger> };const ordinaryExecution = (execution: Execution) => execution.trigger === undefined && execution.trigger_type == null;const groupInput = z.object({ name: z.string().trim().min(1).max(40), botIds: z.array(z.string().min(1)).max(6) });-const bodyText = (m: Message) => m.deleted ? '(消息已删除)' : m.content.filter(b => b.namespace !== 'cindy.local-history' || b.data?.activity === true).map(b => b.text ?? b.fallback ?? (b.type === 'media' ? `[附件: ${b.caption ?? '文件'}]` : '')).join('\n');+const bodyText = (m: Message) => m.deleted ? '(消息已删除)' : readImportedBotGroupRuntimeFailureCode(m) ? '' : m.content.filter(b => b.namespace !== 'cindy.local-history' || b.data?.activity === true).map(b => b.text ?? b.fallback ?? (b.type === 'media' ? `[附件: ${b.caption ?? '文件'}]` : '')).join('\n');// Presentation only: keep actor IDs and stored names independent of ownership labels.const memberName = (m: Member) => m.kind === 'bot' && m.ownerName.trim() ? `${m.name} (${m.ownerName.trim()})` : m.name;@@ -496,7 +502,13 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDconst member = members.find(member => member.id === m.authorId);const planCard = m.content.find(b => b.namespace === 'cindy.plan');const legacy = m.origin === 'import' ? m.content.find(b => b.namespace === 'cindy.local-history')?.data : undefined;- return { id: m.id, sequence: Number(m.seq), kind: planCard ? 'plan' : 'message', authorKind: legacy?.authorKind === 'system' ? 'system' : m.author.kind === 'human' ? 'user' : 'bot',+ const runtimeFailureCode = readImportedBotGroupRuntimeFailureCode(m);+ if (runtimeFailureCode) return { id: m.id, sequence: Number(m.seq), kind: 'notice', authorKind: 'system', isSelf: false,+ authorBotId: localBot(m.authorId)?.id ?? m.authorId, authorName: typeof legacy?.authorName === 'string' ? legacy.authorName : '',+ content: '', threadRootId: m.threadRootId, replyCount: 0, reactions: [], mentions: { all: false, botIds: [] },+ noticeCode: runtimeFailureCode === 'RUNTIME_TIMEOUT' ? 'member-timeout' : 'member-failed', runtimeFailureCode,+ planId: null, files: [], attachments: [], createdAt: Date.parse(m.createdAt) };+ return { id: m.id, sequence: Number(m.seq), deleted: m.deleted, kind: planCard ? 'plan' : 'message', authorKind: legacy?.authorKind === 'system' ? 'system' : m.author.kind === 'human' ? 'user' : 'bot',isSelf: m.authorId === selfId, threadRootId: m.threadRootId, replyCount: m.replyCount ?? 0, reactions: m.reactions ?? [],authorBotId: localBot(m.authorId)?.id ?? m.authorId, authorName: legacy?.authorKind === 'system' && typeof legacy.authorName === 'string' ? legacy.authorName : member ? memberName(member) : m.author.name, content: bodyText(m),mentions: { all: false, botIds: [] }, noticeCode: null, planId: typeof planCard?.data?.planId === 'string' ? planCard.data.planId : null, files: [], attachments: [], createdAt: Date.parse(m.createdAt) };@@ -527,11 +539,13 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD}async function detail(roomId: string, options?: unknown, summaryOnly = false): Promise<BotGroupDetail> {const s = await snapshot(roomId);- const o = z.object({ beforeSequence: z.number().int().positive().optional(), limit: z.number().int().min(1).max(100).optional() }).parse(options ?? {});+ const o = z.object({ beforeSequence: z.number().int().positive().optional(), limit: z.number().int().min(1).max(100).optional(),+ sourceMessageIds: z.array(id).optional() }).parse(options ?? {});const query = new URLSearchParams({ limit: String(o.limit ?? 100) });if (o.beforeSequence) query.set('before', String(o.beforeSequence));const page = summaryOnly ? s.messages : await api<Message[]>(`/conversations/${roomId}/messages?${query}`);const executions = await api<Execution[]>(`/conversations/${roomId}/executions`);+ const executionFailures = summaryOnly ? undefined : await failureSnapshot(roomId, s.members, [...(o.sourceMessageIds ?? []), ...page.map(m => m.id)], executions);const ids = page.flatMap(m => m.content.flatMap(b => b.namespace === 'cindy.plan' && typeof b.data?.planId === 'string' ? [id.parse(b.data.planId)] : []));const serverPlans = await api<ServerPlan[]>(`/conversations/${roomId}/plans${ids.length ? `?ids=${ids.join(',')}` : ''}`);const workspace = workspaces().read(roomId);@@ -559,7 +573,7 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDlastReplyAt: s.messages.reduce((latest, m) => !m.deleted && m.origin !== 'system' && m.authorId !== selfId? Math.max(latest, Date.parse(m.createdAt)) : latest, 0),createdAt: Date.parse(s.room.created_at), updatedAt: Date.parse(s.room.updated_at ?? s.room.created_at),- messages, hasMoreBefore: page.length === (o.limit ?? 100), plans,+ messages, executionFailures, hasMoreBefore: page.length === (o.limit ?? 100), plans,round: { status: executions.some(e => ['queued', 'running'].includes(e.status)) ? 'running' : 'idle', speakers, canContinue: !open && !planning.has(roomId) && (executions.some(e => !e.plan_id && ordinaryExecution(e)) || s.messages.some(m => !m.deleted && m.origin !== 'system' && m.author.kind === 'human' && !m.content.some(b => b.namespace === 'cindy.plan'))) && !executions.some(e => ['queued','running','stopping'].includes(e.status)) } };}function planView(plan: ServerPlan, members: Member[], workspace: ReturnType<ReturnType<typeof chatServerWorkspaces>['read']>): BotGroupPlanView {@@ -625,6 +639,47 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDexecutorId, epoch: run.execution.epoch, action, ...extra,}, run.execution.bot_id);}+ // Compatibility cache for servers which do not yet return failure_code.+ // The server execution status still owns whether a notice is displayed.+ const failureCodes = new Map<string, BotGroupRuntimeFailureCode>();+ async function failureSnapshot(roomId: string, members: Member[], sourceIds: string[], recent?: Execution[]): Promise<BotGroupExecutionFailureView[]> {+ const sources = new Set(sourceIds);+ let rows: unknown[] = [];+ try {+ for (const batch of botGroupExecutionFailureBatches(sourceIds)) {+ const page = await api<unknown[]>(`/conversations/${roomId}/execution-failures?sourceIds=${batch.join(',')}`);+ if (!Array.isArray(page)) throw new Error('INVALID_CHAT_RESPONSE');+ rows.push(...page);+ }+ }+ catch (error) {+ // Only a missing route may use the old server's bounded execution list.+ // Permission and network failures must go through normal read recovery.+ if (!(error instanceof ChatResponseError) || error.status !== 404) throw error;+ rows = recent ?? await api<Execution[]>(`/conversations/${roomId}/executions`);+ }+ if (!Array.isArray(rows)) throw new Error('INVALID_CHAT_RESPONSE');+ return rows.flatMap(row => {+ const failure = readBotGroupExecutionFailure(row, roomId);+ if (!failure || !sources.has(failure.sourceMessageId)) return [];+ const member = members.find(value => value.id === failure.botId);+ const cachedCode = failureCodes.get(`${failure.executionId}:${failure.epoch}`);+ return [{ ...failure, botId: localBot(failure.botId)?.id ?? failure.botId,+ botName: member ? memberName(member) : actors.find(actor => actor.id === failure.botId)?.name ?? '',+ code: !isBotGroupRuntimeFailureCode((row as Record<string, unknown>).failure_code) && cachedCode ? cachedCode : failure.code }];+ });+ }+ /** One execution gets one immutable terminal result, regardless of which boundary ends it. */+ async function settleExecution(run: Running, terminal: BotGroupLaneTerminal, abort = false): Promise<void> {+ if (!current() || running.get(run.execution.bot_id) !== run) return;+ if (!run.settlement) {+ run.settlement = { terminal: { ...terminal }, retryAt: 0 };+ run.releaseToolAuthority?.();+ // Retries and late SDK events must not abort the lane again or change its result.+ if (abort && run.sessionId) await deps.abortLane(run.sessionId).catch(() => undefined);+ }+ await deliverSettlement(run);+ }function deliverSettlement(run: Running): Promise<void> {if (run.delivery) return run.delivery;const pending = run.settlement;@@ -646,7 +701,11 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD}}const files = await media.upload(run.execution.conversation_id, `step:${run.execution.id}:${run.execution.epoch}`, produced, run.execution.bot_id);- pending.payload = terminal.outcome === 'error' ? { detail: 'Local Agent failed' }+ if (terminal.outcome === 'error') {+ failureCodes.set(`${run.execution.id}:${run.execution.epoch}`, terminal.failureCode ?? 'RUNTIME_ERROR');+ if (failureCodes.size > 1000) failureCodes.delete(failureCodes.keys().next().value!);+ }+ pending.payload = terminal.outcome === 'error' ? { detail: botGroupRuntimeFailureDetail(terminal.failureCode ?? 'RUNTIME_ERROR') }: { ...(isBotGroupNoReplyText(text) && !files.length ? {} : { content: [{ type: 'text', text: text.slice(0, 16000) || '已完成' }, ...files] }), continueDiscussion: run.context?.kind !== 'member.joined' && !run.plan && !isBotGroupNoReplyText(text) };}if (!current() || running.get(run.execution.bot_id) !== run) return;@@ -841,14 +900,11 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDif (!current() || running.get(execution.bot_id) !== run) { await deps.abortLane(lane.sessionId); throw new Error('STALE_EXECUTOR'); }run.accepted = true;} });- if (!dispatched.ok) throw new Error(dispatched.errorCode);+ if (!dispatched.ok) throw new Error(botGroupRuntimeFailureCode({ code: dispatched.errorCode, message: dispatched.message }));changed(s.room.id);- } catch {- run.releaseToolAuthority?.();- if (run.sessionId) await deps.abortLane(run.sessionId).catch(() => undefined);- if (running.get(execution.bot_id) === run) running.delete(execution.bot_id);- await updateExecution(run, 'fail', { detail: 'Local runtime could not start' }).catch(() => undefined);- changed(execution.conversation_id);+ } catch (error) {+ await settleExecution(run, { sessionId: run.sessionId, activeInputClientId: run.clientId,+ outcome: 'error', resultText: '', failureCode: botGroupRuntimeFailureCode(error) }, true);}}let polling = false;@@ -912,8 +968,10 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDif (paused) run.pauseStarted ??= Date.now();else if (run.pauseStarted !== undefined) { run.started += Date.now() - run.pauseStarted; run.pauseStarted = undefined; }const timedOut = !paused && Date.now() - run.started > (run.plan ? 2 * 60 * 60 * 1000 : 300000);- await updateExecution(run, timedOut ? 'fail' : 'heartbeat', timedOut ? { detail: 'Runtime timeout' } : {});- if (timedOut) throw new Error('TIMEOUT');+ if (timedOut) {+ await settleExecution(run, { sessionId: run.sessionId, activeInputClientId: run.clientId,+ outcome: 'error', resultText: '', failureCode: 'RUNTIME_TIMEOUT' }, true);+ } else await updateExecution(run, 'heartbeat');} catch {// An in-flight heartbeat must not discard a result that became ready while// it was awaiting its response; retry the terminal operation for its receipt.@@ -992,12 +1050,14 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD}),status: async () => ({ enabled: true, connected: current() && connected }),thread: input => result(async () => {- const i = z.object({ groupId: id, rootId: id, before: z.number().int().positive().optional() }).parse(input);+ const i = z.object({ groupId: id, rootId: id, before: z.number().int().positive().optional(), sourceMessageIds: z.array(id).optional() }).parse(input);i.groupId = await resolveGroup(i.groupId); subscribe(i.groupId);const members = await api<Member[]>(`/conversations/${i.groupId}/members`);const root = await api<Message>(`/conversations/${i.groupId}/messages/${i.rootId}`);const page = await api<Message[]>(`/conversations/${i.groupId}/messages?threadRootId=${i.rootId}&limit=50${i.before ? `&before=${i.before}` : ''}`);- return { root: (await messageViews(i.groupId, [root], members))[0], replies: await messageViews(i.groupId, page.reverse(), members), hasMore: page.length === 50 };+ const executionFailures = await failureSnapshot(i.groupId, members, [...(i.sourceMessageIds ?? []), root.id, ...page.map(m => m.id)]);+ return { root: (await messageViews(i.groupId, [root], members))[0], executionFailures,+ replies: await messageViews(i.groupId, page.reverse(), members), hasMore: page.length === 50 };}),reply: input => result(async () => {const i = z.object({ groupId: id, rootId: id, text: z.string().trim().min(1).max(8000), clientId: operationId,@@ -1165,8 +1225,7 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDconst run = [...running.values()].find(r => r.sessionId === terminal.sessionId);if (!run) return local.settleLaneTurn(terminal);if (terminal.activeInputClientId ? terminal.activeInputClientId !== run.clientId : !run.accepted) return false;- run.settlement ??= { terminal: { ...terminal }, retryAt: 0 };- await deliverSettlement(run);+ await settleExecution(run, terminal, terminal.undispatched);return true;},setMembers: input => safe(async () => {diff --git a/apps/desktop/src/main/maker-ipc/chatServerMigration.ts b/apps/desktop/src/main/maker-ipc/chatServerMigration.tsindex d4d743652f..0f04b45628 100644--- a/apps/desktop/src/main/maker-ipc/chatServerMigration.ts+++ b/apps/desktop/src/main/maker-ipc/chatServerMigration.ts@@ -1,6 +1,7 @@/** Restartable upgrade of account-local history into the one server timeline. */import { randomUUID } from 'node:crypto';import type { BotGroupAttachment, BotGroupMessageView, BotGroupSummary, BotGroupPlanView } from '../../shared/botGroupChat.js';+import { isBotGroupRuntimeFailureCode, readBotGroupRuntimeFailureDetail } from '../../shared/botGroupChat.js';export type ChatApi = <T>(route: string, method?: string, data?: unknown, actorId?: string) => Promise<T>;export interface ChatContentBlock { type: string; text?: string; mediaId?: string; caption?: string; namespace?: string; schemaRevision?: number; fallback?: string; data?: Record<string, unknown> }@@ -72,6 +73,10 @@ export async function migrateLocalGroups(deps: LocalChatUpgrade): Promise<Map<st};for (const message of page) {check();+ const runtimeFailureCode = message.kind === 'notice' && message.authorKind === 'system'+ ? isBotGroupRuntimeFailureCode(message.runtimeFailureCode) ? message.runtimeFailureCode : readBotGroupRuntimeFailureDetail(message.content)+ : undefined;+ const portableContent = runtimeFailureCode ? '' : message.content;const authorId = message.authorKind === 'bot' && message.authorBotId? await deps.bot(message.authorBotId, message.authorName) : deps.selfId;if (authorId !== deps.selfId && !members.has(authorId)) {@@ -90,9 +95,9 @@ export async function migrateLocalGroups(deps: LocalChatUpgrade): Promise<Map<st: '';const fallback = [activity, message.files.length ? message.files.join('\n') : ''].filter(Boolean).join('\n');const texts: string[] = [];- if (message.content.length <= 32000 && Buffer.byteLength(message.content) < 48000) texts.push(message.content);+ if (portableContent.length <= 32000 && Buffer.byteLength(portableContent) < 48000) texts.push(portableContent);else {- const points = Array.from(message.content);+ const points = Array.from(portableContent);for (let i = 0; i < points.length; i += 6000) texts.push(points.slice(i, i + 6000).join(''));}for (const [part, text] of texts.entries()) {@@ -101,9 +106,10 @@ export async function migrateLocalGroups(deps: LocalChatUpgrade): Promise<Map<stif (last) content.push(...media);// Preserve notice/plan kinds and author snapshots without uploading private host paths.content.push({ type: 'card', namespace: 'cindy.local-history', schemaRevision: 1,- fallback: last && fallback ? fallback : message.kind === 'message' ? '历史消息' : message.content.slice(0, 1000) || '群活动',+ fallback: last && fallback ? fallback : message.kind === 'message' ? '历史消息' : portableContent.slice(0, 1000) || '群活动',data: { kind: message.kind, authorKind: message.authorKind, authorName: message.authorName,noticeCode: message.noticeCode, files: message.files, planId: message.planId,+ ...(runtimeFailureCode ? { runtimeFailureCode } : {}),...(last && plan ? { plan } : {}), ...(last && fallback ? { activity: true } : {}) } });// Refuse rather than truncate a record outside the server's wire budget.if (content.length > 32 || Buffer.byteLength(JSON.stringify(content)) > 65536) throw new Error('IMPORT_MESSAGE_TOO_LARGE');diff --git a/apps/desktop/src/main/maker-ipc/contextOverflowRollover.ts b/apps/desktop/src/main/maker-ipc/contextOverflowRollover.tsindex 9f54b7ac47..11444386e0 100644--- a/apps/desktop/src/main/maker-ipc/contextOverflowRollover.ts+++ b/apps/desktop/src/main/maker-ipc/contextOverflowRollover.ts@@ -33,6 +33,8 @@ import {import { readMessageSourceDevice } from '@cindy/maker-shared/message-source';import { buildClientEnvironmentNote } from './mobileClientPromptNote.js';import { buildWireMessageSourceNote } from './messageSourceNote.js';+import { isPiPromptRpcTimeoutError } from '../../shared/inputError.js';+export { isPiPromptRpcTimeoutError } from '../../shared/inputError.js';const SYNTHETIC_TRIGGER_PREFIX = '[UI_ACTION_TRIGGER]';@@ -86,16 +88,6 @@ export interface NativeSessionRecoveryTarget {fastMode: boolean;}-const PI_PROMPT_RPC_TIMEOUT_RE = /pi rpc timeout after \d+ms: prompt\b/i;--export function isPiPromptRpcTimeoutError(data: unknown): boolean {- if (!data || typeof data !== 'object') return false;- const rec = data as { message?: unknown; sdkError?: unknown };- return [rec.message, rec.sdkError].some(- (value) => typeof value === 'string' && PI_PROMPT_RPC_TIMEOUT_RE.test(value),- );-}-function isPiRequestBodyRecoveryExhausted(data: unknown): boolean {if (!data || typeof data !== 'object') return false;const rec = data as { message?: unknown; sdkError?: unknown };diff --git a/apps/desktop/src/main/maker-ipc/register.ts b/apps/desktop/src/main/maker-ipc/register.tsindex 52b8c9b749..97065220ad 100644--- a/apps/desktop/src/main/maker-ipc/register.ts+++ b/apps/desktop/src/main/maker-ipc/register.ts@@ -524,6 +524,7 @@ import {type BotDirectMessageService,} from './botDirectMessageService.js';import { createBotGroupChatService, type BotGroupChatService, type BotGroupChatServiceDeps } from './botGroupChatService.js';+import { settleUndispatchedBotGroupTurn } from './botGroupRuntimeFailure.js';import { withChatServer } from './chatServer.js';import { createBotGroupPlanDecider } from './botGroupPlanDecider.js';import { botGroupMembersVisibleRemotely, registerBotGroupRemoteResourceProvider } from './botGroupRemoteResourceProvider.js';@@ -16780,6 +16781,10 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions)publishUiSessionIntervention(sessionId);},onRejectedUserTurn: (sessionId, item) => {+ void settleUndispatchedBotGroupTurn(botGroupChatServiceHolder, sessionId, item.clientId,+ 'failed', inputCoordinator.getProjection(sessionId).error).catch(() => {+ log.warn('Bot group undispatched input settlement failed', { sessionId });+ });notePluginTaskLifecycle(service => service.discard(sessionId, item, 'failed'));welcomeDispatchReceipts.settle(sessionId, item.clientId, false);rollbackAgentIslandUserPrompt(sessionId, item.clientId, 'rejected');diff --git a/apps/desktop/src/main/maker-ipc/sessionEventTerminal.ts b/apps/desktop/src/main/maker-ipc/sessionEventTerminal.tsindex c3d2c1a4b8..edca4e3966 100644--- a/apps/desktop/src/main/maker-ipc/sessionEventTerminal.ts+++ b/apps/desktop/src/main/maker-ipc/sessionEventTerminal.ts@@ -40,6 +40,7 @@ import {isOversizedHistoryErrorData,} from './contextOverflowRollover.js';import { isTerminalTurnErrorEvent } from './sessionTurnActivityTracker.js';+import { botGroupRuntimeFailureCode } from './botGroupRuntimeFailure.js';import { ProductTurnUsageTargetTracker } from './turnWallClock.js';import { createWorkerTurnStartSequencer } from './workerTurnStartSequencer.js';import { AutoResumeBookkeeping, shouldSkipOrcaWorkerTerminal } from './autoResumeBookkeeping.js';@@ -608,6 +609,7 @@ export function finishSessionTerminalEvent(outcome: isTerminalTurnErrorEvent(event) ? 'error' : 'done',resultText: typeof groupDoneData?.result === 'string' ? groupDoneData.result : '',resultMessageClientId: turnAssistantPersistId,+ ...(isTerminalTurnErrorEvent(event) ? { failureCode: botGroupRuntimeFailureCode(event.data) } : {}),}).catch((error) => {deps.log.warn('Bot group lane terminal settlement failed', {diff --git a/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx b/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsxindex da9de8d4c1..3343dc4709 100644--- a/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx+++ b/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx@@ -67,6 +67,8 @@ import { BotGroupComposer } from './BotGroupComposer';import { ChatInviteButton, ChatMessageActions } from './ChatServerControls';import { ChatThreadPanel } from './ChatThreadPanel';import { BotGroupPendingInteraction } from './BotGroupPendingInteraction';+import { BotGroupRuntimeFailureNotice } from './BotGroupRuntimeFailureNotice';+import { isBotGroupRuntimeFailureCode } from '../../../shared/botGroupChat';import {BotGroupHandoffFiles,BotGroupOrganizerTag,@@ -86,6 +88,7 @@ import {botGroupPlanFollowUp,continuableRoundEndId,mergeBotGroupMessages,+ projectBotGroupExecutionFailures,mergeBotGroupPlans,openBotGroupPlan,} from './botGroupPresentation';@@ -152,12 +155,13 @@ function BotGroupChatContent({ groupId }: { groupId: string }) {const navigate = useNavigate();const location = useLocation();const [state, setState] = useState<GroupViewState>({ kind: 'loading' });+ const stateRef = useRef(state); stateRef.current = state;const [reloadVersion, setReloadVersion] = useState(0);const [loadingOlder, setLoadingOlder] = useState(false);const [continuing, setContinuing] = useState(false);const [planPending, setPlanPending] = useState<PlanPending | null>(null);const planPendingRef = useRef(false);- const loadRef = useRef<() => void>(() => {});+ const loadRef = useRef<(additionalSources?: string[]) => void>(() => {});const scrollRef = useRef<HTMLDivElement>(null);const contentRef = useRef<HTMLDivElement>(null);const stickToBottomRef = useRef(true);@@ -171,7 +175,7 @@ function BotGroupChatContent({ groupId }: { groupId: string }) {useEffect(() => {let cancelled = false;let requestVersion = 0;- const load = async () => {+ const load = async (additionalSources: string[] = []) => {const version = ++requestVersion;const owner = getDataOwnerGeneration();const api = botGroupApi();@@ -182,7 +186,10 @@ function BotGroupChatContent({ groupId }: { groupId: string }) {return;}try {- const result = await api.getBotGroup(groupId);+ const displayed = stateRef.current;+ const sourceMessageIds = [...new Set([...(displayed.kind === 'ready' && displayed.group.id === groupId+ ? mergeBotGroupMessages(displayed.older, displayed.group.messages).map(message => message.id) : []), ...additionalSources])];+ const result = sourceMessageIds.length ? await api.getBotGroup(groupId, { sourceMessageIds }) : await api.getBotGroup(groupId);if (!isCurrent()) return;if (result.ok) {readOwner.current = owner;@@ -207,7 +214,7 @@ function BotGroupChatContent({ groupId }: { groupId: string }) {if (isCurrent()) setState((previous) => (previous.kind === 'ready' ? previous : { kind: 'error' }));}};- loadRef.current = () => void load();+ loadRef.current = additionalSources => void load(additionalSources);void load();const unsubscribe =botGroupApi()?.onBotGroupChanged?.((payload, ownerStamp) => {@@ -231,7 +238,7 @@ function BotGroupChatContent({ groupId }: { groupId: string }) {const group = state.kind === 'ready' ? state.group : null;const messages = useMemo(- () => (state.kind === 'ready' ? mergeBotGroupMessages(state.older, state.group.messages) : []),+ () => (state.kind === 'ready' ? projectBotGroupExecutionFailures(mergeBotGroupMessages(state.older, state.group.messages), state.group.executionFailures) : []),[state],);const acknowledge = useCallback(() => {@@ -339,7 +346,8 @@ function BotGroupChatContent({ groupId }: { groupId: string }) {const owner = getDataOwnerGeneration();setLoadingOlder(true);try {- const result = await api.getBotGroup(groupId, { beforeSequence: first.sequence });+ const sourceMessageIds = mergeBotGroupMessages(state.older, state.group.messages).map(message => message.id);+ const result = await api.getBotGroup(groupId, { beforeSequence: first.sequence, sourceMessageIds });if (!isDataOwnerGenerationCurrent(owner)) return;if (!result.ok) {toast.error(t('bots.groupChat.timeline.loadEarlierFailed'));@@ -347,16 +355,23 @@ function BotGroupChatContent({ groupId }: { groupId: string }) {}const element = scrollRef.current;if (element) prependAnchorRef.current = { height: element.scrollHeight, top: element.scrollTop };- setState((previous) =>- previous.kind === 'ready'- ? {- ...previous,- older: mergeBotGroupMessages(result.group.messages, previous.older),- olderPlans: mergeBotGroupPlans(result.group.plans, previous.olderPlans),- olderHasMore: result.group.hasMoreBefore,- }- : previous,- );+ const newerRefresh = stateRef.current.kind === 'ready' && stateRef.current.group !== state.group;+ setState((previous) => {+ if (previous.kind !== 'ready') return previous;+ // A newer push refresh wins over an older in-flight pagination request.+ const executionFailures = previous.group === state.group+ ? result.group.executionFailures ?? previous.group.executionFailures+ : previous.group.executionFailures;+ return {+ ...previous,+ group: { ...previous.group, executionFailures },+ older: mergeBotGroupMessages(previous.older, result.group.messages),+ olderPlans: mergeBotGroupPlans(result.group.plans, previous.olderPlans),+ olderHasMore: result.group.hasMoreBefore,+ };+ });+ // A push may have refreshed before these sources were displayed. Reconcile their current state too.+ if (newerRefresh) loadRef.current(result.group.messages.map(message => message.id));} catch {toast.error(t('bots.groupChat.timeline.loadEarlierFailed'));} finally {@@ -749,6 +764,9 @@ function BotGroupTimelineItem({}if (message.kind === 'notice' || message.authorKind === 'system') {const name = message.authorName.trim() || member?.name || '';+ if (isBotGroupRuntimeFailureCode(message.runtimeFailureCode)) {+ return <BotGroupRuntimeFailureNotice name={name} code={message.runtimeFailureCode} />;+ }const key = botGroupNoticeKey(message.noticeCode, message.planId !== null);const text = key ? t(key, { name }) : message.content;return <p className="text-center text-12 text-[var(--text-tertiary)]">{text}</p>;diff --git a/apps/desktop/src/renderer/features/bots/BotGroupRuntimeFailureNotice.tsx b/apps/desktop/src/renderer/features/bots/BotGroupRuntimeFailureNotice.tsxnew file mode 100644index 0000000000..d49b11e9ef--- /dev/null+++ b/apps/desktop/src/renderer/features/bots/BotGroupRuntimeFailureNotice.tsx@@ -0,0 +1,10 @@+import { useTranslation } from 'react-i18next';+import { isBotGroupRuntimeFailureCode } from '../../../shared/botGroupChat';++export function BotGroupRuntimeFailureNotice({ name, code }: { name: string; code: unknown }) {+ const { t } = useTranslation();+ if (!isBotGroupRuntimeFailureCode(code)) return null;+ return <p className="mx-auto max-w-[560px] whitespace-pre-line text-center text-13 leading-5 text-[var(--text-primary)]">+ {t(`bots.groupChat.notice.runtimeFailure.${code}`, { name })}+ </p>;+}diff --git a/apps/desktop/src/renderer/features/bots/ChatThreadPanel.tsx b/apps/desktop/src/renderer/features/bots/ChatThreadPanel.tsxindex 1cfe5286fc..a19e6a1ce9 100644--- a/apps/desktop/src/renderer/features/bots/ChatThreadPanel.tsx+++ b/apps/desktop/src/renderer/features/bots/ChatThreadPanel.tsx@@ -10,10 +10,13 @@ import { ShareMessageCheckbox } from '@/components/chat/ShareMessageCheckbox';import { shareSelectionStore, useShareSelectionActive } from '@/components/chat/shareSelectionStore';import { SHARE_SESSION_ATTR, SHARE_MESSAGE_ATTR } from '@/lib/shareConversationImage';import { getDataOwnerGeneration, isDataOwnerGenerationCurrent, isDataOwnerPushCurrent } from '@/contexts/dataOwnerGeneration';-import type { BotGroupDetail, BotGroupMention, BotGroupMessageView } from '../../../shared/botGroupChat';+import type { BotGroupDetail, BotGroupExecutionFailureView, BotGroupMention, BotGroupMessageView } from '../../../shared/botGroupChat';+import { isBotGroupRuntimeFailureCode } from '../../../shared/botGroupChat';import { resolveBotGroupMentions } from './botGroupMentions';import { refreshBotGroups } from './botGroupStore';+import { mergeBotGroupMessages, projectBotGroupExecutionFailures } from './botGroupPresentation';import { BotAvatar } from './BotAvatar';+import { BotGroupRuntimeFailureNotice } from './BotGroupRuntimeFailureNotice';import { ChatMessageActions, chatErrorKey } from './ChatServerControls';const key = (name: string) => `bots.groupChat.server.${name}`;const api = () => window.electronAPI.maker.chatServer;@@ -21,6 +24,7 @@ const iconClass = 'flex h-8 w-8 items-center justify-center rounded-full text-[vfunction ThreadMessage({ group, message, shareScope, sharing, onChanged }: { group: BotGroupDetail; message: BotGroupMessageView; shareScope: string; sharing: boolean; onChanged: () => void }) {const member = group.members.find(m => m.botId === message.authorBotId);+ if (message.kind === 'notice' && isBotGroupRuntimeFailureCode(message.runtimeFailureCode)) return <BotGroupRuntimeFailureNotice name={message.authorName || member?.name || ''} code={message.runtimeFailureCode} />;return <article {...{ [SHARE_SESSION_ATTR]: shareScope, [SHARE_MESSAGE_ATTR]: message.id }}className={`relative flex min-w-0 gap-2.5 ${sharing ? 'ml-10' : ''}`}>{sharing && <ShareMessageCheckbox clientId={message.id} />}@@ -45,6 +49,7 @@ export function ChatThreadPanel({ group, rootId, onClose }: { group: BotGroupDetreturn () => { if (shareSelectionStore.isActive(shareScope)) shareSelectionStore.exit(); };}, [shareScope]);const [root, setRoot] = useState<BotGroupMessageView | null>(null);+ const [executionFailures, setExecutionFailures] = useState<BotGroupExecutionFailureView[]>([]);const [replies, setReplies] = useState<BotGroupMessageView[]>([]);const [hasMore, setHasMore] = useState(false);const [text, setText] = useState('');@@ -57,18 +62,15 @@ export function ChatThreadPanel({ group, rootId, onClose }: { group: BotGroupDetconst version = ++request.current, owner = getDataOwnerGeneration();const current = () => version === request.current && isDataOwnerGenerationCurrent(owner);try {- const result = await api().thread({ groupId: group.id, rootId, before });+ const result = await api().thread({ groupId: group.id, rootId, before, sourceMessageIds: replies.map(message => message.id) });if (!current()) return;if (!result.ok) { setError(t(chatErrorKey(result.errorCode))); return; }setRoot(result.root); setError('');- setReplies(previous => {- const merged = new Map(previous.map(m => [m.id, m]));- for (const message of result.replies) merged.set(message.id, message);- return [...merged.values()].sort((a, b) => a.sequence - b.sequence);- });+ setExecutionFailures(result.executionFailures ?? []);+ setReplies(previous => mergeBotGroupMessages(previous, result.replies));if (before || replies.length === 0) setHasMore(result.hasMore);} catch { if (current()) setError(t(key('requestFailed'))); }- }, [group.id, rootId, t, replies.length]);+ }, [group.id, rootId, t, replies]);const loadRef = useRef(load); loadRef.current = load;useEffect(() => {void loadRef.current();@@ -104,10 +106,10 @@ export function ChatThreadPanel({ group, rootId, onClose }: { group: BotGroupDet<Dialog.Close className={iconClass} aria-label={t('bots.close')}><X size={17} /></Dialog.Close></header><div ref={contentRef} className="min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4">- {root && <ThreadMessage shareScope={shareScope} sharing={sharing} group={group} message={root} onChanged={() => void loadRef.current()} />}+ {projectBotGroupExecutionFailures(root ? [root] : [], executionFailures).map(message => <ThreadMessage key={message.id} shareScope={shareScope} sharing={sharing} group={group} message={message} onChanged={() => void loadRef.current()} />)}<div className="border-t border-[var(--border-default)] pt-3 text-12 text-[var(--text-tertiary)]">{t(key('replies'))}</div>{hasMore && <Button variant="secondary" size="sm" onClick={() => void loadRef.current(replies[0]?.sequence)}>{t('bots.groupChat.timeline.loadEarlier')}</Button>}- {replies.map(message => <ThreadMessage key={message.id} shareScope={shareScope} sharing={sharing} group={group} message={message} onChanged={() => void loadRef.current()} />)}+ {projectBotGroupExecutionFailures(replies, executionFailures).map(message => <ThreadMessage key={message.id} shareScope={shareScope} sharing={sharing} group={group} message={message} onChanged={() => void loadRef.current()} />)}</div>{sharing ? <ShareSelectionBar sessionId={shareScope} barWidth="100%"getContentWidth={() => contentRef.current?.querySelector('article')?.getBoundingClientRect().width ?? 400} /> : <div className="space-y-3 border-t border-[var(--border-default)] p-4">diff --git a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsxindex f97b6c3427..e55fcb923f 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx@@ -309,6 +309,41 @@ beforeEach(() => {afterEach(cleanup);describe('BotGroupChatView', () => {+ it('keeps a newer push failure snapshot when a stale older-page request finishes later', async () => {+ const latest = msg({ id: 'latest', sequence: 100, content: 'Latest question' });+ const source = msg({ id: 'older', sequence: 4, content: 'Earlier question' });+ const failure = { executionId: 'older', epoch: 1, sourceMessageId: source.id, botId: 'bot', botName: 'Bot', code: 'AUTH_REQUIRED' as const, planId: null };+ let finish: ((result: { ok: true; group: BotGroupDetail }) => void) | undefined;+ const pending = new Promise<{ ok: true; group: BotGroupDetail }>(resolve => { finish = resolve; });+ mocks.getBotGroup.mockResolvedValueOnce({ ok: true, group: detail({ messages: [latest], hasMoreBefore: true, executionFailures: [failure] }) })+ .mockReturnValueOnce(pending)+ .mockResolvedValue({ ok: true, group: detail({ name: 'Fresh group', messages: [latest], executionFailures: [] }) });+ renderView();+ fireEvent.click(await screen.findByRole('button', { name: 'bots.groupChat.timeline.loadEarlier' }));+ await act(async () => mocks.pushes.forEach(push => push({ groupId: 'g1', change: 'round' })));+ await screen.findByText('Fresh group');+ await act(async () => finish?.({ ok: true, group: detail({ messages: [source], executionFailures: [failure] }) }));+ expect(screen.getByText('Earlier question')).toBeTruthy();+ expect(screen.queryByText('bots.groupChat.notice.runtimeFailure.AUTH_REQUIRED:Bot')).toBeNull();+ });++ it.each([false, true])('clears retried failures on an older timeline page when the newest page is refreshed (initial failure: %s)', async initialFailure => {+ const source = msg({ id: 'older-source', sequence: 4, content: 'Earlier question' });+ const failure = { executionId: 'older', epoch: 1, sourceMessageId: source.id, botId: 'bot', botName: 'Bot', code: 'AUTH_REQUIRED' as const, planId: null };+ const latest = msg({ id: 'latest-source', sequence: 100, content: 'Latest question' });+ mocks.getBotGroup.mockResolvedValueOnce({ ok: true, group: detail({ messages: [latest], hasMoreBefore: true, executionFailures: initialFailure ? [failure] : [] }) })+ .mockResolvedValueOnce({ ok: true, group: detail({ messages: [source], hasMoreBefore: false, executionFailures: [failure] }) })+ .mockResolvedValue({ ok: true, group: detail({ messages: [latest], executionFailures: [] }) });+ renderView();+ fireEvent.click(await screen.findByRole('button', { name: 'bots.groupChat.timeline.loadEarlier' }));+ await screen.findByText('bots.groupChat.notice.runtimeFailure.AUTH_REQUIRED:Bot');+ act(() => mocks.pushes.forEach(push => push({ groupId: 'g1', change: 'round' })));+ await waitFor(() => expect(screen.queryByText('bots.groupChat.notice.runtimeFailure.AUTH_REQUIRED:Bot')).toBeNull());+ expect(screen.getByText('Earlier question')).toBeTruthy();+ expect(screen.getByText('Latest question')).toBeTruthy();+ expect(mocks.getBotGroup.mock.calls.at(-1)).toEqual(['g1', { sourceMessageIds: [source.id, latest.id] }]);+ });+it('shows another human as a named participant instead of the current user bubble', async () => {mocks.getBotGroup.mockResolvedValue({ ok: true, group: detail({ messages: [msg({ id: 'guest', authorKind: 'user', isSelf: false, authorName: 'Invited human', content: 'Hello from another account' }),diff --git a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupRuntimeFailureNotice.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupRuntimeFailureNotice.test.tsxnew file mode 100644index 0000000000..467a708eae--- /dev/null+++ b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupRuntimeFailureNotice.test.tsx@@ -0,0 +1,28 @@+// @vitest-environment jsdom+import { cleanup, render, screen } from '@testing-library/react';+import { afterEach, describe, expect, it, vi } from 'vitest';+import { BotGroupRuntimeFailureNotice } from '../BotGroupRuntimeFailureNotice';+import zhCN from '../../../i18n/locales/zh-CN/common.json';++vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string, { name }: { name: string }) => {+ const code = key.split('.').at(-1)!;+ return zhCN.bots.groupChat.notice.runtimeFailure[code as keyof typeof zhCN.bots.groupChat.notice.runtimeFailure].replace('{{name}}', name);+} }) }));+afterEach(cleanup);++describe('group failure notice', () => {+ it('shows the image failure and the actual recovery settings', () => {+ render(<BotGroupRuntimeFailureNotice name="m" code="IMAGE_INPUT_UNSUPPORTED" />);+ expect(screen.getByText(/当前模型不支持图片/).textContent).toContain('设置 → 个性化 → 视觉桥');+ expect(screen.getByText(/当前模型不支持图片/).textContent).toContain('重新发送');+ });+ it('does not render an unknown or private diagnostic as group content', () => {+ const { container } = render(<BotGroupRuntimeFailureNotice name="m" code="private-token-and-path" />);+ expect(container.textContent).toBe('');+ });+ it('explains upstream capacity and offers a retry without attributing it to request frequency', () => {+ render(<BotGroupRuntimeFailureNotice name="m" code="UPSTREAM_OVERLOADED" />);+ expect(screen.getByText(/模型服务暂时繁忙/).textContent).toContain('稍后重新发送');+ expect(screen.getByText(/模型服务暂时繁忙/).textContent).toContain('其他可用模型');+ });+});diff --git a/apps/desktop/src/renderer/features/bots/__tests__/ChatServerControls.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/ChatServerControls.test.tsxindex 068898c4ba..2bab36f2f5 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/ChatServerControls.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/ChatServerControls.test.tsx@@ -42,6 +42,45 @@ beforeEach(() => {afterEach(() => { cleanup(); shareSelectionStore.reset(); vi.unstubAllGlobals(); });describe('chat interaction controls', () => {+ it.each([undefined, 'private-diagnostic'])('keeps existing thread notices visible without a valid runtime code: %s', async runtimeFailureCode => {+ mocks.thread.mockResolvedValue({ ok: true, root: message, replies: [{ ...message, id: 'old-notice', kind: 'notice',+ content: 'Existing system notice', runtimeFailureCode }], hasMore: false });+ render(<ChatThreadPanel group={group} rootId="root" onClose={vi.fn()} />);+ expect(await screen.findByText('Existing system notice')).toBeTruthy();+ expect(screen.queryByText('private-diagnostic')).toBeNull();+ });++ it('renders the current root failure beside the root and removes it when a refreshed page clears the failure', async () => {+ const failure = { executionId: 'root-run', epoch: 1, sourceMessageId: message.id, botId: 'bot', botName: 'Bot', code: 'QUOTA_EXCEEDED', planId: null };+ mocks.thread.mockResolvedValueOnce({ ok: true, root: message, executionFailures: [failure], replies: [], hasMore: true })+ .mockResolvedValue({ ok: true, root: message, executionFailures: [], replies: [], hasMore: false });+ render(<ChatThreadPanel group={group} rootId="root" onClose={vi.fn()} />);+ const text = 'bots.groupChat.notice.runtimeFailure.QUOTA_EXCEEDED';+ expect(await screen.findByText(text)).toBeTruthy();+ expect(screen.getByText('Root message')).toBeTruthy();+ fireEvent.click(screen.getByRole('button', { name: 'bots.groupChat.timeline.loadEarlier' }));+ await waitFor(() => expect(screen.queryByText(text)).toBeNull());+ expect(screen.getByText('Root message')).toBeTruthy();+ });++ it('clears a retried failure on an older loaded Thread page without dropping its reply', async () => {+ const latest = { ...message, id: 'latest', sequence: 100, content: 'Latest reply' };+ const older = { ...message, id: 'older', sequence: 4, content: 'Earlier reply' };+ const failure = { executionId: 'older-run', epoch: 1, sourceMessageId: older.id, botId: 'bot', botName: 'Bot', code: 'AUTH_REQUIRED', planId: null };+ mocks.thread.mockResolvedValueOnce({ ok: true, root: message, replies: [latest], hasMore: true, executionFailures: [failure] })+ .mockResolvedValueOnce({ ok: true, root: message, replies: [older], hasMore: false, executionFailures: [failure] })+ .mockResolvedValue({ ok: true, root: message, replies: [latest], hasMore: true, executionFailures: [] });+ render(<ChatThreadPanel group={group} rootId="root" onClose={vi.fn()} />);+ fireEvent.click(await screen.findByRole('button', { name: 'bots.groupChat.timeline.loadEarlier' }));+ await screen.findByText('bots.groupChat.notice.runtimeFailure.AUTH_REQUIRED');+ const root = screen.getByText('Root message').closest('article')!;+ fireEvent.click(within(root).getByRole('button', { name: k('reactionCount') }));+ await waitFor(() => expect(screen.queryByText('bots.groupChat.notice.runtimeFailure.AUTH_REQUIRED')).toBeNull());+ expect(screen.getByText('Earlier reply')).toBeTruthy();+ expect(screen.getByText('Latest reply')).toBeTruthy();+ expect(mocks.thread.mock.calls.at(-1)?.[0]).toMatchObject({ sourceMessageIds: [older.id, latest.id] });+ });+it('preserves copy and image sharing beside thread replies and reactions in one toolbar', async () => {const writeText = vi.fn().mockResolvedValue(undefined), reply = vi.fn();Object.defineProperty(navigator, 'clipboard', { configurable: true, value: { writeText } });diff --git a/apps/desktop/src/renderer/features/bots/botGroupPresentation.ts b/apps/desktop/src/renderer/features/bots/botGroupPresentation.tsindex ad8915dba4..549f22061a 100644--- a/apps/desktop/src/renderer/features/bots/botGroupPresentation.ts+++ b/apps/desktop/src/renderer/features/bots/botGroupPresentation.ts@@ -27,6 +27,7 @@ export {isBotGroupDivisionBlocked,isRunningBotGroupSidebarPreview,mergeBotGroupMessages,+ projectBotGroupExecutionFailures,mergeBotGroupPlans,openBotGroupPlan,sortBotGroups,diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex 98f02d4e12..14aa655175 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -8613,7 +8613,18 @@"workdirUnavailable": "{{name}} can’t find the working directory","stepFailed": "{{name}} ran into a problem and didn’t finish this step","stepTimeout": "{{name}} took too long, so this step was stopped",- "stepUnavailable": "{{name}} is unavailable and can’t do this step"+ "stepUnavailable": "{{name}} is unavailable and can’t do this step",+ "runtimeFailure": {+ "IMAGE_INPUT_UNSUPPORTED": "{{name}} could not reply: the current model does not support images.\nChoose an image-capable model, or enable and configure Vision Bridge in Settings → Personalization, then send your message again.",+ "MODEL_UNAVAILABLE": "{{name}} could not reply: no model is available.\nChoose a connected, available model in the teammate settings, then send your message again.",+ "AUTH_REQUIRED": "{{name}} could not reply: the model connection needs authentication.\nReconnect the model provider in Settings, then send your message again.",+ "RATE_LIMITED": "{{name}} could not reply: too many model requests.\nSend your message again later, or choose another available model.",+ "UPSTREAM_OVERLOADED": "{{name}} couldn't reply: the model service is temporarily overloaded.\nTry sending again later, or choose another available model.",+ "QUOTA_EXCEEDED": "{{name}} could not reply: the model usage limit was reached.\nCheck the provider quota, or choose another available model.",+ "NETWORK_ERROR": "{{name}} could not reply: the network connection failed.\nCheck your network or proxy, then send your message again.",+ "RUNTIME_TIMEOUT": "{{name}} did not reply before the timeout.\nSend your message again, or choose another available model.",+ "RUNTIME_ERROR": "{{name}} could not reply this time.\nSend your message again. If it still fails, check the logs and report the issue."+ }},"settings": {"open": "Group Settings",diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 95dae92816..77564d10e5 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -8593,7 +8593,18 @@"workdirUnavailable": "{{name}} が作業ディレクトリを見つけられません","stepFailed": "{{name}} はエラーのため、このステップを完了できませんでした","stepTimeout": "{{name}} の作業に時間がかかりすぎたため、このステップを止めました",- "stepUnavailable": "{{name}} は現在利用できないため、このステップを進められません"+ "stepUnavailable": "{{name}} は現在利用できないため、このステップを進められません",+ "runtimeFailure": {+ "IMAGE_INPUT_UNSUPPORTED": "{{name}}は返信できませんでした。現在のモデルは画像に対応していません。\n画像対応モデルに切り替えるか、「設定 → パーソナライズ → ビジョンブリッジ」を有効にして視覚モデルを設定し、メッセージを再送してください。",+ "MODEL_UNAVAILABLE": "{{name}}は返信できませんでした。利用可能なモデルがありません。\n仲間の設定で接続済みの利用可能なモデルを選び、メッセージを再送してください。",+ "AUTH_REQUIRED": "{{name}}は返信できませんでした。モデルの接続に再認証が必要です。\n設定でモデルのプロバイダーに再接続し、メッセージを再送してください。",+ "RATE_LIMITED": "{{name}}は返信できませんでした。モデルへのリクエストが多すぎます。\nしばらく待ってメッセージを再送するか、別の利用可能なモデルを選んでください。",+ "UPSTREAM_OVERLOADED": "{{name}}は返信できませんでした。モデルサービスが一時的に混雑しています。\nしばらく待ってメッセージを再送するか、別の利用可能なモデルを選んでください。",+ "QUOTA_EXCEEDED": "{{name}}は返信できませんでした。モデルの使用量が上限に達しました。\nプロバイダーのクォータを確認するか、別の利用可能なモデルを選んでください。",+ "NETWORK_ERROR": "{{name}}は返信できませんでした。ネットワーク接続に失敗しました。\nネットワークやプロキシを確認し、メッセージを再送してください。",+ "RUNTIME_TIMEOUT": "{{name}}の返信がタイムアウトしました。\nメッセージを再送するか、別の利用可能なモデルを選んでください。",+ "RUNTIME_ERROR": "{{name}}は今回は返信できませんでした。\nメッセージを再送してください。再度失敗する場合は、ログを確認して問題を報告してください。"+ }},"settings": {"open": "グループの設定",diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex 06bb72deb6..09c8dc55ce 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -8593,7 +8593,18 @@"workdirUnavailable": "{{name}} 님이 작업 디렉터리를 찾지 못했습니다","stepFailed": "{{name}} 님이 오류로 이 단계를 끝내지 못했습니다","stepTimeout": "{{name}} 님의 작업이 너무 오래 걸려 이 단계를 멈췄습니다",- "stepUnavailable": "{{name}} 님을 지금 사용할 수 없어 이 단계를 진행할 수 없습니다"+ "stepUnavailable": "{{name}} 님을 지금 사용할 수 없어 이 단계를 진행할 수 없습니다",+ "runtimeFailure": {+ "IMAGE_INPUT_UNSUPPORTED": "{{name}}이(가) 답변하지 못했습니다. 현재 모델은 이미지를 지원하지 않습니다.\n이미지 지원 모델로 전환하거나 설정 → 개인화 → 비전 브리지에서 비전 모델을 활성화하고 설정한 뒤 메시지를 다시 보내세요.",+ "MODEL_UNAVAILABLE": "{{name}}이(가) 답변하지 못했습니다. 사용 가능한 모델이 없습니다.\n동료 설정에서 연결된 사용 가능한 모델을 선택한 뒤 메시지를 다시 보내세요.",+ "AUTH_REQUIRED": "{{name}}이(가) 답변하지 못했습니다. 모델 연결에 재인증이 필요합니다.\n설정에서 모델 제공자에 다시 연결한 뒤 메시지를 다시 보내세요.",+ "RATE_LIMITED": "{{name}}이(가) 답변하지 못했습니다. 모델 요청이 너무 많습니다.\n잠시 후 메시지를 다시 보내거나 다른 사용 가능한 모델을 선택하세요.",+ "UPSTREAM_OVERLOADED": "{{name}}이(가) 답변할 수 없습니다. 모델 서비스가 일시적으로 혼잡합니다.\n잠시 후 메시지를 다시 보내거나 다른 사용 가능한 모델을 선택해 주세요.",+ "QUOTA_EXCEEDED": "{{name}}이(가) 답변하지 못했습니다. 모델 사용량 한도에 도달했습니다.\n제공자의 할당량을 확인하거나 다른 사용 가능한 모델을 선택하세요.",+ "NETWORK_ERROR": "{{name}}이(가) 답변하지 못했습니다. 네트워크 연결에 실패했습니다.\n네트워크나 프록시를 확인한 뒤 메시지를 다시 보내세요.",+ "RUNTIME_TIMEOUT": "{{name}}의 답변 시간이 초과되었습니다.\n메시지를 다시 보내거나 다른 사용 가능한 모델을 선택하세요.",+ "RUNTIME_ERROR": "{{name}}이(가) 이번에는 답변하지 못했습니다.\n메시지를 다시 보내세요. 계속 실패하면 로그를 확인하고 문제를 신고하세요."+ }},"settings": {"open": "그룹 설정",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex bb3101b939..40605bd317 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -8593,7 +8593,18 @@"workdirUnavailable": "{{name}}找不到工作目录","stepFailed": "{{name}}这一步出错了,没做完","stepTimeout": "{{name}}太久没做完,这一步先停下",- "stepUnavailable": "{{name}}现在不可用,这一步没法做"+ "stepUnavailable": "{{name}}现在不可用,这一步没法做",+ "runtimeFailure": {+ "IMAGE_INPUT_UNSUPPORTED": "{{name}}无法回复:当前模型不支持图片。\n请切换到支持图片的模型,或在「设置 → 个性化 → 视觉桥」开启并配置视觉模型后重新发送。",+ "MODEL_UNAVAILABLE": "{{name}}无法回复:当前没有可用模型。\n请在伙伴设置中选择已连接的可用模型后重新发送。",+ "AUTH_REQUIRED": "{{name}}无法回复:模型连接需要重新认证。\n请在设置中重新连接对应模型来源后重新发送。",+ "RATE_LIMITED": "{{name}}无法回复:模型请求过于频繁。\n请稍后重新发送,或选择其他可用模型。",+ "UPSTREAM_OVERLOADED": "{{name}}无法回复:模型服务暂时繁忙。\n请稍后重新发送,或选择其他可用模型。",+ "QUOTA_EXCEEDED": "{{name}}无法回复:模型用量已达上限。\n请检查对应来源的配额,或选择其他可用模型。",+ "NETWORK_ERROR": "{{name}}无法回复:网络连接失败。\n请检查网络或 Proxy 后重新发送。",+ "RUNTIME_TIMEOUT": "{{name}}本次回复超时。\n请重新发送消息,或选择其他可用模型。",+ "RUNTIME_ERROR": "{{name}}这次没能回复。\n请重新发送消息;如果仍失败,请查看日志并反馈问题。"+ }},"settings": {"open": "群设置",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.jsonindex 93afcf865e..06dedb3baa 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json@@ -8593,7 +8593,18 @@"workdirUnavailable": "{{name}}找不到工作目錄","stepFailed": "{{name}}這一步出錯了,沒做完","stepTimeout": "{{name}}太久沒做完,這一步先停下",- "stepUnavailable": "{{name}}現在無法使用,這一步沒辦法做"+ "stepUnavailable": "{{name}}現在無法使用,這一步沒辦法做",+ "runtimeFailure": {+ "IMAGE_INPUT_UNSUPPORTED": "{{name}}無法回覆:目前模型不支援圖片。\n請切換至支援圖片的模型,或在「設定 → 個性化 → 視覺橋」啟用並設定視覺模型後重新傳送。",+ "MODEL_UNAVAILABLE": "{{name}}無法回覆:目前沒有可用模型。\n請在夥伴設定中選擇已連線的可用模型後重新傳送。",+ "AUTH_REQUIRED": "{{name}}無法回覆:模型連線需要重新驗證。\n請在設定中重新連線對應的模型來源後重新傳送。",+ "RATE_LIMITED": "{{name}}無法回覆:模型請求過於頻繁。\n請稍後重新傳送,或選擇其他可用模型。",+ "UPSTREAM_OVERLOADED": "{{name}}無法回覆:模型服務暫時繁忙。\n請稍後重新傳送,或選擇其他可用模型。",+ "QUOTA_EXCEEDED": "{{name}}無法回覆:模型用量已達上限。\n請檢查對應來源的配額,或選擇其他可用模型。",+ "NETWORK_ERROR": "{{name}}無法回覆:網路連線失敗。\n請檢查網路或 Proxy 後重新傳送。",+ "RUNTIME_TIMEOUT": "{{name}}本次回覆逾時。\n請重新傳送訊息,或選擇其他可用模型。",+ "RUNTIME_ERROR": "{{name}}這次未能回覆。\n請重新傳送訊息;若仍失敗,請查看記錄並回報問題。"+ }},"settings": {"open": "群聊設定",diff --git a/apps/desktop/src/shared/inputError.ts b/apps/desktop/src/shared/inputError.tsindex 3484762467..cc9671adfd 100644--- a/apps/desktop/src/shared/inputError.ts+++ b/apps/desktop/src/shared/inputError.ts@@ -12,3 +12,12 @@ export function isPiImageInputUnsupportedError(value: unknown): boolean {code === PI_IMAGE_INPUT_UNSUPPORTED_CODE || message.includes(PI_IMAGE_INPUT_UNSUPPORTED_MARKER));}++/** The existing Pi prompt RPC expiry signal, shared by native recovery and group settlement. */+export function isPiPromptRpcTimeoutError(data: unknown): boolean {+ if (!data || typeof data !== 'object') return false;+ const rec = data as { message?: unknown; sdkError?: unknown };+ return [rec.message, rec.sdkError].some(+ value => typeof value === 'string' && /pi rpc timeout after \d+ms: prompt\b/i.test(value),+ );+}diff --git a/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx b/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsxindex 95f8cbe815..ef2d70eeb7 100644--- a/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx+++ b/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx@@ -2,7 +2,7 @@import { act, createElement as el, useEffect, useImperativeHandle, useRef, useState } from 'react';import { createRoot, type Root } from 'react-dom/client';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import type { BotGroupRemoteChatData } from '@cindy/maker-shared/botGroupChat';+import { BOT_GROUP_RUNTIME_FAILURE_CODES, type BotGroupRemoteChatData } from '@cindy/maker-shared/botGroupChat';const h = vi.hoisted(() => ({chat: null as any,@@ -333,6 +333,15 @@ describe('group timeline', () => {expect(all('botGroup.message.bot')).toHaveLength(0);});+ it.each(BOT_GROUP_RUNTIME_FAILURE_CODES)('renders the runtime reason and recovery advice on mobile: %s', async runtimeFailureCode => {+ await render(group({ messages: [message('failure', 1, { kind: 'notice', authorKind: 'system',+ authorName: 'Bot', noticeCode: 'member-failed', runtimeFailureCode })] }));+ const text = all('botGroup.notice')[0]?.textContent;+ expect(text).toContain(`groupChat.notice.runtimeFailure.${runtimeFailureCode}(name=Bot)`);+ expect(text).toContain('groupChat.notice.runtimeFailureSetupHint');+ expect(text).not.toContain('groupChat.notice.memberFailed');+ });+it('renders messages, notices, round ends and plan ends like the desktop timeline', async () => {await render();expect(byId('botGroup.message.user')?.textContent).toBe('@咪咪 帮我做官网');diff --git a/apps/mobile/src/__tests__/botGroupRemote.test.ts b/apps/mobile/src/__tests__/botGroupRemote.test.tsindex ec9448ef55..98d72013a6 100644--- a/apps/mobile/src/__tests__/botGroupRemote.test.ts+++ b/apps/mobile/src/__tests__/botGroupRemote.test.ts@@ -45,6 +45,13 @@ function chatData(overrides: Record<string, unknown> = {}) {}describe('parseBotGroupChatData', () => {+ it.each(['AUTH_REQUIRED', 'private diagnostic', undefined])('preserves only allowlisted runtime failure codes from the computer: %s', runtimeFailureCode => {+ const data = chatData({ messages: [{ id: 'failure', sequence: 1, kind: 'notice', authorKind: 'system',+ authorName: 'Bot', content: '', createdAt: 1, noticeCode: 'member-failed', runtimeFailureCode }] });+ const parsed = parseBotGroupChatData(data)!;+ expect(parsed.messages[0].runtimeFailureCode).toBe(runtimeFailureCode === 'AUTH_REQUIRED' ? runtimeFailureCode : undefined);+ expect(JSON.stringify(parsed.messages)).not.toContain('private diagnostic');+ });it('preserves server member identities and removal capability', () => {const parsed = parseBotGroupChatData(chatData({ serverBacked: true, supportsMemberRemoval: true,members: [{ botId: 'human', actorId: 'actor', actorKind: 'human', isOwned: false, name: 'Person', status: 'active' }] }));diff --git a/apps/mobile/src/__tests__/chatServerClient.test.ts b/apps/mobile/src/__tests__/chatServerClient.test.tsindex 59a46c9978..aeb42a9c24 100644--- a/apps/mobile/src/__tests__/chatServerClient.test.ts+++ b/apps/mobile/src/__tests__/chatServerClient.test.ts@@ -11,6 +11,101 @@ const snapshot = (): ChatSnapshot => ({ room: room(), cursor: '9007199254741099'] });describe('direct Chat Server client', () => {+ it('reconciles all loaded message pages in bounded requests and clears an old-source failure on refresh', async () => {+ const latest = Array.from({ length: 100 }, (_, n) => message(200 - n));+ const older = Array.from({ length: 100 }, (_, n) => message(100 - n));+ let status = 'failed';+ const request = vi.fn().mockImplementation(async (path: string) => {+ if (path.endsWith('/snapshot')) return snapshot();+ if (path.includes('/execution-failures?')) {+ const ids = new URLSearchParams(path.split('?')[1]).get('sourceIds')!.split(',');+ return ids.includes(id(1)) ? [{ id: id(500), source_message_id: id(1), bot_id: id(10), epoch: 1, status,+ failure_code: 'AUTH_REQUIRED' }] : [];+ }+ return path.includes('&before=') ? older : latest;+ });+ const client = createChatServerClient(request);+ const first = await client.load(id(1));+ expect(first.failures).toEqual([]);+ const loaded = await client.older(id(1), first);+ expect(chatGroupView(loaded, id(11)).messages[1]).toMatchObject({ runtimeFailureCode: 'AUTH_REQUIRED' });+ const scopes = request.mock.calls.filter(([path]) => path.includes('/execution-failures?'))+ .map(([path]) => new URLSearchParams(path.split('?')[1]).get('sourceIds')!.split(','));+ expect(scopes.map(ids => ids.length)).toEqual([100, 100, 100]);+ expect(scopes.slice(1).flat()).toEqual([...latest, ...older].map(message => message.id));+ status = 'queued';+ expect(chatGroupView(await client.load(id(1), older.at(-1)!.seq), id(11)).messages).toHaveLength(200);+ });++ it.each(['structured', 'old-marker', 'chat-forgery'])('projects imported runtime notices safely: %s', shape => {+ const source = { ...message(20), origin: shape === 'chat-forgery' ? 'chat' : 'import',+ content: [{ type: 'text', text: shape === 'structured' ? 'group activity' : 'cindy-runtime-error:AUTH_REQUIRED' },+ { type: 'card', namespace: 'cindy.local-history', schemaRevision: 1, fallback: 'group activity',+ data: { kind: 'notice', authorKind: 'system', authorName: 'Bot', noticeCode: 'member-failed',+ ...(shape !== 'old-marker' ? { runtimeFailureCode: 'AUTH_REQUIRED' } : {}) } }] };+ const view = chatGroupView({ snapshot: snapshot(), messages: [source], before: null }, id(11));+ if (shape === 'chat-forgery') {+ expect(view.messages[0]).toMatchObject({ kind: 'message', authorKind: 'user' });+ expect(view.messages[0].runtimeFailureCode).toBeUndefined();+ } else {+ expect(view.messages[0]).toMatchObject({ kind: 'notice', authorKind: 'system', authorName: 'Bot', runtimeFailureCode: 'AUTH_REQUIRED', content: '' });+ expect(JSON.stringify(view.messages)).not.toContain('cindy-runtime-error:');+ expect(chatRoomRow(room(), { ...snapshot(), messages: [source] }, id(11)).item.display.preview).not.toContain('cindy-runtime-error:');+ }+ });+ it.each(['AUTH_REQUIRED', 'private diagnostic', undefined])('reads executions and projects a safe notice beside its visible source: %s', async failure_code => {+ const source = message(20);+ let status = 'failed';+ const request = vi.fn();+ request.mockImplementation(async (path: string) => path.endsWith('/snapshot') ? snapshot()+ : path.includes('/execution-failures?') ? [{ id: id(30), source_message_id: source.id, bot_id: id(10), epoch: 1, status, failure_code }]+ : [source]);+ const client = createChatServerClient(request);+ const page = await client.load(id(1));+ expect(request).toHaveBeenCalledWith(`/conversations/${id(1)}/execution-failures?sourceIds=${source.id}`);+ const view = chatGroupView(page, id(11));+ expect(view.messages).toHaveLength(2);+ expect(view.messages[0]).toMatchObject({ id: source.id, kind: 'message' });+ expect(view.messages[1]).toMatchObject({ id: `execution-failure:${id(30)}:1`, sequence: view.messages[0].sequence,+ kind: 'notice', runtimeFailureCode: failure_code === 'AUTH_REQUIRED' ? failure_code : 'RUNTIME_ERROR' });+ expect(view.lastMessage?.preview).toBe('20');+ expect(JSON.stringify(view.messages)).not.toContain('private diagnostic');+ status = 'queued';+ expect(chatGroupView(await client.load(id(1)), id(11)).messages).toHaveLength(1);+ expect(chatGroupView({ ...page, messages: [] }, id(11)).messages).toHaveLength(0);+ expect(chatGroupView({ ...page, messages: [{ ...source, deleted: true }] }, id(11)).messages).toHaveLength(0);+ });+ it('keeps simultaneous failures distinct without changing the source cursor or leaking detail', () => {+ const source = message(20);+ const execution = { id: id(30), source_message_id: source.id, bot_id: id(10), epoch: 2, status: 'failed',+ failure_code: 'RUNTIME_TIMEOUT', detail: { message: 'private diagnostic' } };+ const view = chatGroupView({ snapshot: snapshot(), messages: [source, message(21)], before: source.seq,+ failures: [execution, { ...execution, id: id(31), bot_id: id(11), failure_code: 'AUTH_REQUIRED' },+ { ...execution, id: id(32), conversation_id: id(99) }, { ...execution, id: id(33), epoch: NaN }] }, id(11));+ expect(view.messages.map(entry => entry.id)).toEqual([source.id, `execution-failure:${id(30)}:2`, `execution-failure:${id(31)}:2`, id(21)]);+ expect(view.messages.slice(0, 3).map(entry => entry.sequence)).toEqual([1, 1, 1]);+ expect(view.messages[1].noticeCode).toBe('member-timeout');+ expect(view.hasMoreBefore).toBe(true);+ expect(view.lastMessage?.preview).toBe('21');+ expect(JSON.stringify(view.messages)).not.toContain('private diagnostic');+ });+ it('falls back only for a missing endpoint on an older server', async () => {+ const source = message(20);+ const request = vi.fn().mockResolvedValueOnce(snapshot()).mockResolvedValueOnce([source])+ .mockRejectedValueOnce(Object.assign(new Error('NOT_FOUND'), { status: 404 }))+ .mockResolvedValueOnce([{ id: id(30), source_message_id: source.id, bot_id: id(10), epoch: 1, status: 'failed', failure_code: 'AUTH_REQUIRED' }]);+ const page = await createChatServerClient(request).load(id(1));+ expect(request.mock.calls.at(-1)?.[0]).toBe(`/conversations/${id(1)}/executions`);+ expect(chatGroupView(page, id(11)).messages[1].runtimeFailureCode).toBe('AUTH_REQUIRED');+ });+ it('surfaces execution read denial or malformed success through the existing load error path', async () => {+ const request = vi.fn().mockResolvedValueOnce(snapshot()).mockResolvedValueOnce([message(20)])+ .mockRejectedValueOnce(Object.assign(new Error('NOT_MEMBER'), { status: 403 }))+ .mockResolvedValueOnce(snapshot()).mockResolvedValueOnce([message(20)]).mockResolvedValueOnce({});+ const client = createChatServerClient(request);+ await expect(client.load(id(1))).rejects.toMatchObject({ status: 403 });+ await expect(client.load(id(1))).rejects.toThrow('INVALID_CHAT_EXECUTIONS');+ });it('uses the account human actor and rejects a companion identity', async () => {const request = vi.fn().mockResolvedValueOnce({ actor: { id: id(10), kind: 'human' } }).mockResolvedValueOnce({ actor: { id: id(11), kind: 'bot' } });@@ -36,12 +131,13 @@ describe('direct Chat Server client', () => {});it('opens and paginates main history, preserving exact sequence cursors and author identity', async () => {const messages = Array.from({ length: 100 }, (_, n) => message(200 - n));- const request = vi.fn().mockResolvedValueOnce(snapshot()).mockResolvedValueOnce(messages).mockResolvedValueOnce([message(100)]);+ const request = vi.fn().mockResolvedValueOnce(snapshot()).mockResolvedValueOnce(messages).mockResolvedValueOnce([])+ .mockResolvedValueOnce([message(100)]).mockResolvedValueOnce([]).mockResolvedValueOnce([]);const client = createChatServerClient(request);const page = await client.load(id(1));expect(page.before).toBe(messages.at(-1)!.seq);const older = await client.older(id(1), page);- expect(request.mock.calls[2][0]).toBe(`/conversations/${id(1)}/messages?limit=100&before=${messages.at(-1)!.seq}`);+ expect(request.mock.calls[3][0]).toBe(`/conversations/${id(1)}/messages?limit=100&before=${messages.at(-1)!.seq}`);expect(older.before).toBeNull();const view = chatGroupView(older, id(11));expect(view.messages).toHaveLength(101);@@ -83,7 +179,7 @@ describe('direct Chat Server client', () => {it('reauthorizes and replaces loaded older history on refresh instead of retaining deleted text', async () => {const recent = Array.from({ length: 100 }, (_, n) => message(200 - n));const request = vi.fn().mockResolvedValueOnce(snapshot()).mockResolvedValueOnce(recent)- .mockResolvedValueOnce([{ ...message(100), content: [{ type: 'text', text: 'edited' }] }]);+ .mockResolvedValueOnce([{ ...message(100), content: [{ type: 'text', text: 'edited' }] }]).mockResolvedValueOnce([]).mockResolvedValueOnce([]);const page = await createChatServerClient(request).load(id(1), message(100).seq);expect(chatGroupView(page, id(10)).messages[0].content).toBe('edited');expect(request.mock.calls[2][0]).toContain(`before=${message(101).seq}`);diff --git a/apps/mobile/src/__tests__/chatServerEndpointDiscovery.test.tsx b/apps/mobile/src/__tests__/chatServerEndpointDiscovery.test.tsxindex e23588d629..0ddcef794b 100644--- a/apps/mobile/src/__tests__/chatServerEndpointDiscovery.test.tsx+++ b/apps/mobile/src/__tests__/chatServerEndpointDiscovery.test.tsx@@ -49,6 +49,7 @@ beforeEach(() => {if (path === '/v1/me') return { actor: { id: self, kind: 'human' } };if (path.startsWith('/v1/conversations?')) return [room];if (path.endsWith('/snapshot')) return { room, members: [], messages: [], cursor: '1' };+ if ((path.endsWith('/executions') || path.includes('/execution-failures?'))) return [];if (path.includes('/messages?')) return [];if (path.includes('/changes?')) return { head: '1' };if (options.method === 'POST') return { id: self };diff --git a/apps/mobile/src/__tests__/chatServerMobileEntry.test.tsx b/apps/mobile/src/__tests__/chatServerMobileEntry.test.tsxindex 188e6ad9cb..e0d9d552cb 100644--- a/apps/mobile/src/__tests__/chatServerMobileEntry.test.tsx+++ b/apps/mobile/src/__tests__/chatServerMobileEntry.test.tsx@@ -45,12 +45,32 @@ beforeEach(() => {if (path === '/v1/me') return { actor: { id: self, kind: 'human' } };if (path.endsWith('/members')) return [{ id: self, kind: 'human', state: 'joined', name: 'Me', ownerActorId: self, ownerName: '', role: 'member', avatar: null }];if (path.endsWith('/snapshot')) return { room, members: [{ id: self, kind: 'human', state: 'joined', name: 'Me', ownerActorId: self, ownerName: '', role: 'member', avatar: null }], messages: [], cursor: '1' };+ if ((path.endsWith('/executions') || path.includes('/execution-failures?'))) return [];if (path.includes('/messages?')) return [{ id: self, seq: '9007199254740993', authorId: self, author: { kind: 'human', name: 'Me' }, content: [{ type: 'text', text: 'Fixture message' }], createdAt: '2026-10-09', deleted: false, threadRootId: null }];if (path.endsWith('/messages')) return { id: self };throw new Error('Unexpected request');});});afterEach(() => { act(() => root?.unmount()); root = undefined; vi.unstubAllGlobals(); vi.useRealTimers(); });+it('shows safe execution failures through the direct phone entry and removes them after retry', async () => {+ const original = h.auth.apiFetch.getMockImplementation()!;+ let status = 'failed';+ h.auth.apiFetch.mockImplementation(async (path, options) => (path.endsWith('/executions') || path.includes('/execution-failures?'))+ ? [{ id, source_message_id: self, bot_id: self, epoch: 1, status, failure_code: 'AUTH_REQUIRED', detail: { message: 'private diagnostic' } }]+ : original(path, options));+ showChat = true; await render();+ expect(chat.state.kind).toBe('ready');+ if (chat.state.kind !== 'ready') throw new Error('Expected ready group');+ expect(chat.state.group.messages).toHaveLength(2);+ expect(chat.state.group.messages[1]).toMatchObject({ id: `execution-failure:${id}:1`, runtimeFailureCode: 'AUTH_REQUIRED' });+ expect(chat.state.group.lastMessage?.preview).toBe('Fixture message');+ expect(JSON.stringify(chat.state.group)).not.toContain('private diagnostic');+ expect(h.link.invoke).not.toHaveBeenCalled();+ status = 'queued';+ await act(async () => { chat.reload(); });+ if (chat.state.kind !== 'ready') throw new Error('Expected ready group after retry');+ expect(chat.state.group.messages).toHaveLength(1);+});it('lists and opens an existing joined server group with all computers and the relay offline', async () => {await render();expect(roster.items).toHaveLength(1);@@ -80,7 +100,7 @@ it('never includes the current human actor in explicit or everyone server mentioit('imports read_seq and acknowledges only displayed incoming messages with their exact sequences', async () => {await clearRemoteResourceCache();const first = '9007199254740992', second = '9007199254740993';- const messages = [first, second].map((seq, index) => ({ id: `incoming-${index}`, seq, authorId: id,+ const messages = [first, second].map((seq, index) => ({ id: `00000000-0000-4000-8000-${String(index + 20).padStart(12, '0')}`, seq, authorId: id,author: { kind: 'human', name: 'Other' }, content: [{ type: 'text', text: 'hello' }],createdAt: '2026-10-09T10:00:00.123Z', deleted: false, threadRootId: null }));const original = h.auth.apiFetch.getMockImplementation()!;@@ -94,9 +114,9 @@ it('imports read_seq and acknowledges only displayed incoming messages with theiconst unread = () => isRemoteResourceUnread('owner', '', id, row.item.display.lastReplyAt, row.lastReplySequence);expect(unread()).toBe(true);showChat = true; await render();- await act(async () => { await chat.markRead!(['incoming-0', 'unseen-id']); });+ await act(async () => { await chat.markRead!([messages[0].id, 'unseen-id']); });expect(unread()).toBe(true);- await act(async () => { await chat.markRead!(['incoming-0', 'incoming-1']); });+ await act(async () => { await chat.markRead!([messages[0].id, messages[1].id]); });expect(unread()).toBe(false);expect(h.auth.apiFetch.mock.calls.some(([, options]) => options.method === 'POST')).toBe(false);});diff --git a/apps/mobile/src/chat/chatServerClient.ts b/apps/mobile/src/chat/chatServerClient.tsindex 46499ce4cd..3e997ca416 100644--- a/apps/mobile/src/chat/chatServerClient.ts+++ b/apps/mobile/src/chat/chatServerClient.ts@@ -1,5 +1,6 @@/** The existing Chat Server HTTP contract; no device-link or executor registration. */-import type { BotGroupAttachment, BotGroupMemberView, BotGroupMessageView, BotGroupRemoteChatData } from '@cindy/maker-shared/botGroupChat';+import { readBotGroupExecutionFailure, readImportedBotGroupRuntimeFailureCode, type BotGroupAttachment, type BotGroupMemberView, type BotGroupMessageView, type BotGroupRemoteChatData } from '@cindy/maker-shared/botGroupChat';+import { botGroupExecutionFailureBatches, projectBotGroupExecutionFailures } from '@cindy/maker-shared/botGroupPresentation';import type { HostedRemoteCollectionItem } from '@/device-link/remoteResources';export interface ChatRoom {@@ -19,7 +20,11 @@ export interface ChatMessage {namespace?: string; schemaRevision?: number; data?: Record<string, unknown> }>;}export interface ChatSnapshot { room: ChatRoom; members: ChatMember[]; messages: ChatMessage[]; cursor: string; reads?: Array<{ thread_key: string; read_seq: string }> }-export interface ChatPage { snapshot: ChatSnapshot; messages: ChatMessage[]; before: string | null }+export interface ChatExecutionFailure {+ id: string; conversation_id?: string; source_message_id: string; bot_id: string; epoch: number; status?: string;+ failure_code?: unknown; updated_at?: string; plan_id?: string | null;+}+export interface ChatPage { snapshot: ChatSnapshot; messages: ChatMessage[]; before: string | null; failures?: ChatExecutionFailure[] }export type ChatRequest = <T>(path: string, method?: 'GET' | 'POST', body?: unknown) => Promise<T>;export function chatId(value: string): string {@@ -40,7 +45,7 @@ export function chatAccessLost(error: unknown): boolean {}const memberName = (member: ChatMember) => member.kind === 'bot' && member.ownerName?.trim()? `${member.name} (${member.ownerName.trim()})` : member.name;-const contentText = (message: ChatMessage) => message.deleted ? '' : message.content+const contentText = (message: ChatMessage) => message.deleted || readImportedBotGroupRuntimeFailureCode(message) ? '' : message.content.map(block => block.text ?? block.fallback ?? (block.type === 'media' ? block.caption ?? '' : '')).join('\n');/** Empty device identity means a server-owned conversation, never a fictitious computer. */@@ -112,6 +117,12 @@ export function chatGroupView(page: ChatPage, selfId: string): BotGroupRemoteChaconst sorted = [...new Map(page.messages.map(message => [message.id, message])).values()].filter(message => !message.deleted).sort((a, b) => BigInt(chatCursor(a.seq)) < BigInt(chatCursor(b.seq)) ? -1 : BigInt(a.seq) > BigInt(b.seq) ? 1 : 0);const messages: BotGroupMessageView[] = sorted.map((message, index) => {+ const runtimeFailureCode = readImportedBotGroupRuntimeFailureCode(message);+ const legacy = runtimeFailureCode ? message.content.find(block => block.type === 'card' && block.namespace === 'cindy.local-history' && block.schemaRevision === 1)?.data : undefined;+ if (runtimeFailureCode) return { id: message.id, sequence: index + 1, kind: 'notice', authorKind: 'system',+ authorBotId: message.authorId, authorName: typeof legacy?.authorName === 'string' ? legacy.authorName : '', isSelf: false,+ content: '', mentions: { all: false, botIds: [] }, noticeCode: runtimeFailureCode === 'RUNTIME_TIMEOUT' ? 'member-timeout' : 'member-failed',+ runtimeFailureCode, planId: null, files: [], attachments: [], createdAt: Date.parse(message.createdAt) };const member = active.find(candidate => candidate.id === message.authorId);const joined = message.origin === 'system' && !message.deleted && message.content.find(block =>block.type === 'card' && block.namespace === 'cindy.membership' && block.schemaRevision === 1 && block.data?.type === 'member.joined');@@ -128,16 +139,39 @@ export function chatGroupView(page: ChatPage, selfId: string): BotGroupRemoteCha}), createdAt: Date.parse(message.createdAt) };});const last = messages.at(-1);+ const failures = (page.failures ?? []).flatMap(row => {+ const failure = readBotGroupExecutionFailure(row, room.id);+ if (!failure) return [];+ const member = members.find(candidate => candidate.id === failure.botId);+ return [{ ...failure, botName: member ? memberName(member) : '' }];+ });return { id: room.id, name: room.name, serverBacked: true, archived: room.archived, selfActorId: selfId,revision: room.revision, members: memberViews, replyMode: room.response_mode, speakingMode: room.speaking_mode,organizerBotId: room.organizer_id ?? null, projectDir: null, projectDirName: null,createdAt: Date.parse(room.created_at), updatedAt: Date.parse(room.updated_at),lastMessage: last ? { authorKind: last.authorKind, authorName: last.authorName, preview: last.content.slice(0, 80), createdAt: last.createdAt } : null,- speakingBotIds: [], planningBotId: null, openPlan: null, plans: [], messages,+ speakingBotIds: [], planningBotId: null, openPlan: null, plans: [], messages: projectBotGroupExecutionFailures(messages, failures),hasMoreBefore: page.before !== null, round: { status: 'idle', speakers: [], canContinue: false }, supportsAttachments: false };}export function createChatServerClient(request: ChatRequest) {+ async function failures(roomId: string, messages: ChatMessage[]): Promise<ChatExecutionFailure[]> {+ const sources = new Set(messages.map(message => chatId(message.id)));+ let value: ChatExecutionFailure[] = [];+ try {+ for (const batch of botGroupExecutionFailureBatches([...sources])) {+ const page = await request<ChatExecutionFailure[]>(`/conversations/${chatId(roomId)}/execution-failures?sourceIds=${batch.join(',')}`);+ if (!Array.isArray(page)) throw new Error('INVALID_CHAT_EXECUTIONS');+ value.push(...page);+ }+ }+ catch (error) {+ if (!error || typeof error !== 'object' || !('status' in error) || error.status !== 404) throw error;+ value = await request<ChatExecutionFailure[]>(`/conversations/${chatId(roomId)}/executions`);+ }+ if (!Array.isArray(value)) throw new Error('INVALID_CHAT_EXECUTIONS');+ return value.filter(row => sources.has(row.source_message_id));+ }return {async list(): Promise<ChatRoom[]> {const rooms = new Map<string, ChatRoom>();@@ -185,12 +219,14 @@ export function createChatServerClient(request: ChatRequest) {if (next && BigInt(next) >= BigInt(before)) throw new Error('INVALID_CHAT_PAGE');messages.push(...batch); before = next;}- return { snapshot, messages, before };+ return { snapshot, messages, before, failures: await failures(room, messages) };},async older(roomId: string, page: ChatPage): Promise<ChatPage> {if (!page.before) return page;const messages = await request<ChatMessage[]>(`/conversations/${chatId(roomId)}/messages?limit=100&before=${chatCursor(page.before)}`);- return { ...page, messages: [...page.messages, ...messages], before: messages.length === 100 ? chatCursor(messages.at(-1)!.seq) : null };+ const loaded = [...page.messages, ...messages];+ return { ...page, messages: loaded, failures: await failures(roomId, loaded),+ before: messages.length === 100 ? chatCursor(messages.at(-1)!.seq) : null };},async media(roomId: string, mediaId: string): Promise<BotGroupAttachment> {const media = await request<{ name: string; type: string; size: string | number; url: string }>(`/conversations/${chatId(roomId)}/media/${chatId(mediaId)}`);diff --git a/apps/mobile/src/i18n/locales/en/groupChat.json b/apps/mobile/src/i18n/locales/en/groupChat.jsonindex 0ef1b905a1..f5dbd43fb9 100644--- a/apps/mobile/src/i18n/locales/en/groupChat.json+++ b/apps/mobile/src/i18n/locales/en/groupChat.json@@ -87,7 +87,19 @@"workdirUnavailable": "{{name}} can’t find the working directory","stepFailed": "{{name}} ran into a problem and didn’t finish this step","stepTimeout": "{{name}} took too long, so this step was stopped",- "stepUnavailable": "{{name}} is unavailable and can’t do this step"+ "stepUnavailable": "{{name}} is unavailable and can’t do this step",+ "runtimeFailure": {+ "IMAGE_INPUT_UNSUPPORTED": "{{name}} could not reply: the current model does not support images.\nChoose an image-capable model, or enable and configure Vision Bridge in Settings → Personalization, then send your message again.",+ "MODEL_UNAVAILABLE": "{{name}} could not reply: no model is available.\nChoose a connected, available model in the teammate settings, then send your message again.",+ "AUTH_REQUIRED": "{{name}} could not reply: the model connection needs authentication.\nReconnect the model provider in Settings, then send your message again.",+ "RATE_LIMITED": "{{name}} could not reply: too many model requests.\nSend your message again later, or choose another available model.",+ "UPSTREAM_OVERLOADED": "{{name}} couldn't reply: the model service is temporarily overloaded.\nTry sending again later, or choose another available model.",+ "QUOTA_EXCEEDED": "{{name}} could not reply: the model usage limit was reached.\nCheck the provider quota, or choose another available model.",+ "NETWORK_ERROR": "{{name}} could not reply: the network connection failed.\nCheck your network or proxy, then send your message again.",+ "RUNTIME_TIMEOUT": "{{name}} did not reply before the timeout.\nSend your message again, or choose another available model.",+ "RUNTIME_ERROR": "{{name}} could not reply this time.\nSend your message again. If it still fails, check the logs and report the issue."+ },+ "runtimeFailureSetupHint": "To change the model or settings, use the computer where this teammate runs."},"plan": {"intro_one": "This takes {{count}} step. Here’s who does it:",diff --git a/apps/mobile/src/i18n/locales/ja/groupChat.json b/apps/mobile/src/i18n/locales/ja/groupChat.jsonindex d417f27e7f..aaf2463956 100644--- a/apps/mobile/src/i18n/locales/ja/groupChat.json+++ b/apps/mobile/src/i18n/locales/ja/groupChat.json@@ -87,7 +87,19 @@"workdirUnavailable": "{{name}} が作業ディレクトリを見つけられません","stepFailed": "{{name}} はエラーのため、このステップを完了できませんでした","stepTimeout": "{{name}} の作業に時間がかかりすぎたため、このステップを止めました",- "stepUnavailable": "{{name}} は現在利用できないため、このステップを進められません"+ "stepUnavailable": "{{name}} は現在利用できないため、このステップを進められません",+ "runtimeFailure": {+ "IMAGE_INPUT_UNSUPPORTED": "{{name}}は返信できませんでした。現在のモデルは画像に対応していません。\n画像対応モデルに切り替えるか、「設定 → パーソナライズ → ビジョンブリッジ」を有効にして視覚モデルを設定し、メッセージを再送してください。",+ "MODEL_UNAVAILABLE": "{{name}}は返信できませんでした。利用可能なモデルがありません。\n仲間の設定で接続済みの利用可能なモデルを選び、メッセージを再送してください。",+ "AUTH_REQUIRED": "{{name}}は返信できませんでした。モデルの接続に再認証が必要です。\n設定でモデルのプロバイダーに再接続し、メッセージを再送してください。",+ "RATE_LIMITED": "{{name}}は返信できませんでした。モデルへのリクエストが多すぎます。\nしばらく待ってメッセージを再送するか、別の利用可能なモデルを選んでください。",+ "UPSTREAM_OVERLOADED": "{{name}}は返信できませんでした。モデルサービスが一時的に混雑しています。\nしばらく待ってメッセージを再送するか、別の利用可能なモデルを選んでください。",+ "QUOTA_EXCEEDED": "{{name}}は返信できませんでした。モデルの使用量が上限に達しました。\nプロバイダーのクォータを確認するか、別の利用可能なモデルを選んでください。",+ "NETWORK_ERROR": "{{name}}は返信できませんでした。ネットワーク接続に失敗しました。\nネットワークやプロキシを確認し、メッセージを再送してください。",+ "RUNTIME_TIMEOUT": "{{name}}の返信がタイムアウトしました。\nメッセージを再送するか、別の利用可能なモデルを選んでください。",+ "RUNTIME_ERROR": "{{name}}は今回は返信できませんでした。\nメッセージを再送してください。再度失敗する場合は、ログを確認して問題を報告してください。"+ },+ "runtimeFailureSetupHint": "モデルや設定を変更する場合は、この仲間が動作するパソコンで行ってください。"},"plan": {"intro_one": "この件は {{count}} ステップに分けて、次のように分担します:",diff --git a/apps/mobile/src/i18n/locales/ko/groupChat.json b/apps/mobile/src/i18n/locales/ko/groupChat.jsonindex 0fe1c970d6..408ab997cc 100644--- a/apps/mobile/src/i18n/locales/ko/groupChat.json+++ b/apps/mobile/src/i18n/locales/ko/groupChat.json@@ -87,7 +87,19 @@"workdirUnavailable": "{{name}} 님이 작업 디렉터리를 찾지 못했습니다","stepFailed": "{{name}} 님이 오류로 이 단계를 끝내지 못했습니다","stepTimeout": "{{name}} 님의 작업이 너무 오래 걸려 이 단계를 멈췄습니다",- "stepUnavailable": "{{name}} 님을 지금 사용할 수 없어 이 단계를 진행할 수 없습니다"+ "stepUnavailable": "{{name}} 님을 지금 사용할 수 없어 이 단계를 진행할 수 없습니다",+ "runtimeFailure": {+ "IMAGE_INPUT_UNSUPPORTED": "{{name}}이(가) 답변하지 못했습니다. 현재 모델은 이미지를 지원하지 않습니다.\n이미지 지원 모델로 전환하거나 설정 → 개인화 → 비전 브리지에서 비전 모델을 활성화하고 설정한 뒤 메시지를 다시 보내세요.",+ "MODEL_UNAVAILABLE": "{{name}}이(가) 답변하지 못했습니다. 사용 가능한 모델이 없습니다.\n동료 설정에서 연결된 사용 가능한 모델을 선택한 뒤 메시지를 다시 보내세요.",+ "AUTH_REQUIRED": "{{name}}이(가) 답변하지 못했습니다. 모델 연결에 재인증이 필요합니다.\n설정에서 모델 제공자에 다시 연결한 뒤 메시지를 다시 보내세요.",+ "RATE_LIMITED": "{{name}}이(가) 답변하지 못했습니다. 모델 요청이 너무 많습니다.\n잠시 후 메시지를 다시 보내거나 다른 사용 가능한 모델을 선택하세요.",+ "UPSTREAM_OVERLOADED": "{{name}}이(가) 답변할 수 없습니다. 모델 서비스가 일시적으로 혼잡합니다.\n잠시 후 메시지를 다시 보내거나 다른 사용 가능한 모델을 선택해 주세요.",+ "QUOTA_EXCEEDED": "{{name}}이(가) 답변하지 못했습니다. 모델 사용량 한도에 도달했습니다.\n제공자의 할당량을 확인하거나 다른 사용 가능한 모델을 선택하세요.",+ "NETWORK_ERROR": "{{name}}이(가) 답변하지 못했습니다. 네트워크 연결에 실패했습니다.\n네트워크나 프록시를 확인한 뒤 메시지를 다시 보내세요.",+ "RUNTIME_TIMEOUT": "{{name}}의 답변 시간이 초과되었습니다.\n메시지를 다시 보내거나 다른 사용 가능한 모델을 선택하세요.",+ "RUNTIME_ERROR": "{{name}}이(가) 이번에는 답변하지 못했습니다.\n메시지를 다시 보내세요. 계속 실패하면 로그를 확인하고 문제를 신고하세요."+ },+ "runtimeFailureSetupHint": "모델이나 설정을 변경하려면 이 동료가 실행되는 컴퓨터에서 변경하세요."},"plan": {"intro_one": "이 일은 {{count}}단계로 나눠서 이렇게 분담할게요:",diff --git a/apps/mobile/src/i18n/locales/zh-CN/groupChat.json b/apps/mobile/src/i18n/locales/zh-CN/groupChat.jsonindex 934c18eb8c..9ac295b8c0 100644--- a/apps/mobile/src/i18n/locales/zh-CN/groupChat.json+++ b/apps/mobile/src/i18n/locales/zh-CN/groupChat.json@@ -87,7 +87,19 @@"workdirUnavailable": "{{name}}找不到工作目录","stepFailed": "{{name}}这一步出错了,没做完","stepTimeout": "{{name}}太久没做完,这一步先停下",- "stepUnavailable": "{{name}}现在不可用,这一步没法做"+ "stepUnavailable": "{{name}}现在不可用,这一步没法做",+ "runtimeFailure": {+ "IMAGE_INPUT_UNSUPPORTED": "{{name}}无法回复:当前模型不支持图片。\n请切换到支持图片的模型,或在「设置 → 个性化 → 视觉桥」开启并配置视觉模型后重新发送。",+ "MODEL_UNAVAILABLE": "{{name}}无法回复:当前没有可用模型。\n请在伙伴设置中选择已连接的可用模型后重新发送。",+ "AUTH_REQUIRED": "{{name}}无法回复:模型连接需要重新认证。\n请在设置中重新连接对应模型来源后重新发送。",+ "RATE_LIMITED": "{{name}}无法回复:模型请求过于频繁。\n请稍后重新发送,或选择其他可用模型。",+ "UPSTREAM_OVERLOADED": "{{name}}无法回复:模型服务暂时繁忙。\n请稍后重新发送,或选择其他可用模型。",+ "QUOTA_EXCEEDED": "{{name}}无法回复:模型用量已达上限。\n请检查对应来源的配额,或选择其他可用模型。",+ "NETWORK_ERROR": "{{name}}无法回复:网络连接失败。\n请检查网络或 Proxy 后重新发送。",+ "RUNTIME_TIMEOUT": "{{name}}本次回复超时。\n请重新发送消息,或选择其他可用模型。",+ "RUNTIME_ERROR": "{{name}}这次没能回复。\n请重新发送消息;如果仍失败,请查看日志并反馈问题。"+ },+ "runtimeFailureSetupHint": "如需调整模型或设置,请在伙伴所属电脑上处理。"},"plan": {"intro_one": "这件事分 {{count}} 步,我这样分工:",diff --git a/apps/mobile/src/i18n/locales/zh-TW/groupChat.json b/apps/mobile/src/i18n/locales/zh-TW/groupChat.jsonindex 7131fd6466..38a867bbf6 100644--- a/apps/mobile/src/i18n/locales/zh-TW/groupChat.json+++ b/apps/mobile/src/i18n/locales/zh-TW/groupChat.json@@ -87,7 +87,19 @@"workdirUnavailable": "{{name}}找不到工作目錄","stepFailed": "{{name}}這一步出錯了,沒做完","stepTimeout": "{{name}}太久沒做完,這一步先停下",- "stepUnavailable": "{{name}}現在無法使用,這一步沒辦法做"+ "stepUnavailable": "{{name}}現在無法使用,這一步沒辦法做",+ "runtimeFailure": {+ "IMAGE_INPUT_UNSUPPORTED": "{{name}}無法回覆:目前模型不支援圖片。\n請切換至支援圖片的模型,或在「設定 → 個性化 → 視覺橋」啟用並設定視覺模型後重新傳送。",+ "MODEL_UNAVAILABLE": "{{name}}無法回覆:目前沒有可用模型。\n請在夥伴設定中選擇已連線的可用模型後重新傳送。",+ "AUTH_REQUIRED": "{{name}}無法回覆:模型連線需要重新驗證。\n請在設定中重新連線對應的模型來源後重新傳送。",+ "RATE_LIMITED": "{{name}}無法回覆:模型請求過於頻繁。\n請稍後重新傳送,或選擇其他可用模型。",+ "UPSTREAM_OVERLOADED": "{{name}}無法回覆:模型服務暫時繁忙。\n請稍後重新傳送,或選擇其他可用模型。",+ "QUOTA_EXCEEDED": "{{name}}無法回覆:模型用量已達上限。\n請檢查對應來源的配額,或選擇其他可用模型。",+ "NETWORK_ERROR": "{{name}}無法回覆:網路連線失敗。\n請檢查網路或 Proxy 後重新傳送。",+ "RUNTIME_TIMEOUT": "{{name}}本次回覆逾時。\n請重新傳送訊息,或選擇其他可用模型。",+ "RUNTIME_ERROR": "{{name}}這次未能回覆。\n請重新傳送訊息;若仍失敗,請查看記錄並回報問題。"+ },+ "runtimeFailureSetupHint": "如需調整模型或設定,請在夥伴所屬電腦上處理。"},"plan": {"intro_one": "這件事分 {{count}} 步,我這樣分工:",diff --git a/apps/mobile/src/session/BotGroupChatScreen.tsx b/apps/mobile/src/session/BotGroupChatScreen.tsxindex 6c05b4a971..46169b0e7a 100644--- a/apps/mobile/src/session/BotGroupChatScreen.tsx+++ b/apps/mobile/src/session/BotGroupChatScreen.tsx@@ -25,6 +25,7 @@ import { useTranslation } from 'react-i18next';import { resolveRemoteText } from '@cindy/device-link';import {BOT_GROUP_REMOTE_COLLECTION_ID,+ isBotGroupRuntimeFailureCode,type BotGroupAttachment,type BotGroupMemberView,type BotGroupMessageView,@@ -458,6 +459,11 @@ function BotGroupTimelineItem({if (message.kind === 'plan-end') return <BotGroupPlanEndDivider stepCount={plan ? plan.steps.length : null} />;if (message.kind === 'notice' || message.authorKind === 'system') {const name = message.authorName.trim() || member?.name || '';+ if (isBotGroupRuntimeFailureCode(message.runtimeFailureCode)) {+ return <Text style={styles.runtimeFailureNotice} testID="botGroup.notice">{+ `${t(`groupChat.notice.runtimeFailure.${message.runtimeFailureCode}`, { name })}\n${t('groupChat.notice.runtimeFailureSetupHint')}`+ }</Text>;+ }const variant = botGroupNoticeVariant(message.noticeCode, message.planId !== null);return <Text style={styles.notice} testID="botGroup.notice">{variant ? t(`groupChat.notice.${variant}`, { name }) : message.content}</Text>;}@@ -521,6 +527,8 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({olderNote: { color: colors.textTertiary, fontSize: typeScale.footnote, lineHeight: lineHeight.caption, textAlign: 'center' },time: { color: colors.textTertiary, fontSize: typeScale.caption, lineHeight: lineHeight.caption, textAlign: 'center' },notice: { color: colors.textTertiary, fontSize: typeScale.footnote, lineHeight: lineHeight.caption, textAlign: 'center' },+ runtimeFailureNotice: { color: colors.textSecondary, fontSize: typeScale.footnote, lineHeight: lineHeight.caption,+ fontWeight: fontWeight.regular, textAlign: 'center' },dividerText: { flexShrink: 1, color: colors.textTertiary, fontSize: typeScale.footnote, lineHeight: lineHeight.caption, textAlign: 'center' },userRow: { flexDirection: 'row', justifyContent: 'flex-end' },// Full width so the bubble keeps its 86% cap and attachments their own size limits.diff --git a/apps/mobile/src/session/botGroupRemote.ts b/apps/mobile/src/session/botGroupRemote.tsindex b17bcd1ae9..7cca5c63c9 100644--- a/apps/mobile/src/session/botGroupRemote.ts+++ b/apps/mobile/src/session/botGroupRemote.ts@@ -12,6 +12,7 @@ import {BOT_GROUP_MEMBER_LINK_REL,BOT_GROUP_REMOTE_COLLECTION_ID,BOT_GROUP_REMOTE_RESOURCE_KIND,+ isBotGroupRuntimeFailureCode,type BotGroupAttachment,type BotGroupAttachmentCategory,type BotGroupErrorCode,@@ -206,6 +207,7 @@ function parseMessage(value: unknown): BotGroupMessageView | null {content,mentions: parseMentions(record.mentions),noticeCode,+ ...(isBotGroupRuntimeFailureCode(record.runtimeFailureCode) ? { runtimeFailureCode: record.runtimeFailureCode } : {}),planId: optionalId(record.planId),files: stringList(record.files, MAX_FILES, 1_024),// Older computers send no attachments.diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.mdindex 2276759449..6e45dfd92a 100644--- a/docs/design-rules/design-inventory.md+++ b/docs/design-rules/design-inventory.md@@ -9,7 +9,7 @@本区块由 `scripts/design-inventory.mjs` 生成,请勿手改。重新生成:`pnpm design:inventory`;校验:`pnpm check:design-inventory`。-计数快照日期:2026-10-09。生成命令:`pnpm design:inventory`。裸颜色匹配与 `scripts/hardcoded-color-audit.mjs` 共用 `scripts/shared/hardcoded-color-match.mjs`(HEX / RGB / HSL / OKLCH 等字面通道),两者在共享 matcher 内统一排除纯语义包装、注释及 PR 编号;数值颜色函数还需位于样式属性、CSS 声明/函数或任意值语境,普通文案字符串里的颜色函数文本不计入;字面 fallback 仍计入——语义 token 消费与注释引用不是迁移债务;裸圆角为粗粒度(`rounded*` class、`border-radius:` 与 React style 对象的 `borderRadius:`)。Token 计数为样式源里 `var(--token)` / `hsl(var(--token)` 的去重 ID 数;Mobile 的 ThemeColors / typeScale 等 RN 属性不计入此列,不能将 0 解释为未使用 Token。+计数快照日期:2026-10-10。生成命令:`pnpm design:inventory`。裸颜色匹配与 `scripts/hardcoded-color-audit.mjs` 共用 `scripts/shared/hardcoded-color-match.mjs`(HEX / RGB / HSL / OKLCH 等字面通道),两者在共享 matcher 内统一排除纯语义包装、注释及 PR 编号;数值颜色函数还需位于样式属性、CSS 声明/函数或任意值语境,普通文案字符串里的颜色函数文本不计入;字面 fallback 仍计入——语义 token 消费与注释引用不是迁移债务;裸圆角为粗粒度(`rounded*` class、`border-radius:` 与 React style 对象的 `borderRadius:`)。Token 计数为样式源里 `var(--token)` / `hsl(var(--token)` 的去重 ID 数;Mobile 的 ThemeColors / typeScale 等 RN 属性不计入此列,不能将 0 解释为未使用 Token。登记 surface 数:52。平台包含 Desktop 与 Mobile;静态入口发现不表示已迁移或已实机验证。@@ -18,7 +18,7 @@| `desktop.auth.add-account` | desktop | 添加账号 | hash `/add-account`(ProtectedRoute → AddAccountLoginPage) | AddAccountLoginPage | apps/desktop/src/renderer/components/login/AddAccountLoginPage.tsx, apps/desktop/src/renderer/components/login/LoginBrandStage.tsx, apps/desktop/src/renderer/components/login/LoginCaptchaOverlay.tsx, apps/desktop/src/renderer/components/login/LoginControls.tsx, apps/desktop/src/renderer/components/login/LoginPage.tsx, apps/desktop/src/renderer/components/login/loginDesignTokens.ts | 59 | 0 | 20 || `desktop.auth.legacy-migration` | desktop | 首登数据迁移弹窗 | App 顶层挂载 LegacyMigrationDialog(仅主窗;main 检测到旧版 userData 经 `legacy-migration:state` 驱动) | LegacyMigrationDialog | apps/desktop/src/renderer/components/auth/LegacyMigrationDialog.tsx | 8 | 0 | 2 || `desktop.auth.login` | desktop | 登录页 | hash `/login`(GuestRoute → LoginPage) | LoginBrandStage, LoginCaptchaOverlay, LoginControls, LoginPage | apps/desktop/src/renderer/components/login/LoginBrandStage.tsx, apps/desktop/src/renderer/components/login/LoginCaptchaOverlay.tsx, apps/desktop/src/renderer/components/login/LoginControls.tsx, apps/desktop/src/renderer/components/login/LoginPage.tsx, apps/desktop/src/renderer/components/login/loginDesignTokens.ts | 59 | 0 | 20 |-| `desktop.bots` | desktop | 伙伴(列表 / 对话 / 设置 / 历史 / 伙伴私聊 / 群聊) | hash `/bots`、`/bots/list`、`/bots/:botId`、`/bots/roster` 及伙伴当前/历史任务、伙伴私聊、伙伴群聊路由(BotsFeatureLayout) | BotBasicProfileFields, BotCollaborationCard, BotDirectMessageView, BotGroupChatView, BotGroupCreateDialog, BotGroupSettingsDrawer, BotHistorySessionView, BotLifecycleSettings, BotModelChainEditor, BotRosterView, BotSessionView, BotSettingsDrawer, BotsHomeView, BotsListView, RemoteBotSessionView | apps/desktop/src/renderer/components/chat/AgentActionRow.tsx, apps/desktop/src/renderer/components/chat/AgentActionsBlock.tsx, apps/desktop/src/renderer/components/chat/AgentOnOtherDeviceContext.tsx, apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx, apps/desktop/src/renderer/components/chat/AgentTaskLiveDetails.tsx, apps/desktop/src/renderer/components/chat/AnnotationStrokesSvg.tsx, apps/desktop/src/renderer/components/chat/AskUserQuestionBubble.tsx, apps/desktop/src/renderer/components/chat/AssistantMessage.tsx, apps/desktop/src/renderer/components/chat/AutomationOriginBadge.tsx, apps/desktop/src/renderer/components/chat/ChatAudioCard.tsx, apps/desktop/src/renderer/components/chat/ChatDisplaySnapshotContext.tsx, apps/desktop/src/renderer/components/chat/ChatImageView.tsx, apps/desktop/src/renderer/components/chat/ChatSessionFileContext.tsx, apps/desktop/src/renderer/components/chat/ChatSoundEffectCard.tsx, apps/desktop/src/renderer/components/chat/ChatVideoView.tsx, apps/desktop/src/renderer/components/chat/CindyMakeDoctorCard.tsx, apps/desktop/src/renderer/components/chat/CopyAsImageBlock.tsx, apps/desktop/src/renderer/components/chat/CredentialSwitchWaitBanner.tsx, apps/desktop/src/renderer/components/chat/DiffView.tsx, apps/desktop/src/renderer/components/chat/ErrorBanner.tsx, apps/desktop/src/renderer/components/chat/ErrorMessageCard.tsx, apps/desktop/src/renderer/components/chat/GeneratedFilesCard.tsx, apps/desktop/src/renderer/components/chat/GhostCardHostPrompts.tsx, apps/desktop/src/renderer/components/chat/GhostSummonCard.tsx, apps/desktop/src/renderer/components/chat/GhostToolCard.tsx, apps/desktop/src/renderer/components/chat/HookTaskCard.tsx, apps/desktop/src/renderer/components/chat/ImageGalleryContext.tsx, apps/desktop/src/renderer/components/chat/ImageHoverPreview.tsx, apps/desktop/src/renderer/components/chat/ImageLightbox.tsx, apps/desktop/src/renderer/components/chat/ImageMissingPlaceholder.tsx, apps/desktop/src/renderer/components/chat/InlineReferenceChip.tsx, apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx, apps/desktop/src/renderer/components/chat/JumpToBottomChip.tsx, apps/desktop/src/renderer/components/chat/MarkdownDiffBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownMermaidBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownRenderer.tsx, apps/desktop/src/renderer/components/chat/MermaidLightbox.tsx, apps/desktop/src/renderer/components/chat/MessageActionBar.tsx, apps/desktop/src/renderer/components/chat/MessageNavRail.tsx, apps/desktop/src/renderer/components/chat/MessageSourceLabels.tsx, apps/desktop/src/renderer/components/chat/MessageStream.tsx, apps/desktop/src/renderer/components/chat/MessageViewport.tsx, apps/desktop/src/renderer/components/chat/ModelLightbox.tsx, apps/desktop/src/renderer/components/chat/NewMessageIndicator.tsx, apps/desktop/src/renderer/components/chat/PlanReviewBubble.tsx, apps/desktop/src/renderer/components/chat/PrevMessageJumpChip.tsx, apps/desktop/src/renderer/components/chat/ProjectLinkChip.tsx, apps/desktop/src/renderer/components/chat/QuoteChip.tsx, apps/desktop/src/renderer/components/chat/RewindPreviewDialog.tsx, apps/desktop/src/renderer/components/chat/SelectionQuoteButton.tsx, apps/desktop/src/renderer/components/chat/SentAgentReferenceChip.tsx, apps/desktop/src/renderer/components/chat/SentInlineAtomBody.tsx, apps/desktop/src/renderer/components/chat/SessionHandoffCard.tsx, apps/desktop/src/renderer/components/chat/SessionLinkChip.tsx, apps/desktop/src/renderer/components/chat/ShareMessageCheckbox.tsx, apps/desktop/src/renderer/components/chat/ShareSelectionBar.tsx, apps/desktop/src/renderer/components/chat/SlackIcon.tsx, apps/desktop/src/renderer/components/chat/StreamFadeSpan.tsx, apps/desktop/src/renderer/components/chat/StreamingMarkdownChunk.tsx, apps/desktop/src/renderer/components/chat/SystemCard.tsx, apps/desktop/src/renderer/components/chat/TextLightbox.tsx, apps/desktop/src/renderer/components/chat/ThinkingCard.tsx, apps/desktop/src/renderer/components/chat/ThinkingText.tsx, apps/desktop/src/renderer/components/chat/TodoListCard.tsx, apps/desktop/src/renderer/components/chat/ToolCallCard.tsx, apps/desktop/src/renderer/components/chat/ToolPayloadLightbox.tsx, apps/desktop/src/renderer/components/chat/TopRightChipStack.tsx, apps/desktop/src/renderer/components/chat/TurnChangesCard.tsx, apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx, apps/desktop/src/renderer/components/chat/UpgradeBanner.tsx, apps/desktop/src/renderer/components/chat/UserAttachmentChip.tsx, apps/desktop/src/renderer/components/chat/UserMessage.tsx, apps/desktop/src/renderer/components/chat/UserMessageEditBox.tsx, apps/desktop/src/renderer/components/chat/UserMessageUrlLink.tsx, apps/desktop/src/renderer/components/chat/VideoLightbox.tsx, apps/desktop/src/renderer/components/chat/WorkGroupBlock.tsx, apps/desktop/src/renderer/components/chat/WorktreeRestoreBanner.tsx, apps/desktop/src/renderer/components/chat/XIcon.tsx, apps/desktop/src/renderer/components/chat/activityRowChrome.ts, apps/desktop/src/renderer/components/chat/animateFocusScroll.ts, apps/desktop/src/renderer/components/chat/autoFollowIntent.ts, apps/desktop/src/renderer/components/chat/chatChrome.ts, apps/desktop/src/renderer/components/chat/errorReasonI18n.ts, apps/desktop/src/renderer/components/chat/generatedFilesProjection.ts, apps/desktop/src/renderer/components/chat/imageDisplaySize.ts, apps/desktop/src/renderer/components/chat/lightboxAnnotations.ts, apps/desktop/src/renderer/components/chat/lightboxGestures.ts, apps/desktop/src/renderer/components/chat/markdownImageTargets.ts, apps/desktop/src/renderer/components/chat/markdownMedia.ts, apps/desktop/src/renderer/components/chat/messageNavRailModel.ts, apps/desktop/src/renderer/components/chat/messageNavRailWheel.ts, apps/desktop/src/renderer/components/chat/messageNavigationProjection.ts, apps/desktop/src/renderer/components/chat/messageProjectionCache.ts, apps/desktop/src/renderer/components/chat/messageStreamIndicatorPosition.ts, apps/desktop/src/renderer/components/chat/messageViewportCompensation.ts, apps/desktop/src/renderer/components/chat/messageViewportGeometry.ts, apps/desktop/src/renderer/components/chat/messageWorkGroups.ts, apps/desktop/src/renderer/components/chat/observeProgrammaticScroll.ts, apps/desktop/src/renderer/components/chat/rehypeFencedCodeMarker.ts, apps/desktop/src/renderer/components/chat/rehypeHighlightShared.ts, apps/desktop/src/renderer/components/chat/rehypeMathBlockMarker.ts, apps/desktop/src/renderer/components/chat/rehypeStreamWordFade.ts, apps/desktop/src/renderer/components/chat/remarkHtmlImages.ts, apps/desktop/src/renderer/components/chat/remarkLocalPathLinks.ts, apps/desktop/src/renderer/components/chat/remarkPreserveRawLocalDestinations.ts, apps/desktop/src/renderer/components/chat/remarkSessionLinks.ts, apps/desktop/src/renderer/components/chat/remarkStrictInlineMath.ts, apps/desktop/src/renderer/components/chat/remarkTruncateCjkUrls.ts, apps/desktop/src/renderer/components/chat/repairStreamingMarkdown.ts, apps/desktop/src/renderer/components/chat/scrollAnchoringDetect.ts, apps/desktop/src/renderer/components/chat/shareSelectionStore.ts, apps/desktop/src/renderer/components/chat/streamingMarkdownBlocks.tsx, apps/desktop/src/renderer/components/chat/streamingMarkdownChunks.ts, apps/desktop/src/renderer/components/chat/streamingMessageProjection.ts, apps/desktop/src/renderer/components/chat/toolLoopI18n.ts, apps/desktop/src/renderer/components/chat/unreadCount.ts, apps/desktop/src/renderer/components/chat/useAutomaticHistoryLoadBudget.ts, apps/desktop/src/renderer/components/chat/useCopyAsImage.tsx, apps/desktop/src/renderer/components/chat/useDeleteMessage.ts, apps/desktop/src/renderer/components/chat/useFileChipContextMenu.tsx, apps/desktop/src/renderer/components/chat/useForkAtMessage.ts, apps/desktop/src/renderer/components/chat/useImageClipboard.ts, apps/desktop/src/renderer/components/chat/useImageLoadFailure.ts, apps/desktop/src/renderer/components/chat/useMessageViewport.ts, apps/desktop/src/renderer/components/chat/useNavigationKeyListener.ts, apps/desktop/src/renderer/components/chat/useOpenWithMenu.tsx, apps/desktop/src/renderer/components/chat/usePrevUserMessageInView.ts, apps/desktop/src/renderer/components/chat/useTurnChangeSets.ts, apps/desktop/src/renderer/components/chat/userMessageCollapse.ts, apps/desktop/src/renderer/components/chat/userMessageDisplayText.ts, apps/desktop/src/renderer/components/chat/userMessageLinkify.ts, apps/desktop/src/renderer/components/chat/viewportFillDetect.ts, apps/desktop/src/renderer/components/new-chat/AddRemoteProjectDialog.tsx, apps/desktop/src/renderer/components/new-chat/AgentSelect.tsx, apps/desktop/src/renderer/components/new-chat/AskUserQuestionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/AtMentionPanel.tsx, apps/desktop/src/renderer/components/new-chat/AttachmentTypeThumb.tsx, apps/desktop/src/renderer/components/new-chat/ChatInput.tsx, apps/desktop/src/renderer/components/new-chat/CjkPunctDecoration.ts, apps/desktop/src/renderer/components/new-chat/CjkPunctuationUtils.ts, apps/desktop/src/renderer/components/new-chat/ComposerAttachments.tsx, apps/desktop/src/renderer/components/new-chat/ComposerListIndentDecoration.ts, apps/desktop/src/renderer/components/new-chat/ComposerListNodes.ts, apps/desktop/src/renderer/components/new-chat/ComposerQuoteNode.tsx, apps/desktop/src/renderer/components/new-chat/DeviceSwitcherPill.tsx, apps/desktop/src/renderer/components/new-chat/EffortSlider.tsx, apps/desktop/src/renderer/components/new-chat/EmptyDocSelectionGuard.ts, apps/desktop/src/renderer/components/new-chat/ExtraDirsButton.tsx, apps/desktop/src/renderer/components/new-chat/FastModeToggle.tsx, apps/desktop/src/renderer/components/new-chat/FolderPickerPopover.tsx, apps/desktop/src/renderer/components/new-chat/FullAccessConfirmContent.tsx, apps/desktop/src/renderer/components/new-chat/GhostCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/GoalAdvancedLimits.tsx, apps/desktop/src/renderer/components/new-chat/GoalIndicator.tsx, apps/desktop/src/renderer/components/new-chat/HomeUsageDashboard.tsx, apps/desktop/src/renderer/components/new-chat/ListComposerTextarea.tsx, apps/desktop/src/renderer/components/new-chat/LocalModelCatalogNotice.tsx, apps/desktop/src/renderer/components/new-chat/MentionChipNode.tsx, apps/desktop/src/renderer/components/new-chat/MentionDragCaretDecoration.ts, apps/desktop/src/renderer/components/new-chat/ModelCompatibilityNotice.tsx, apps/desktop/src/renderer/components/new-chat/ModelConfigFlyout.tsx, apps/desktop/src/renderer/components/new-chat/ModelHarnessPicker.tsx, apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx, apps/desktop/src/renderer/components/new-chat/ModelSourceDetails.tsx, apps/desktop/src/renderer/components/new-chat/NewGoalDialog.tsx, apps/desktop/src/renderer/components/new-chat/PastedTextChipNode.tsx, apps/desktop/src/renderer/components/new-chat/PendingQueuePanel.tsx, apps/desktop/src/renderer/components/new-chat/PermissionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PermissionSelector.tsx, apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx, apps/desktop/src/renderer/components/new-chat/PlanActionCard.tsx, apps/desktop/src/renderer/components/new-chat/PlanModeIndicator.tsx, apps/desktop/src/renderer/components/new-chat/PlanViewerCard.tsx, apps/desktop/src/renderer/components/new-chat/PluginConnectionForm.tsx, apps/desktop/src/renderer/components/new-chat/PluginOauthDeviceCode.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupRemoteDesktopButton.tsx, apps/desktop/src/renderer/components/new-chat/PluginWriteAccessRecovery.tsx, apps/desktop/src/renderer/components/new-chat/QuickStartPillMark.ts, apps/desktop/src/renderer/components/new-chat/RemoteOauthSetupCard.tsx, apps/desktop/src/renderer/components/new-chat/SendButton.tsx, apps/desktop/src/renderer/components/new-chat/SlashCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/SlashCommandPalette.tsx, apps/desktop/src/renderer/components/new-chat/TakeoverMask.tsx, apps/desktop/src/renderer/components/new-chat/ThinkingToggle.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedFlyoutHost.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelPanel.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRail.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRow.tsx, apps/desktop/src/renderer/components/new-chat/UsageDailyBars.tsx, apps/desktop/src/renderer/components/new-chat/UsageHeatmap.tsx, apps/desktop/src/renderer/components/new-chat/VendorSegmentedSwitcher.tsx, apps/desktop/src/renderer/components/new-chat/VoiceInputDraftDecoration.ts, apps/desktop/src/renderer/components/new-chat/WindowsSelectionReplacement.ts, apps/desktop/src/renderer/components/new-chat/WorktreeChipsRow.tsx, apps/desktop/src/renderer/components/new-chat/WorktreeCreatingOverlay.tsx, apps/desktop/src/renderer/components/new-chat/agentOptions.ts, apps/desktop/src/renderer/components/new-chat/agentSwitchConfirmation.ts, apps/desktop/src/renderer/components/new-chat/branchPick.ts, apps/desktop/src/renderer/components/new-chat/composerBlankPointerFocus.ts, apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts, apps/desktop/src/renderer/components/new-chat/composerDocState.ts, apps/desktop/src/renderer/components/new-chat/composerFrameScheduler.ts, apps/desktop/src/renderer/components/new-chat/composerHistoryProjection.ts, apps/desktop/src/renderer/components/new-chat/composerModelSelection.ts, apps/desktop/src/renderer/components/new-chat/composerPromptRecommendation.ts, apps/desktop/src/renderer/components/new-chat/composerRenderGate.ts, apps/desktop/src/renderer/components/new-chat/composerSendOwnership.ts, apps/desktop/src/renderer/components/new-chat/composerSendSnapshot.ts, apps/desktop/src/renderer/components/new-chat/effortChangeQueue.ts, apps/desktop/src/renderer/components/new-chat/extraDirsActions.ts, apps/desktop/src/renderer/components/new-chat/ghostComposerPlacement.ts, apps/desktop/src/renderer/components/new-chat/localAttachmentPicker.ts, apps/desktop/src/renderer/components/new-chat/mentionChipInsertion.ts, apps/desktop/src/renderer/components/new-chat/modelWindowErrorToast.ts, apps/desktop/src/renderer/components/new-chat/pastePipeline.ts, apps/desktop/src/renderer/components/new-chat/pathPaste.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueLocks.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowActivity.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowPresentation.ts, apps/desktop/src/renderer/components/new-chat/planModeComposerCommand.ts, apps/desktop/src/renderer/components/new-chat/priceTierMarks.tsx, apps/desktop/src/renderer/components/new-chat/remoteBrowseAdapters.ts, apps/desktop/src/renderer/components/new-chat/remoteExistingProjects.ts, apps/desktop/src/renderer/components/new-chat/restoreComposerDocument.ts, apps/desktop/src/renderer/components/new-chat/sessionLinkPaste.ts, apps/desktop/src/renderer/components/new-chat/sourceSwitch.ts, apps/desktop/src/renderer/components/new-chat/unifiedModelSelection.ts, apps/desktop/src/renderer/components/new-chat/usagePalette.ts, apps/desktop/src/renderer/components/new-chat/useComposerSendFocusRestore.ts, apps/desktop/src/renderer/components/new-chat/useModelDiscoveryPending.ts, apps/desktop/src/renderer/components/new-chat/useProviderWeeklyQuota.ts, apps/desktop/src/renderer/components/new-chat/useUnifiedRowActions.ts, apps/desktop/src/renderer/features/bots/BotAuthorizationCard.tsx, apps/desktop/src/renderer/features/bots/BotAvatar.tsx, apps/desktop/src/renderer/features/bots/BotBasicProfileFields.tsx, apps/desktop/src/renderer/features/bots/BotCapabilitySettings.tsx, apps/desktop/src/renderer/features/bots/BotCollaborationCard.tsx, apps/desktop/src/renderer/features/bots/BotConnectionStatus.tsx, apps/desktop/src/renderer/features/bots/BotCreateMenu.tsx, apps/desktop/src/renderer/features/bots/BotDeleteDialog.tsx, apps/desktop/src/renderer/features/bots/BotDirectMessageCard.tsx, apps/desktop/src/renderer/features/bots/BotDirectMessageView.tsx, apps/desktop/src/renderer/features/bots/BotFollowMark.tsx, apps/desktop/src/renderer/features/bots/BotGenerationLabel.tsx, apps/desktop/src/renderer/features/bots/BotGroupAvatars.tsx, apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx, apps/desktop/src/renderer/features/bots/BotGroupComposer.tsx, apps/desktop/src/renderer/features/bots/BotGroupCreateDialog.tsx, apps/desktop/src/renderer/features/bots/BotGroupPendingInteraction.tsx, apps/desktop/src/renderer/features/bots/BotGroupPlan.tsx, apps/desktop/src/renderer/features/bots/BotGroupSettingsDrawer.tsx, apps/desktop/src/renderer/features/bots/BotGroupSidebarRow.tsx, apps/desktop/src/renderer/features/bots/BotHistorySessionView.tsx, apps/desktop/src/renderer/features/bots/BotImportForm.tsx, apps/desktop/src/renderer/features/bots/BotInvitationWelcome.tsx, apps/desktop/src/renderer/features/bots/BotLearningFooter.tsx, apps/desktop/src/renderer/features/bots/BotLifecycleSettings.tsx, apps/desktop/src/renderer/features/bots/BotMemorySettings.tsx, apps/desktop/src/renderer/features/bots/BotModelChainEditor.tsx, apps/desktop/src/renderer/features/bots/BotPortraitPicker.tsx, apps/desktop/src/renderer/features/bots/BotRosterView.tsx, apps/desktop/src/renderer/features/bots/BotRoutines.tsx, apps/desktop/src/renderer/features/bots/BotSessionContentHeader.tsx, apps/desktop/src/renderer/features/bots/BotSessionTaskLink.tsx, apps/desktop/src/renderer/features/bots/BotSessionTaskResultCard.tsx, apps/desktop/src/renderer/features/bots/BotSessionView.tsx, apps/desktop/src/renderer/features/bots/BotSettingsBlock.tsx, apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx, apps/desktop/src/renderer/features/bots/BotTaskCardHeader.tsx, apps/desktop/src/renderer/features/bots/BotTaskModelEditor.tsx, apps/desktop/src/renderer/features/bots/BotWorkbench.tsx, apps/desktop/src/renderer/features/bots/BotWorkingStatus.tsx, apps/desktop/src/renderer/features/bots/BotsFeatureLayout.tsx, apps/desktop/src/renderer/features/bots/BotsGlobalSettingsSection.tsx, apps/desktop/src/renderer/features/bots/BotsHomeView.tsx, apps/desktop/src/renderer/features/bots/BotsListView.tsx, apps/desktop/src/renderer/features/bots/BotsSidebar.tsx, apps/desktop/src/renderer/features/bots/ChatBotAccessField.tsx, apps/desktop/src/renderer/features/bots/ChatGroupSettings.tsx, apps/desktop/src/renderer/features/bots/ChatInviteDialog.tsx, apps/desktop/src/renderer/features/bots/ChatInviteHost.tsx, apps/desktop/src/renderer/features/bots/ChatServerControls.tsx, apps/desktop/src/renderer/features/bots/ChatThreadPanel.tsx, apps/desktop/src/renderer/features/bots/CindyDevicePicker.tsx, apps/desktop/src/renderer/features/bots/CindyDeviceRow.tsx, apps/desktop/src/renderer/features/bots/RemoteBotSessionView.tsx, apps/desktop/src/renderer/features/bots/RemoteBotSettings.tsx, apps/desktop/src/renderer/features/bots/WorkbenchSessionList.tsx, apps/desktop/src/renderer/features/bots/botAvatarIdentity.ts, apps/desktop/src/renderer/features/bots/botCapabilityDefaults.ts, apps/desktop/src/renderer/features/bots/botChatPresentation.ts, apps/desktop/src/renderer/features/bots/botConversationPresentation.ts, apps/desktop/src/renderer/features/bots/botConversationTimeline.ts, apps/desktop/src/renderer/features/bots/botDelegationLive.ts, apps/desktop/src/renderer/features/bots/botFollowScopes.ts, apps/desktop/src/renderer/features/bots/botGeneratedArtifacts.ts, apps/desktop/src/renderer/features/bots/botGroupAttachments.ts, apps/desktop/src/renderer/features/bots/botGroupLane.ts, apps/desktop/src/renderer/features/bots/botGroupMentions.ts, apps/desktop/src/renderer/features/bots/botGroupPresentation.ts, apps/desktop/src/renderer/features/bots/botGroupStore.ts, apps/desktop/src/renderer/features/bots/botListDisplay.ts, apps/desktop/src/renderer/features/bots/botNavigation.ts, apps/desktop/src/renderer/features/bots/botPronounContext.tsx, apps/desktop/src/renderer/features/bots/botReadState.ts, apps/desktop/src/renderer/features/bots/botRosterDisplay.ts, apps/desktop/src/renderer/features/bots/botSessionOwners.ts, apps/desktop/src/renderer/features/bots/botSettingsAutosave.ts, apps/desktop/src/renderer/features/bots/botStore.ts, apps/desktop/src/renderer/features/bots/botWelcomeContext.ts, apps/desktop/src/renderer/features/bots/botWorkbenchProjection.ts, apps/desktop/src/renderer/features/bots/chatError.ts, apps/desktop/src/renderer/features/bots/cindyDeviceRoster.ts, apps/desktop/src/renderer/features/bots/remoteBotRoster.ts, apps/desktop/src/renderer/features/bots/remoteBotSettingsData.ts, apps/desktop/src/renderer/features/bots/useBotGeneratedFileDeliveries.ts, apps/desktop/src/renderer/features/bots/useBotIslandVisibleSession.ts, apps/desktop/src/renderer/features/bots/useBotSettingsAutosave.ts, apps/desktop/src/renderer/features/bots/useBotUnreadSync.ts, apps/desktop/src/renderer/features/bots/useRemoteBots.ts, apps/desktop/src/renderer/features/bots/useWorkbenchSessionPages.ts, apps/desktop/src/renderer/features/bots/useWorkingStatusCopy.ts, apps/desktop/src/renderer/features/cc-agent/CCAgentFeatureLayout.tsx, apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx | 277 | 38 | 468 |+| `desktop.bots` | desktop | 伙伴(列表 / 对话 / 设置 / 历史 / 伙伴私聊 / 群聊) | hash `/bots`、`/bots/list`、`/bots/:botId`、`/bots/roster` 及伙伴当前/历史任务、伙伴私聊、伙伴群聊路由(BotsFeatureLayout) | BotBasicProfileFields, BotCollaborationCard, BotDirectMessageView, BotGroupChatView, BotGroupCreateDialog, BotGroupSettingsDrawer, BotHistorySessionView, BotLifecycleSettings, BotModelChainEditor, BotRosterView, BotSessionView, BotSettingsDrawer, BotsHomeView, BotsListView, RemoteBotSessionView | apps/desktop/src/renderer/components/chat/AgentActionRow.tsx, apps/desktop/src/renderer/components/chat/AgentActionsBlock.tsx, apps/desktop/src/renderer/components/chat/AgentOnOtherDeviceContext.tsx, apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx, apps/desktop/src/renderer/components/chat/AgentTaskLiveDetails.tsx, apps/desktop/src/renderer/components/chat/AnnotationStrokesSvg.tsx, apps/desktop/src/renderer/components/chat/AskUserQuestionBubble.tsx, apps/desktop/src/renderer/components/chat/AssistantMessage.tsx, apps/desktop/src/renderer/components/chat/AutomationOriginBadge.tsx, apps/desktop/src/renderer/components/chat/ChatAudioCard.tsx, apps/desktop/src/renderer/components/chat/ChatDisplaySnapshotContext.tsx, apps/desktop/src/renderer/components/chat/ChatImageView.tsx, apps/desktop/src/renderer/components/chat/ChatSessionFileContext.tsx, apps/desktop/src/renderer/components/chat/ChatSoundEffectCard.tsx, apps/desktop/src/renderer/components/chat/ChatVideoView.tsx, apps/desktop/src/renderer/components/chat/CindyMakeDoctorCard.tsx, apps/desktop/src/renderer/components/chat/CopyAsImageBlock.tsx, apps/desktop/src/renderer/components/chat/CredentialSwitchWaitBanner.tsx, apps/desktop/src/renderer/components/chat/DiffView.tsx, apps/desktop/src/renderer/components/chat/ErrorBanner.tsx, apps/desktop/src/renderer/components/chat/ErrorMessageCard.tsx, apps/desktop/src/renderer/components/chat/GeneratedFilesCard.tsx, apps/desktop/src/renderer/components/chat/GhostCardHostPrompts.tsx, apps/desktop/src/renderer/components/chat/GhostSummonCard.tsx, apps/desktop/src/renderer/components/chat/GhostToolCard.tsx, apps/desktop/src/renderer/components/chat/HookTaskCard.tsx, apps/desktop/src/renderer/components/chat/ImageGalleryContext.tsx, apps/desktop/src/renderer/components/chat/ImageHoverPreview.tsx, apps/desktop/src/renderer/components/chat/ImageLightbox.tsx, apps/desktop/src/renderer/components/chat/ImageMissingPlaceholder.tsx, apps/desktop/src/renderer/components/chat/InlineReferenceChip.tsx, apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx, apps/desktop/src/renderer/components/chat/JumpToBottomChip.tsx, apps/desktop/src/renderer/components/chat/MarkdownDiffBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownMermaidBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownRenderer.tsx, apps/desktop/src/renderer/components/chat/MermaidLightbox.tsx, apps/desktop/src/renderer/components/chat/MessageActionBar.tsx, apps/desktop/src/renderer/components/chat/MessageNavRail.tsx, apps/desktop/src/renderer/components/chat/MessageSourceLabels.tsx, apps/desktop/src/renderer/components/chat/MessageStream.tsx, apps/desktop/src/renderer/components/chat/MessageViewport.tsx, apps/desktop/src/renderer/components/chat/ModelLightbox.tsx, apps/desktop/src/renderer/components/chat/NewMessageIndicator.tsx, apps/desktop/src/renderer/components/chat/PlanReviewBubble.tsx, apps/desktop/src/renderer/components/chat/PrevMessageJumpChip.tsx, apps/desktop/src/renderer/components/chat/ProjectLinkChip.tsx, apps/desktop/src/renderer/components/chat/QuoteChip.tsx, apps/desktop/src/renderer/components/chat/RewindPreviewDialog.tsx, apps/desktop/src/renderer/components/chat/SelectionQuoteButton.tsx, apps/desktop/src/renderer/components/chat/SentAgentReferenceChip.tsx, apps/desktop/src/renderer/components/chat/SentInlineAtomBody.tsx, apps/desktop/src/renderer/components/chat/SessionHandoffCard.tsx, apps/desktop/src/renderer/components/chat/SessionLinkChip.tsx, apps/desktop/src/renderer/components/chat/ShareMessageCheckbox.tsx, apps/desktop/src/renderer/components/chat/ShareSelectionBar.tsx, apps/desktop/src/renderer/components/chat/SlackIcon.tsx, apps/desktop/src/renderer/components/chat/StreamFadeSpan.tsx, apps/desktop/src/renderer/components/chat/StreamingMarkdownChunk.tsx, apps/desktop/src/renderer/components/chat/SystemCard.tsx, apps/desktop/src/renderer/components/chat/TextLightbox.tsx, apps/desktop/src/renderer/components/chat/ThinkingCard.tsx, apps/desktop/src/renderer/components/chat/ThinkingText.tsx, apps/desktop/src/renderer/components/chat/TodoListCard.tsx, apps/desktop/src/renderer/components/chat/ToolCallCard.tsx, apps/desktop/src/renderer/components/chat/ToolPayloadLightbox.tsx, apps/desktop/src/renderer/components/chat/TopRightChipStack.tsx, apps/desktop/src/renderer/components/chat/TurnChangesCard.tsx, apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx, apps/desktop/src/renderer/components/chat/UpgradeBanner.tsx, apps/desktop/src/renderer/components/chat/UserAttachmentChip.tsx, apps/desktop/src/renderer/components/chat/UserMessage.tsx, apps/desktop/src/renderer/components/chat/UserMessageEditBox.tsx, apps/desktop/src/renderer/components/chat/UserMessageUrlLink.tsx, apps/desktop/src/renderer/components/chat/VideoLightbox.tsx, apps/desktop/src/renderer/components/chat/WorkGroupBlock.tsx, apps/desktop/src/renderer/components/chat/WorktreeRestoreBanner.tsx, apps/desktop/src/renderer/components/chat/XIcon.tsx, apps/desktop/src/renderer/components/chat/activityRowChrome.ts, apps/desktop/src/renderer/components/chat/animateFocusScroll.ts, apps/desktop/src/renderer/components/chat/autoFollowIntent.ts, apps/desktop/src/renderer/components/chat/chatChrome.ts, apps/desktop/src/renderer/components/chat/errorReasonI18n.ts, apps/desktop/src/renderer/components/chat/generatedFilesProjection.ts, apps/desktop/src/renderer/components/chat/imageDisplaySize.ts, apps/desktop/src/renderer/components/chat/lightboxAnnotations.ts, apps/desktop/src/renderer/components/chat/lightboxGestures.ts, apps/desktop/src/renderer/components/chat/markdownImageTargets.ts, apps/desktop/src/renderer/components/chat/markdownMedia.ts, apps/desktop/src/renderer/components/chat/messageNavRailModel.ts, apps/desktop/src/renderer/components/chat/messageNavRailWheel.ts, apps/desktop/src/renderer/components/chat/messageNavigationProjection.ts, apps/desktop/src/renderer/components/chat/messageProjectionCache.ts, apps/desktop/src/renderer/components/chat/messageStreamIndicatorPosition.ts, apps/desktop/src/renderer/components/chat/messageViewportCompensation.ts, apps/desktop/src/renderer/components/chat/messageViewportGeometry.ts, apps/desktop/src/renderer/components/chat/messageWorkGroups.ts, apps/desktop/src/renderer/components/chat/observeProgrammaticScroll.ts, apps/desktop/src/renderer/components/chat/rehypeFencedCodeMarker.ts, apps/desktop/src/renderer/components/chat/rehypeHighlightShared.ts, apps/desktop/src/renderer/components/chat/rehypeMathBlockMarker.ts, apps/desktop/src/renderer/components/chat/rehypeStreamWordFade.ts, apps/desktop/src/renderer/components/chat/remarkHtmlImages.ts, apps/desktop/src/renderer/components/chat/remarkLocalPathLinks.ts, apps/desktop/src/renderer/components/chat/remarkPreserveRawLocalDestinations.ts, apps/desktop/src/renderer/components/chat/remarkSessionLinks.ts, apps/desktop/src/renderer/components/chat/remarkStrictInlineMath.ts, apps/desktop/src/renderer/components/chat/remarkTruncateCjkUrls.ts, apps/desktop/src/renderer/components/chat/repairStreamingMarkdown.ts, apps/desktop/src/renderer/components/chat/scrollAnchoringDetect.ts, apps/desktop/src/renderer/components/chat/shareSelectionStore.ts, apps/desktop/src/renderer/components/chat/streamingMarkdownBlocks.tsx, apps/desktop/src/renderer/components/chat/streamingMarkdownChunks.ts, apps/desktop/src/renderer/components/chat/streamingMessageProjection.ts, apps/desktop/src/renderer/components/chat/toolLoopI18n.ts, apps/desktop/src/renderer/components/chat/unreadCount.ts, apps/desktop/src/renderer/components/chat/useAutomaticHistoryLoadBudget.ts, apps/desktop/src/renderer/components/chat/useCopyAsImage.tsx, apps/desktop/src/renderer/components/chat/useDeleteMessage.ts, apps/desktop/src/renderer/components/chat/useFileChipContextMenu.tsx, apps/desktop/src/renderer/components/chat/useForkAtMessage.ts, apps/desktop/src/renderer/components/chat/useImageClipboard.ts, apps/desktop/src/renderer/components/chat/useImageLoadFailure.ts, apps/desktop/src/renderer/components/chat/useMessageViewport.ts, apps/desktop/src/renderer/components/chat/useNavigationKeyListener.ts, apps/desktop/src/renderer/components/chat/useOpenWithMenu.tsx, apps/desktop/src/renderer/components/chat/usePrevUserMessageInView.ts, apps/desktop/src/renderer/components/chat/useTurnChangeSets.ts, apps/desktop/src/renderer/components/chat/userMessageCollapse.ts, apps/desktop/src/renderer/components/chat/userMessageDisplayText.ts, apps/desktop/src/renderer/components/chat/userMessageLinkify.ts, apps/desktop/src/renderer/components/chat/viewportFillDetect.ts, apps/desktop/src/renderer/components/new-chat/AddRemoteProjectDialog.tsx, apps/desktop/src/renderer/components/new-chat/AgentSelect.tsx, apps/desktop/src/renderer/components/new-chat/AskUserQuestionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/AtMentionPanel.tsx, apps/desktop/src/renderer/components/new-chat/AttachmentTypeThumb.tsx, apps/desktop/src/renderer/components/new-chat/ChatInput.tsx, apps/desktop/src/renderer/components/new-chat/CjkPunctDecoration.ts, apps/desktop/src/renderer/components/new-chat/CjkPunctuationUtils.ts, apps/desktop/src/renderer/components/new-chat/ComposerAttachments.tsx, apps/desktop/src/renderer/components/new-chat/ComposerListIndentDecoration.ts, apps/desktop/src/renderer/components/new-chat/ComposerListNodes.ts, apps/desktop/src/renderer/components/new-chat/ComposerQuoteNode.tsx, apps/desktop/src/renderer/components/new-chat/DeviceSwitcherPill.tsx, apps/desktop/src/renderer/components/new-chat/EffortSlider.tsx, apps/desktop/src/renderer/components/new-chat/EmptyDocSelectionGuard.ts, apps/desktop/src/renderer/components/new-chat/ExtraDirsButton.tsx, apps/desktop/src/renderer/components/new-chat/FastModeToggle.tsx, apps/desktop/src/renderer/components/new-chat/FolderPickerPopover.tsx, apps/desktop/src/renderer/components/new-chat/FullAccessConfirmContent.tsx, apps/desktop/src/renderer/components/new-chat/GhostCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/GoalAdvancedLimits.tsx, apps/desktop/src/renderer/components/new-chat/GoalIndicator.tsx, apps/desktop/src/renderer/components/new-chat/HomeUsageDashboard.tsx, apps/desktop/src/renderer/components/new-chat/ListComposerTextarea.tsx, apps/desktop/src/renderer/components/new-chat/LocalModelCatalogNotice.tsx, apps/desktop/src/renderer/components/new-chat/MentionChipNode.tsx, apps/desktop/src/renderer/components/new-chat/MentionDragCaretDecoration.ts, apps/desktop/src/renderer/components/new-chat/ModelCompatibilityNotice.tsx, apps/desktop/src/renderer/components/new-chat/ModelConfigFlyout.tsx, apps/desktop/src/renderer/components/new-chat/ModelHarnessPicker.tsx, apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx, apps/desktop/src/renderer/components/new-chat/ModelSourceDetails.tsx, apps/desktop/src/renderer/components/new-chat/NewGoalDialog.tsx, apps/desktop/src/renderer/components/new-chat/PastedTextChipNode.tsx, apps/desktop/src/renderer/components/new-chat/PendingQueuePanel.tsx, apps/desktop/src/renderer/components/new-chat/PermissionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PermissionSelector.tsx, apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx, apps/desktop/src/renderer/components/new-chat/PlanActionCard.tsx, apps/desktop/src/renderer/components/new-chat/PlanModeIndicator.tsx, apps/desktop/src/renderer/components/new-chat/PlanViewerCard.tsx, apps/desktop/src/renderer/components/new-chat/PluginConnectionForm.tsx, apps/desktop/src/renderer/components/new-chat/PluginOauthDeviceCode.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupRemoteDesktopButton.tsx, apps/desktop/src/renderer/components/new-chat/PluginWriteAccessRecovery.tsx, apps/desktop/src/renderer/components/new-chat/QuickStartPillMark.ts, apps/desktop/src/renderer/components/new-chat/RemoteOauthSetupCard.tsx, apps/desktop/src/renderer/components/new-chat/SendButton.tsx, apps/desktop/src/renderer/components/new-chat/SlashCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/SlashCommandPalette.tsx, apps/desktop/src/renderer/components/new-chat/TakeoverMask.tsx, apps/desktop/src/renderer/components/new-chat/ThinkingToggle.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedFlyoutHost.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelPanel.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRail.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRow.tsx, apps/desktop/src/renderer/components/new-chat/UsageDailyBars.tsx, apps/desktop/src/renderer/components/new-chat/UsageHeatmap.tsx, apps/desktop/src/renderer/components/new-chat/VendorSegmentedSwitcher.tsx, apps/desktop/src/renderer/components/new-chat/VoiceInputDraftDecoration.ts, apps/desktop/src/renderer/components/new-chat/WindowsSelectionReplacement.ts, apps/desktop/src/renderer/components/new-chat/WorktreeChipsRow.tsx, apps/desktop/src/renderer/components/new-chat/WorktreeCreatingOverlay.tsx, apps/desktop/src/renderer/components/new-chat/agentOptions.ts, apps/desktop/src/renderer/components/new-chat/agentSwitchConfirmation.ts, apps/desktop/src/renderer/components/new-chat/branchPick.ts, apps/desktop/src/renderer/components/new-chat/composerBlankPointerFocus.ts, apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts, apps/desktop/src/renderer/components/new-chat/composerDocState.ts, apps/desktop/src/renderer/components/new-chat/composerFrameScheduler.ts, apps/desktop/src/renderer/components/new-chat/composerHistoryProjection.ts, apps/desktop/src/renderer/components/new-chat/composerModelSelection.ts, apps/desktop/src/renderer/components/new-chat/composerPromptRecommendation.ts, apps/desktop/src/renderer/components/new-chat/composerRenderGate.ts, apps/desktop/src/renderer/components/new-chat/composerSendOwnership.ts, apps/desktop/src/renderer/components/new-chat/composerSendSnapshot.ts, apps/desktop/src/renderer/components/new-chat/effortChangeQueue.ts, apps/desktop/src/renderer/components/new-chat/extraDirsActions.ts, apps/desktop/src/renderer/components/new-chat/ghostComposerPlacement.ts, apps/desktop/src/renderer/components/new-chat/localAttachmentPicker.ts, apps/desktop/src/renderer/components/new-chat/mentionChipInsertion.ts, apps/desktop/src/renderer/components/new-chat/modelWindowErrorToast.ts, apps/desktop/src/renderer/components/new-chat/pastePipeline.ts, apps/desktop/src/renderer/components/new-chat/pathPaste.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueLocks.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowActivity.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowPresentation.ts, apps/desktop/src/renderer/components/new-chat/planModeComposerCommand.ts, apps/desktop/src/renderer/components/new-chat/priceTierMarks.tsx, apps/desktop/src/renderer/components/new-chat/remoteBrowseAdapters.ts, apps/desktop/src/renderer/components/new-chat/remoteExistingProjects.ts, apps/desktop/src/renderer/components/new-chat/restoreComposerDocument.ts, apps/desktop/src/renderer/components/new-chat/sessionLinkPaste.ts, apps/desktop/src/renderer/components/new-chat/sourceSwitch.ts, apps/desktop/src/renderer/components/new-chat/unifiedModelSelection.ts, apps/desktop/src/renderer/components/new-chat/usagePalette.ts, apps/desktop/src/renderer/components/new-chat/useComposerSendFocusRestore.ts, apps/desktop/src/renderer/components/new-chat/useModelDiscoveryPending.ts, apps/desktop/src/renderer/components/new-chat/useProviderWeeklyQuota.ts, apps/desktop/src/renderer/components/new-chat/useUnifiedRowActions.ts, apps/desktop/src/renderer/features/bots/BotAuthorizationCard.tsx, apps/desktop/src/renderer/features/bots/BotAvatar.tsx, apps/desktop/src/renderer/features/bots/BotBasicProfileFields.tsx, apps/desktop/src/renderer/features/bots/BotCapabilitySettings.tsx, apps/desktop/src/renderer/features/bots/BotCollaborationCard.tsx, apps/desktop/src/renderer/features/bots/BotConnectionStatus.tsx, apps/desktop/src/renderer/features/bots/BotCreateMenu.tsx, apps/desktop/src/renderer/features/bots/BotDeleteDialog.tsx, apps/desktop/src/renderer/features/bots/BotDirectMessageCard.tsx, apps/desktop/src/renderer/features/bots/BotDirectMessageView.tsx, apps/desktop/src/renderer/features/bots/BotFollowMark.tsx, apps/desktop/src/renderer/features/bots/BotGenerationLabel.tsx, apps/desktop/src/renderer/features/bots/BotGroupAvatars.tsx, apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx, apps/desktop/src/renderer/features/bots/BotGroupComposer.tsx, apps/desktop/src/renderer/features/bots/BotGroupCreateDialog.tsx, apps/desktop/src/renderer/features/bots/BotGroupPendingInteraction.tsx, apps/desktop/src/renderer/features/bots/BotGroupPlan.tsx, apps/desktop/src/renderer/features/bots/BotGroupRuntimeFailureNotice.tsx, apps/desktop/src/renderer/features/bots/BotGroupSettingsDrawer.tsx, apps/desktop/src/renderer/features/bots/BotGroupSidebarRow.tsx, apps/desktop/src/renderer/features/bots/BotHistorySessionView.tsx, apps/desktop/src/renderer/features/bots/BotImportForm.tsx, apps/desktop/src/renderer/features/bots/BotInvitationWelcome.tsx, apps/desktop/src/renderer/features/bots/BotLearningFooter.tsx, apps/desktop/src/renderer/features/bots/BotLifecycleSettings.tsx, apps/desktop/src/renderer/features/bots/BotMemorySettings.tsx, apps/desktop/src/renderer/features/bots/BotModelChainEditor.tsx, apps/desktop/src/renderer/features/bots/BotPortraitPicker.tsx, apps/desktop/src/renderer/features/bots/BotRosterView.tsx, apps/desktop/src/renderer/features/bots/BotRoutines.tsx, apps/desktop/src/renderer/features/bots/BotSessionContentHeader.tsx, apps/desktop/src/renderer/features/bots/BotSessionTaskLink.tsx, apps/desktop/src/renderer/features/bots/BotSessionTaskResultCard.tsx, apps/desktop/src/renderer/features/bots/BotSessionView.tsx, apps/desktop/src/renderer/features/bots/BotSettingsBlock.tsx, apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx, apps/desktop/src/renderer/features/bots/BotTaskCardHeader.tsx, apps/desktop/src/renderer/features/bots/BotTaskModelEditor.tsx, apps/desktop/src/renderer/features/bots/BotWorkbench.tsx, apps/desktop/src/renderer/features/bots/BotWorkingStatus.tsx, apps/desktop/src/renderer/features/bots/BotsFeatureLayout.tsx, apps/desktop/src/renderer/features/bots/BotsGlobalSettingsSection.tsx, apps/desktop/src/renderer/features/bots/BotsHomeView.tsx, apps/desktop/src/renderer/features/bots/BotsListView.tsx, apps/desktop/src/renderer/features/bots/BotsSidebar.tsx, apps/desktop/src/renderer/features/bots/ChatBotAccessField.tsx, apps/desktop/src/renderer/features/bots/ChatGroupSettings.tsx, apps/desktop/src/renderer/features/bots/ChatInviteDialog.tsx, apps/desktop/src/renderer/features/bots/ChatInviteHost.tsx, apps/desktop/src/renderer/features/bots/ChatServerControls.tsx, apps/desktop/src/renderer/features/bots/ChatThreadPanel.tsx, apps/desktop/src/renderer/features/bots/CindyDevicePicker.tsx, apps/desktop/src/renderer/features/bots/CindyDeviceRow.tsx, apps/desktop/src/renderer/features/bots/RemoteBotSessionView.tsx, apps/desktop/src/renderer/features/bots/RemoteBotSettings.tsx, apps/desktop/src/renderer/features/bots/WorkbenchSessionList.tsx, apps/desktop/src/renderer/features/bots/botAvatarIdentity.ts, apps/desktop/src/renderer/features/bots/botCapabilityDefaults.ts, apps/desktop/src/renderer/features/bots/botChatPresentation.ts, apps/desktop/src/renderer/features/bots/botConversationPresentation.ts, apps/desktop/src/renderer/features/bots/botConversationTimeline.ts, apps/desktop/src/renderer/features/bots/botDelegationLive.ts, apps/desktop/src/renderer/features/bots/botFollowScopes.ts, apps/desktop/src/renderer/features/bots/botGeneratedArtifacts.ts, apps/desktop/src/renderer/features/bots/botGroupAttachments.ts, apps/desktop/src/renderer/features/bots/botGroupLane.ts, apps/desktop/src/renderer/features/bots/botGroupMentions.ts, apps/desktop/src/renderer/features/bots/botGroupPresentation.ts, apps/desktop/src/renderer/features/bots/botGroupStore.ts, apps/desktop/src/renderer/features/bots/botListDisplay.ts, apps/desktop/src/renderer/features/bots/botNavigation.ts, apps/desktop/src/renderer/features/bots/botPronounContext.tsx, apps/desktop/src/renderer/features/bots/botReadState.ts, apps/desktop/src/renderer/features/bots/botRosterDisplay.ts, apps/desktop/src/renderer/features/bots/botSessionOwners.ts, apps/desktop/src/renderer/features/bots/botSettingsAutosave.ts, apps/desktop/src/renderer/features/bots/botStore.ts, apps/desktop/src/renderer/features/bots/botWelcomeContext.ts, apps/desktop/src/renderer/features/bots/botWorkbenchProjection.ts, apps/desktop/src/renderer/features/bots/chatError.ts, apps/desktop/src/renderer/features/bots/cindyDeviceRoster.ts, apps/desktop/src/renderer/features/bots/remoteBotRoster.ts, apps/desktop/src/renderer/features/bots/remoteBotSettingsData.ts, apps/desktop/src/renderer/features/bots/useBotGeneratedFileDeliveries.ts, apps/desktop/src/renderer/features/bots/useBotIslandVisibleSession.ts, apps/desktop/src/renderer/features/bots/useBotSettingsAutosave.ts, apps/desktop/src/renderer/features/bots/useBotUnreadSync.ts, apps/desktop/src/renderer/features/bots/useRemoteBots.ts, apps/desktop/src/renderer/features/bots/useWorkbenchSessionPages.ts, apps/desktop/src/renderer/features/bots/useWorkingStatusCopy.ts, apps/desktop/src/renderer/features/cc-agent/CCAgentFeatureLayout.tsx, apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx | 277 | 38 | 468 || `desktop.chat.files` | desktop | 工作目录文件浏览 | hash `/cc-agent/files/:sessionId`(WorkdirBrowseRoute) | FileBodyView, FileTreeView, WorkdirBrowseRoute | apps/desktop/src/renderer/features/cc-agent/workdir-browse/DocSearchBar.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/DrawioPreview.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileBodyView.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileFilterInput.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileTabsBar.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileTreeView.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FilterResultList.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/ImagePreview.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/OpenInSystemActions.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/PdfPreview.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/SessionTabsBar.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/UnrenderablePlaceholder.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/WorkdirBrowseRoute.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/WorkdirBrowseSidebar.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useChatRailCollapsed.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useChatRailResize.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useConfirmSwitchAwayIfDirty.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useDelayedFlag.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useFileContent.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useFileTree.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useOpenTabs.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useProjectFileList.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useRevealFileInTree.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/activeFileBodyHandle.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/docModeSwitchProjects.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/drawioExt.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/expandedStore.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileContentCache.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileIcon.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileMeta.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileScrollStore.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileSelectionParams.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/filterFiles.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/imageExt.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/markdownAutosave.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/openTabsStore.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/pdfExt.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/selectedFileStore.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/search/SearchInput.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/search/SearchPanel.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/search/SearchResults.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/search/hooks/useProjectSearch.ts | 17 | 7 | 45 || `desktop.chat.new-draft` | desktop | 新建任务草稿页 | hash `/cc-agent/new`(NewMakerDraftRoute) | NewMakerDraftRoute | apps/desktop/src/renderer/features/cc-agent/NewMakerDraftRoute.tsx | 15 | 0 | 3 || `desktop.chat.orca-workflow` | desktop | Orca 协同工作台 | hash `/cc-agent/orca/:sessionId`(OrcaWorkflowRoute) | CCAgentSessionView, OrcaSplitView, OrcaWorkerPanel, OrcaWorkflowRoute | apps/desktop/src/renderer/components/chat/AgentActionRow.tsx, apps/desktop/src/renderer/components/chat/AgentActionsBlock.tsx, apps/desktop/src/renderer/components/chat/AgentOnOtherDeviceContext.tsx, apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx, apps/desktop/src/renderer/components/chat/AgentTaskLiveDetails.tsx, apps/desktop/src/renderer/components/chat/AnnotationStrokesSvg.tsx, apps/desktop/src/renderer/components/chat/AskUserQuestionBubble.tsx, apps/desktop/src/renderer/components/chat/AssistantMessage.tsx, apps/desktop/src/renderer/components/chat/AutomationOriginBadge.tsx, apps/desktop/src/renderer/components/chat/ChatAudioCard.tsx, apps/desktop/src/renderer/components/chat/ChatDisplaySnapshotContext.tsx, apps/desktop/src/renderer/components/chat/ChatImageView.tsx, apps/desktop/src/renderer/components/chat/ChatSessionFileContext.tsx, apps/desktop/src/renderer/components/chat/ChatSoundEffectCard.tsx, apps/desktop/src/renderer/components/chat/ChatVideoView.tsx, apps/desktop/src/renderer/components/chat/CindyMakeDoctorCard.tsx, apps/desktop/src/renderer/components/chat/CopyAsImageBlock.tsx, apps/desktop/src/renderer/components/chat/CredentialSwitchWaitBanner.tsx, apps/desktop/src/renderer/components/chat/DiffView.tsx, apps/desktop/src/renderer/components/chat/ErrorBanner.tsx, apps/desktop/src/renderer/components/chat/ErrorMessageCard.tsx, apps/desktop/src/renderer/components/chat/GeneratedFilesCard.tsx, apps/desktop/src/renderer/components/chat/GhostCardHostPrompts.tsx, apps/desktop/src/renderer/components/chat/GhostSummonCard.tsx, apps/desktop/src/renderer/components/chat/GhostToolCard.tsx, apps/desktop/src/renderer/components/chat/HookTaskCard.tsx, apps/desktop/src/renderer/components/chat/ImageGalleryContext.tsx, apps/desktop/src/renderer/components/chat/ImageHoverPreview.tsx, apps/desktop/src/renderer/components/chat/ImageLightbox.tsx, apps/desktop/src/renderer/components/chat/ImageMissingPlaceholder.tsx, apps/desktop/src/renderer/components/chat/InlineReferenceChip.tsx, apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx, apps/desktop/src/renderer/components/chat/JumpToBottomChip.tsx, apps/desktop/src/renderer/components/chat/MarkdownDiffBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownMermaidBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownRenderer.tsx, apps/desktop/src/renderer/components/chat/MermaidLightbox.tsx, apps/desktop/src/renderer/components/chat/MessageActionBar.tsx, apps/desktop/src/renderer/components/chat/MessageNavRail.tsx, apps/desktop/src/renderer/components/chat/MessageSourceLabels.tsx, apps/desktop/src/renderer/components/chat/MessageStream.tsx, apps/desktop/src/renderer/components/chat/MessageViewport.tsx, apps/desktop/src/renderer/components/chat/ModelLightbox.tsx, apps/desktop/src/renderer/components/chat/NewMessageIndicator.tsx, apps/desktop/src/renderer/components/chat/PlanReviewBubble.tsx, apps/desktop/src/renderer/components/chat/PrevMessageJumpChip.tsx, apps/desktop/src/renderer/components/chat/ProjectLinkChip.tsx, apps/desktop/src/renderer/components/chat/QuoteChip.tsx, apps/desktop/src/renderer/components/chat/RewindPreviewDialog.tsx, apps/desktop/src/renderer/components/chat/SelectionQuoteButton.tsx, apps/desktop/src/renderer/components/chat/SentAgentReferenceChip.tsx, apps/desktop/src/renderer/components/chat/SentInlineAtomBody.tsx, apps/desktop/src/renderer/components/chat/SessionHandoffCard.tsx, apps/desktop/src/renderer/components/chat/SessionLinkChip.tsx, apps/desktop/src/renderer/components/chat/ShareMessageCheckbox.tsx, apps/desktop/src/renderer/components/chat/ShareSelectionBar.tsx, apps/desktop/src/renderer/components/chat/SlackIcon.tsx, apps/desktop/src/renderer/components/chat/StreamFadeSpan.tsx, apps/desktop/src/renderer/components/chat/StreamingMarkdownChunk.tsx, apps/desktop/src/renderer/components/chat/SystemCard.tsx, apps/desktop/src/renderer/components/chat/TextLightbox.tsx, apps/desktop/src/renderer/components/chat/ThinkingCard.tsx, apps/desktop/src/renderer/components/chat/ThinkingText.tsx, apps/desktop/src/renderer/components/chat/TodoListCard.tsx, apps/desktop/src/renderer/components/chat/ToolCallCard.tsx, apps/desktop/src/renderer/components/chat/ToolPayloadLightbox.tsx, apps/desktop/src/renderer/components/chat/TopRightChipStack.tsx, apps/desktop/src/renderer/components/chat/TurnChangesCard.tsx, apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx, apps/desktop/src/renderer/components/chat/UpgradeBanner.tsx, apps/desktop/src/renderer/components/chat/UserAttachmentChip.tsx, apps/desktop/src/renderer/components/chat/UserMessage.tsx, apps/desktop/src/renderer/components/chat/UserMessageEditBox.tsx, apps/desktop/src/renderer/components/chat/UserMessageUrlLink.tsx, apps/desktop/src/renderer/components/chat/VideoLightbox.tsx, apps/desktop/src/renderer/components/chat/WorkGroupBlock.tsx, apps/desktop/src/renderer/components/chat/WorktreeRestoreBanner.tsx, apps/desktop/src/renderer/components/chat/XIcon.tsx, apps/desktop/src/renderer/components/chat/activityRowChrome.ts, apps/desktop/src/renderer/components/chat/animateFocusScroll.ts, apps/desktop/src/renderer/components/chat/autoFollowIntent.ts, apps/desktop/src/renderer/components/chat/chatChrome.ts, apps/desktop/src/renderer/components/chat/errorReasonI18n.ts, apps/desktop/src/renderer/components/chat/generatedFilesProjection.ts, apps/desktop/src/renderer/components/chat/imageDisplaySize.ts, apps/desktop/src/renderer/components/chat/lightboxAnnotations.ts, apps/desktop/src/renderer/components/chat/lightboxGestures.ts, apps/desktop/src/renderer/components/chat/markdownImageTargets.ts, apps/desktop/src/renderer/components/chat/markdownMedia.ts, apps/desktop/src/renderer/components/chat/messageNavRailModel.ts, apps/desktop/src/renderer/components/chat/messageNavRailWheel.ts, apps/desktop/src/renderer/components/chat/messageNavigationProjection.ts, apps/desktop/src/renderer/components/chat/messageProjectionCache.ts, apps/desktop/src/renderer/components/chat/messageStreamIndicatorPosition.ts, apps/desktop/src/renderer/components/chat/messageViewportCompensation.ts, apps/desktop/src/renderer/components/chat/messageViewportGeometry.ts, apps/desktop/src/renderer/components/chat/messageWorkGroups.ts, apps/desktop/src/renderer/components/chat/observeProgrammaticScroll.ts, apps/desktop/src/renderer/components/chat/rehypeFencedCodeMarker.ts, apps/desktop/src/renderer/components/chat/rehypeHighlightShared.ts, apps/desktop/src/renderer/components/chat/rehypeMathBlockMarker.ts, apps/desktop/src/renderer/components/chat/rehypeStreamWordFade.ts, apps/desktop/src/renderer/components/chat/remarkHtmlImages.ts, apps/desktop/src/renderer/components/chat/remarkLocalPathLinks.ts, apps/desktop/src/renderer/components/chat/remarkPreserveRawLocalDestinations.ts, apps/desktop/src/renderer/components/chat/remarkSessionLinks.ts, apps/desktop/src/renderer/components/chat/remarkStrictInlineMath.ts, apps/desktop/src/renderer/components/chat/remarkTruncateCjkUrls.ts, apps/desktop/src/renderer/components/chat/repairStreamingMarkdown.ts, apps/desktop/src/renderer/components/chat/scrollAnchoringDetect.ts, apps/desktop/src/renderer/components/chat/shareSelectionStore.ts, apps/desktop/src/renderer/components/chat/streamingMarkdownBlocks.tsx, apps/desktop/src/renderer/components/chat/streamingMarkdownChunks.ts, apps/desktop/src/renderer/components/chat/streamingMessageProjection.ts, apps/desktop/src/renderer/components/chat/toolLoopI18n.ts, apps/desktop/src/renderer/components/chat/unreadCount.ts, apps/desktop/src/renderer/components/chat/useAutomaticHistoryLoadBudget.ts, apps/desktop/src/renderer/components/chat/useCopyAsImage.tsx, apps/desktop/src/renderer/components/chat/useDeleteMessage.ts, apps/desktop/src/renderer/components/chat/useFileChipContextMenu.tsx, apps/desktop/src/renderer/components/chat/useForkAtMessage.ts, apps/desktop/src/renderer/components/chat/useImageClipboard.ts, apps/desktop/src/renderer/components/chat/useImageLoadFailure.ts, apps/desktop/src/renderer/components/chat/useMessageViewport.ts, apps/desktop/src/renderer/components/chat/useNavigationKeyListener.ts, apps/desktop/src/renderer/components/chat/useOpenWithMenu.tsx, apps/desktop/src/renderer/components/chat/usePrevUserMessageInView.ts, apps/desktop/src/renderer/components/chat/useTurnChangeSets.ts, apps/desktop/src/renderer/components/chat/userMessageCollapse.ts, apps/desktop/src/renderer/components/chat/userMessageDisplayText.ts, apps/desktop/src/renderer/components/chat/userMessageLinkify.ts, apps/desktop/src/renderer/components/chat/viewportFillDetect.ts, apps/desktop/src/renderer/components/new-chat/AddRemoteProjectDialog.tsx, apps/desktop/src/renderer/components/new-chat/AgentSelect.tsx, apps/desktop/src/renderer/components/new-chat/AskUserQuestionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/AtMentionPanel.tsx, apps/desktop/src/renderer/components/new-chat/AttachmentTypeThumb.tsx, apps/desktop/src/renderer/components/new-chat/ChatInput.tsx, apps/desktop/src/renderer/components/new-chat/CjkPunctDecoration.ts, apps/desktop/src/renderer/components/new-chat/CjkPunctuationUtils.ts, apps/desktop/src/renderer/components/new-chat/ComposerAttachments.tsx, apps/desktop/src/renderer/components/new-chat/ComposerListIndentDecoration.ts, apps/desktop/src/renderer/components/new-chat/ComposerListNodes.ts, apps/desktop/src/renderer/components/new-chat/ComposerQuoteNode.tsx, apps/desktop/src/renderer/components/new-chat/DeviceSwitcherPill.tsx, apps/desktop/src/renderer/components/new-chat/EffortSlider.tsx, apps/desktop/src/renderer/components/new-chat/EmptyDocSelectionGuard.ts, apps/desktop/src/renderer/components/new-chat/ExtraDirsButton.tsx, apps/desktop/src/renderer/components/new-chat/FastModeToggle.tsx, apps/desktop/src/renderer/components/new-chat/FolderPickerPopover.tsx, apps/desktop/src/renderer/components/new-chat/FullAccessConfirmContent.tsx, apps/desktop/src/renderer/components/new-chat/GhostCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/GoalAdvancedLimits.tsx, apps/desktop/src/renderer/components/new-chat/GoalIndicator.tsx, apps/desktop/src/renderer/components/new-chat/HomeUsageDashboard.tsx, apps/desktop/src/renderer/components/new-chat/ListComposerTextarea.tsx, apps/desktop/src/renderer/components/new-chat/LocalModelCatalogNotice.tsx, apps/desktop/src/renderer/components/new-chat/MentionChipNode.tsx, apps/desktop/src/renderer/components/new-chat/MentionDragCaretDecoration.ts, apps/desktop/src/renderer/components/new-chat/ModelCompatibilityNotice.tsx, apps/desktop/src/renderer/components/new-chat/ModelConfigFlyout.tsx, apps/desktop/src/renderer/components/new-chat/ModelHarnessPicker.tsx, apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx, apps/desktop/src/renderer/components/new-chat/ModelSourceDetails.tsx, apps/desktop/src/renderer/components/new-chat/NewGoalDialog.tsx, apps/desktop/src/renderer/components/new-chat/PastedTextChipNode.tsx, apps/desktop/src/renderer/components/new-chat/PendingQueuePanel.tsx, apps/desktop/src/renderer/components/new-chat/PermissionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PermissionSelector.tsx, apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx, apps/desktop/src/renderer/components/new-chat/PlanActionCard.tsx, apps/desktop/src/renderer/components/new-chat/PlanModeIndicator.tsx, apps/desktop/src/renderer/components/new-chat/PlanViewerCard.tsx, apps/desktop/src/renderer/components/new-chat/PluginConnectionForm.tsx, apps/desktop/src/renderer/components/new-chat/PluginOauthDeviceCode.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupRemoteDesktopButton.tsx, apps/desktop/src/renderer/components/new-chat/PluginWriteAccessRecovery.tsx, apps/desktop/src/renderer/components/new-chat/QuickStartPillMark.ts, apps/desktop/src/renderer/components/new-chat/RemoteOauthSetupCard.tsx, apps/desktop/src/renderer/components/new-chat/SendButton.tsx, apps/desktop/src/renderer/components/new-chat/SlashCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/SlashCommandPalette.tsx, apps/desktop/src/renderer/components/new-chat/TakeoverMask.tsx, apps/desktop/src/renderer/components/new-chat/ThinkingToggle.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedFlyoutHost.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelPanel.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRail.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRow.tsx, apps/desktop/src/renderer/components/new-chat/UsageDailyBars.tsx, apps/desktop/src/renderer/components/new-chat/UsageHeatmap.tsx, apps/desktop/src/renderer/components/new-chat/VendorSegmentedSwitcher.tsx, apps/desktop/src/renderer/components/new-chat/VoiceInputDraftDecoration.ts, apps/desktop/src/renderer/components/new-chat/WindowsSelectionReplacement.ts, apps/desktop/src/renderer/components/new-chat/WorktreeChipsRow.tsx, apps/desktop/src/renderer/components/new-chat/WorktreeCreatingOverlay.tsx, apps/desktop/src/renderer/components/new-chat/agentOptions.ts, apps/desktop/src/renderer/components/new-chat/agentSwitchConfirmation.ts, apps/desktop/src/renderer/components/new-chat/branchPick.ts, apps/desktop/src/renderer/components/new-chat/composerBlankPointerFocus.ts, apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts, apps/desktop/src/renderer/components/new-chat/composerDocState.ts, apps/desktop/src/renderer/components/new-chat/composerFrameScheduler.ts, apps/desktop/src/renderer/components/new-chat/composerHistoryProjection.ts, apps/desktop/src/renderer/components/new-chat/composerModelSelection.ts, apps/desktop/src/renderer/components/new-chat/composerPromptRecommendation.ts, apps/desktop/src/renderer/components/new-chat/composerRenderGate.ts, apps/desktop/src/renderer/components/new-chat/composerSendOwnership.ts, apps/desktop/src/renderer/components/new-chat/composerSendSnapshot.ts, apps/desktop/src/renderer/components/new-chat/effortChangeQueue.ts, apps/desktop/src/renderer/components/new-chat/extraDirsActions.ts, apps/desktop/src/renderer/components/new-chat/ghostComposerPlacement.ts, apps/desktop/src/renderer/components/new-chat/localAttachmentPicker.ts, apps/desktop/src/renderer/components/new-chat/mentionChipInsertion.ts, apps/desktop/src/renderer/components/new-chat/modelWindowErrorToast.ts, apps/desktop/src/renderer/components/new-chat/pastePipeline.ts, apps/desktop/src/renderer/components/new-chat/pathPaste.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueLocks.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowActivity.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowPresentation.ts, apps/desktop/src/renderer/components/new-chat/planModeComposerCommand.ts, apps/desktop/src/renderer/components/new-chat/priceTierMarks.tsx, apps/desktop/src/renderer/components/new-chat/remoteBrowseAdapters.ts, apps/desktop/src/renderer/components/new-chat/remoteExistingProjects.ts, apps/desktop/src/renderer/components/new-chat/restoreComposerDocument.ts, apps/desktop/src/renderer/components/new-chat/sessionLinkPaste.ts, apps/desktop/src/renderer/components/new-chat/sourceSwitch.ts, apps/desktop/src/renderer/components/new-chat/unifiedModelSelection.ts, apps/desktop/src/renderer/components/new-chat/usagePalette.ts, apps/desktop/src/renderer/components/new-chat/useComposerSendFocusRestore.ts, apps/desktop/src/renderer/components/new-chat/useModelDiscoveryPending.ts, apps/desktop/src/renderer/components/new-chat/useProviderWeeklyQuota.ts, apps/desktop/src/renderer/components/new-chat/useUnifiedRowActions.ts, apps/desktop/src/renderer/features/cc-agent/CCAgentFeatureLayout.tsx, apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx, apps/desktop/src/renderer/features/cc-agent/OrcaSplitView.tsx, apps/desktop/src/renderer/features/cc-agent/OrcaWorkerPanel.tsx, apps/desktop/src/renderer/features/cc-agent/OrcaWorkflowRoute.tsx | 252 | 38 | 336 |diff --git a/docs/dev-rules/protocol-compatibility.md b/docs/dev-rules/protocol-compatibility.mdindex 8d6307e5e8..9a29ff73f8 100644--- a/docs/dev-rules/protocol-compatibility.md+++ b/docs/dev-rules/protocol-compatibility.md@@ -46,6 +46,20 @@ known 是消息 ID 与主机提供的 SHA-256 正文指纹对。支持的主机传输去重仅保留有界内存,两端持久展示缓存继续使用原有账号隔离与删除屏障。不修改 relay、不新增权限、数据库 migration 或 Mobile 原生指纹。+## 群执行终态与错误展示++发送前拒绝、SDK 错误、正常完成和宿主超时进入同一个执行收尾入口;首个终态及提交正文固定,+同一执行/epoch/operationId 重发只取回回执,不重新执行模型,也不因迟到事件再次停止专线。+主动停止沿既有服务器取消语义结束,不生成失败。++Chat Server 新增只读 `/conversations/:roomId/execution-failures`:按成员和历史可见范围返回+当前未删除源消息的完整失败状态及白名单类别。主群和 Thread 的 IPC 返回可选+`executionFailures`,真实消息分页保持原义;各端合并消息页后复用 shared 投影生成提示。+旧服务仅在路由 404 时回退读取最近 `/executions`,不声称覆盖旧服务未提供的执行;其它错误+继续进入既有读取恢复。旧服务器仍接受原有 detail,新服务器仍兼容旧客户端的 `/executions`。+设备互联由宿主投影成原有消息视图,旧手机无需理解新字段;旧宿主的历史通知继续显示。+原始错误不跨群传输,无新增鉴权能力、数据库 migration、运维配置或 Mobile 原生改动。+## 支付宝已付下一期的升级拒绝升级报价和确认可返回 HTTP 409 `PLAN_CHANGE_RENEWAL_PREPAID`。Desktop Main 仅放行该diff --git a/docs/product-rules/bot-group-chat.md b/docs/product-rules/bot-group-chat.mdindex 7f49959f82..d1017f5352 100644--- a/docs/product-rules/bot-group-chat.md+++ b/docs/product-rules/bot-group-chat.md@@ -111,6 +111,42 @@- **停止**:用户点停止,本轮结束,正在发言的伙伴被停止。- **失败与超时**:单个伙伴出错、没有可用模型或 5 分钟内没有回复,视为本轮不发言,群里显示一条轻提示;不影响其余伙伴继续。+ 发送前拒绝同样立即收尾,不等待模型事件或超时;按输入 clientId 匹配执行,旧输入不能结束新执行,+ 用户主动停止不作为失败。隐藏输入从队列撤下,避免下一条群消息带出已失败的旧输入。+ 提示尽可能说明原因和解决办法:图片能力、模型可用性、认证、限流、额度、网络和超时分别本地化,+ 未知错误给出重新发送和查看日志的建议;原始错误、私人路径、响应正文和凭证不进入群聊。+ 运行终态以 `sdkError`、`errorStatus`、`usageLimit` 等结构化信号及既有确定性额度判定分类;+ Codex 的 `codexErrorInfo` 额度、预算与认证标签优先于消息文字,连接/流断开标签归为网络错误。+ 会话无事件与上游响应空闲看门狗的标准 reason(包括 bridge 变体)归为运行超时。+ Pi prompt RPC 超时复用原生恢复的同一信号判定,标准 `pi-prompt-timeout` reason 也归为运行超时。+ 创建专线返回 `NO_MODEL` 时归为模型不可用;本地普通群、分工与服务器执行复用同一分类,提示配置可用模型。+ 上游容量不足复用 SDK 的过载判定(包括标准 `upstream-overload` reason、Codex `serverOverloaded` 与 Anthropic 529),+ 归为独立的 `UPSTREAM_OVERLOADED`:说明模型服务暂时繁忙,建议稍后重新发送或选择其他可用模型;不增加群聊重投。+ 本地成员和分工步骤的计时器超时同样带上 `RUNTIME_TIMEOUT`,保留等待用户批准时暂停计时的规则。+ 明确的额度耗尽优先于泛化 429,明确的暂时限流不会因 `usageLimit` 标记误报为额度耗尽。+ 直接发送拒绝也在执行端分类本地 `message`,跨群仍只提交白名单错误类别。+ Chat Server 是执行状态的唯一事实来源:消息页只包含真实历史,另通过+ `/execution-failures?sourceIds=<已加载消息 ID>` 读取当前读者可见、源消息未删除的完整失败状态+ (执行 ID、epoch、源消息 ID、伙伴、计划和白名单错误类别)。每次最多查询 100 个源 ID,+ Desktop 与 Mobile 复用 shared 去重分批规则,覆盖所有已加载消息,不拉取未加载的全群失败历史;+ 不受普通执行列表最近 100 条限制。推送刷新、分页和 Thread 都包括已加载的旧消息 ID;+ 新页与推送并发时,保留较新的状态并为新增源重新读取,防止旧响应恢复过期错误。+ Desktop 主群、Thread 和 Mobile 合并真实消息页后,使用 shared 的同一投影函数把失败提示放在+ 已加载源消息旁;提示不写入分页缓存、不参与模型上下文,不覆盖消息、预览或未读位置。+ 已加载旧消息即使不在刷新页内,重试、完成、更换 epoch、删除源消息或撤销历史可见性后也按+ 当前状态重新生成提示;旧消息首次发生失败也无需重新翻页。线程根与回复用同一规则,不增加回复条数。+ 错误提交沿同一 operationId 和不可变终态重试,不重跑伙伴;主动停止不产生失败提示。+ 手机设备互联由宿主把当前状态投影成兼容的消息视图,旧手机无需理解新状态字段;手机直连群页+ 读取相同 `/execution-failures` 状态并复用 shared 投影。旧服务没有该路由时,仅 404 回退到既有+ `/executions`,错误展示限于旧服务提供的最近执行范围;认证、权限或网络错误继续进入正常读取恢复。+ 手机显示同一份本地化原因与恢复建议,并说明模型或设置需在伙伴所属电脑上调整。+ 本地失败通知升级为服务器历史时,错误类别存入既有历史卡片的可选结构化字段,不上传标记正文;+ Desktop 与 Mobile 仅在服务器盖章的 import/系统通知历史中恢复类别,也兼容此前已迁移的标记,+ 不把普通用户发送的同名卡片或标记当成错误提示,标记不进入历史预览或模型正文。+ 新服务器返回安全的 `failure_code`;旧服务器仍接受既有 `detail` 字符串,新客户端在当前执行端+ 缓存具体原因,其他设备或重启后降级为通用失败提示。实现与回归见+ `maker-ipc/botGroupRuntimeFailure.ts`、`maker-ipc/__tests__/chatServer.test.ts`。+ 手机回归见 `botGroupRemote.test.ts`、`chatServerClient.test.ts`、`BotGroupChatScreen.test.tsx`。- 应用退出或重启会结束进行中的一轮;重启后不自动续跑。## 5. 界面diff --git a/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts b/packages/maker-shared/src/__tests__/botGroupPresentation.test.tsindex 4fa6392215..1d2a5c9d5a 100644--- a/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts+++ b/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts@@ -5,8 +5,71 @@ import {botGroupNoticeVariant,botGroupPlanFollowUp,isBotGroupDivisionBlocked,+ mergeBotGroupMessages,+ projectBotGroupExecutionFailures,+ botGroupExecutionFailureBatches,} from '../botGroupPresentation.js';-import type { BotGroupErrorCode, BotGroupNoticeCode, BotGroupPlanView } from '../botGroupChat.js';+import { BOT_GROUP_RUNTIME_FAILURE_CODES, readBotGroupExecutionFailure, type BotGroupErrorCode, type BotGroupExecutionFailureView, type BotGroupMessageView, type BotGroupNoticeCode, type BotGroupPlanView } from '../botGroupChat.js';++describe('execution failures are a projection of the current snapshot', () => {+ it('reconciles all loaded sources in bounded deduplicated requests', () => {+ const ids = Array.from({ length: 251 }, (_, n) => `source-${n}`);+ const batches = botGroupExecutionFailureBatches([...ids, ids[0], ids[250]]);+ expect(batches.map(batch => batch.length)).toEqual([100, 100, 51]);+ expect(batches.flat()).toEqual(ids);+ expect(botGroupExecutionFailureBatches([])).toEqual([]);+ });++ const source = { id: 'source', sequence: 4, kind: 'message', authorKind: 'user', authorBotId: null,+ authorName: 'Owner', content: 'Question', mentions: { all: false, botIds: [] }, noticeCode: null,+ planId: null, files: [], attachments: [], createdAt: 1 } as BotGroupMessageView;+ const failure: BotGroupExecutionFailureView = { executionId: 'run', epoch: 1, sourceMessageId: source.id,+ botId: 'bot', botName: 'Bot', code: 'AUTH_REQUIRED', planId: null };++ it('generates all failures beside the source after merging real pages', () => {+ const pages = mergeBotGroupMessages([source], [{ ...source, id: 'latest', sequence: 100 }]);+ expect(projectBotGroupExecutionFailures(pages, [failure, { ...failure, executionId: 'other' }]).map(item => item.id))+ .toEqual(['source', 'execution-failure:run:1', 'execution-failure:other:1', 'latest']);+ expect(pages.map(item => item.id)).toEqual(['source', 'latest']);+ });++ it('removes an old-page failure when the authorized snapshot clears it', () => {+ const pages = mergeBotGroupMessages([source], [{ ...source, id: 'latest', sequence: 100 }]);+ expect(projectBotGroupExecutionFailures(pages, [failure])).toHaveLength(3);+ expect(projectBotGroupExecutionFailures(pages, []).map(item => item.id)).toEqual(['source', 'latest']);+ });++ it('does not anchor a notice on a tombstone even if an older server returns that execution', () => {+ const deleted = { ...source, deleted: true };+ expect(projectBotGroupExecutionFailures([deleted], [failure])).toEqual([deleted]);+ });++ it('shows a new epoch and newly failed old source without reloading that message page', () => {+ expect(projectBotGroupExecutionFailures([source], [])).toEqual([source]);+ expect(projectBotGroupExecutionFailures([source], [{ ...failure, epoch: 2, code: 'QUOTA_EXCEEDED' }])[1])+ .toMatchObject({ id: 'execution-failure:run:2', runtimeFailureCode: 'QUOTA_EXCEEDED' });+ expect(projectBotGroupExecutionFailures([], [failure])).toEqual([]);+ });+});++describe('public failure snapshot decoder', () => {+ const row = { id: 'run', conversation_id: 'room', source_message_id: 'source', bot_id: 'bot', epoch: 2,+ plan_id: 'plan', updated_at: '2026-10-10T00:00:00Z', detail: 'private diagnostic' };+ it.each(BOT_GROUP_RUNTIME_FAILURE_CODES)('reads a new server snapshot without requiring legacy status: %s', code => {+ const view = readBotGroupExecutionFailure({ ...row, failure_code: code }, 'room');+ expect(view).toEqual({ executionId: 'run', epoch: 2, sourceMessageId: 'source', botId: 'bot', botName: '',+ code, planId: 'plan', updatedAt: Date.parse(row.updated_at) });+ expect(JSON.stringify(view)).not.toContain(row.detail);+ });+ it.each([{ status: 'running' }, { conversation_id: 'foreign' }, { epoch: NaN }, { epoch: -1 }, { source_message_id: null }])+ ('rejects inapplicable or malformed execution rows: %j', invalid => {+ expect(readBotGroupExecutionFailure({ ...row, ...invalid }, 'room')).toBeNull();+ });+ it('uses a fixed fallback for unknown categories and drops invalid timestamps', () => {+ expect(readBotGroupExecutionFailure({ ...row, failure_code: 'private diagnostic', updated_at: 'bad-date' }, 'room'))+ .toEqual({ executionId: 'run', epoch: 2, sourceMessageId: 'source', botId: 'bot', botName: '', code: 'RUNTIME_ERROR', planId: 'plan' });+ });+});const plan = (overrides: Partial<BotGroupPlanView> = {}): BotGroupPlanView => ({id: 'p1', status: 'waiting', organizerBotId: 'a', organizerName: 'A', currentStep: 0, workDir: null, branch: null,diff --git a/packages/maker-shared/src/__tests__/botGroupRuntimeFailure.test.ts b/packages/maker-shared/src/__tests__/botGroupRuntimeFailure.test.tsnew file mode 100644index 0000000000..555d49c3b5--- /dev/null+++ b/packages/maker-shared/src/__tests__/botGroupRuntimeFailure.test.ts@@ -0,0 +1,38 @@+import { describe, expect, it } from 'vitest';+import { readImportedBotGroupRuntimeFailureCode } from '../botGroupChat.js';++const card = { type: 'card', namespace: 'cindy.local-history', schemaRevision: 1,+ fallback: 'group activity', data: { kind: 'notice', authorKind: 'system', runtimeFailureCode: 'AUTH_REQUIRED' } };+const imported = { origin: 'import', deleted: false, content: [card] };++describe('imported group runtime notices', () => {+ it('reads only the public category, without returning private metadata', () => {+ expect(readImportedBotGroupRuntimeFailureCode({ ...imported, content: [{ ...card,+ data: { ...card.data, message: 'private diagnostic' } }] })).toBe('AUTH_REQUIRED');+ });+ it.each(['chat', 'system', 'integration', undefined])('rejects spoofed origin %s', origin => {+ expect(readImportedBotGroupRuntimeFailureCode({ ...imported, origin })).toBeUndefined();+ });+ it.each([+ { ...card, type: 'text' }, { ...card, namespace: 'custom.history' }, { ...card, schemaRevision: 2 },+ { ...card, data: { ...card.data, kind: 'message' } }, { ...card, data: { ...card.data, authorKind: 'user' } },+ { ...card, data: { ...card.data, runtimeFailureCode: 'private diagnostic' } }, { ...card, data: null },+ ])('ignores malformed or ordinary history %j', block => {+ expect(readImportedBotGroupRuntimeFailureCode({ ...imported, content: [block] })).toBeUndefined();+ });+ it('ignores a deleted imported notice', () => {+ expect(readImportedBotGroupRuntimeFailureCode({ ...imported, deleted: true })).toBeUndefined();+ });+ it.each(['text', 'fallback'])('recovers an older exact marker in %s', field => {+ const oldCard = { ...card, data: { kind: 'notice', authorKind: 'system' },+ ...(field === 'fallback' ? { fallback: 'cindy-runtime-error:RUNTIME_TIMEOUT' } : {}) };+ expect(readImportedBotGroupRuntimeFailureCode({ ...imported, content: [oldCard,+ ...(field === 'text' ? [{ type: 'text', text: 'cindy-runtime-error:RUNTIME_TIMEOUT' }] : [])] })).toBe('RUNTIME_TIMEOUT');+ });+ it('rejects arbitrary or partial old markers', () => {+ const oldCard = { ...card, data: { kind: 'notice', authorKind: 'system' } };+ for (const text of ['cindy-runtime-error:AUTH_REQUIRED private diagnostic', 'cindy-runtime-error:private diagnostic']) {+ expect(readImportedBotGroupRuntimeFailureCode({ ...imported, content: [oldCard, { type: 'text', text }] })).toBeUndefined();+ }+ });+});diff --git a/packages/maker-shared/src/botGroupChat.ts b/packages/maker-shared/src/botGroupChat.tsindex f3bab83651..609f22e8e4 100644--- a/packages/maker-shared/src/botGroupChat.ts+++ b/packages/maker-shared/src/botGroupChat.ts@@ -39,6 +39,74 @@ export type BotGroupNoticeCode =| 'workdir-unavailable';export type BotGroupMemberStatus = 'active' | 'paused' | 'error' | 'archived' | 'deleting' | 'missing';+/** Public failure categories only; never transport raw Agent errors into a group. */+export const BOT_GROUP_RUNTIME_FAILURE_CODES = [+ 'IMAGE_INPUT_UNSUPPORTED', 'MODEL_UNAVAILABLE', 'AUTH_REQUIRED', 'RATE_LIMITED', 'UPSTREAM_OVERLOADED',+ 'QUOTA_EXCEEDED', 'NETWORK_ERROR', 'RUNTIME_TIMEOUT', 'RUNTIME_ERROR',+] as const;+export type BotGroupRuntimeFailureCode = typeof BOT_GROUP_RUNTIME_FAILURE_CODES[number];+export function isBotGroupRuntimeFailureCode(value: unknown): value is BotGroupRuntimeFailureCode {+ return typeof value === 'string' && BOT_GROUP_RUNTIME_FAILURE_CODES.some(code => code === value);+}++/** Current execution state, separate from persisted/paginated chat messages. */+export interface BotGroupExecutionFailureView {+ executionId: string;+ epoch: number;+ sourceMessageId: string;+ botId: string;+ botName: string;+ code: BotGroupRuntimeFailureCode;+ planId: string | null;+ updatedAt?: number;+}++/** Decode only public fields from Chat Server; legacy /executions rows also work. */+export function readBotGroupExecutionFailure(value: unknown, roomId: string): BotGroupExecutionFailureView | null {+ if (!value || typeof value !== 'object' || Array.isArray(value)) return null;+ const row = value as Record<string, unknown>;+ if ((row.status !== undefined && row.status !== 'failed')+ || (row.conversation_id !== undefined && row.conversation_id !== roomId)+ || typeof row.id !== 'string' || !row.id || typeof row.source_message_id !== 'string' || !row.source_message_id+ || typeof row.bot_id !== 'string' || !row.bot_id+ || typeof row.epoch !== 'number' || !Number.isSafeInteger(row.epoch) || row.epoch < 0) return null;+ const updatedAt = typeof row.updated_at === 'string' ? Date.parse(row.updated_at) : NaN;+ return { executionId: row.id, epoch: row.epoch, sourceMessageId: row.source_message_id,+ botId: row.bot_id, botName: '', code: isBotGroupRuntimeFailureCode(row.failure_code) ? row.failure_code : 'RUNTIME_ERROR',+ planId: typeof row.plan_id === 'string' ? row.plan_id : null,+ ...(Number.isFinite(updatedAt) ? { updatedAt } : {}) };+}++/** Persisted local notice marker; migration carries the category as card metadata. */+export const BOT_GROUP_RUNTIME_FAILURE_PREFIX = 'cindy-runtime-error:';+export function botGroupRuntimeFailureDetail(code: BotGroupRuntimeFailureCode): string {+ return `${BOT_GROUP_RUNTIME_FAILURE_PREFIX}${code}`;+}+export function readBotGroupRuntimeFailureDetail(value: unknown): BotGroupRuntimeFailureCode | undefined {+ if (typeof value !== 'string' || !value.startsWith(BOT_GROUP_RUNTIME_FAILURE_PREFIX)) return undefined;+ const code = value.slice(BOT_GROUP_RUNTIME_FAILURE_PREFIX.length);+ return isBotGroupRuntimeFailureCode(code) ? code : undefined;+}++/** Only a server-stamped import of a system notice can supply historical failure metadata. */+export function readImportedBotGroupRuntimeFailureCode(message: {+ origin?: unknown; deleted?: unknown;+ content: readonly { type?: unknown; namespace?: unknown; schemaRevision?: unknown; data?: unknown; text?: unknown; fallback?: unknown }[];+}): BotGroupRuntimeFailureCode | undefined {+ if (message.origin !== 'import' || message.deleted === true) return undefined;+ const card = message.content.find(block => block.type === 'card' && block.namespace === 'cindy.local-history' && block.schemaRevision === 1);+ if (!card?.data || typeof card.data !== 'object' || Array.isArray(card.data)) return undefined;+ const data = card.data as Record<string, unknown>;+ if (data.kind !== 'notice' || data.authorKind !== 'system') return undefined;+ if (isBotGroupRuntimeFailureCode(data.runtimeFailureCode)) return data.runtimeFailureCode;+ // Compatibility with notices imported before the metadata projection existed.+ for (const block of message.content) {+ const code = readBotGroupRuntimeFailureDetail(block.type === 'text' ? block.text : block === card ? block.fallback : undefined);+ if (code) return code;+ }+ return undefined;+}+export interface BotGroupMention {all: boolean;botIds: string[];@@ -66,6 +134,8 @@ export interface BotGroupMemberView {}export interface BotGroupMessageView {+ /** Server tombstone; it cannot anchor a runtime failure notice. */+ deleted?: boolean;isSelf?: boolean;threadRootId?: string | null;replyCount?: number;@@ -80,6 +150,8 @@ export interface BotGroupMessageView {content: string;mentions: BotGroupMention;noticeCode: BotGroupNoticeCode | null;+ /** Localized cause and remedy for a failed execution; raw diagnostics stay on the executor. */+ runtimeFailureCode?: BotGroupRuntimeFailureCode;/** The plan this message belongs to: the 安排卡, a step hand-off or the plan's end. */planId: string | null;/** Step hand-off files, relative to the plan's work directory (POSIX separators). */@@ -238,6 +310,8 @@ export interface BotGroupSummary {export interface BotGroupDetail extends BotGroupSummary {/** Oldest first. */messages: BotGroupMessageView[];+ /** Authorized current failures, independent of message pagination. Local/older hosts omit this. */+ executionFailures?: BotGroupExecutionFailureView[];hasMoreBefore: boolean;round: BotGroupRoundView;/** Plans referenced by the loaded messages, plus the open plan. */@@ -332,6 +406,8 @@ export interface BotGroupGetOptions {/** Load messages with a smaller sequence (older page). */beforeSequence?: number;limit?: number;+ /** Reconcile execution state for real messages already displayed on older pages. */+ sourceMessageIds?: string[];}export type BotGroupChange = 'created' | 'updated' | 'deleted' | 'messages' | 'round' | 'plan';@@ -464,8 +540,10 @@ export interface ChatServerApi {ownedBots(): Promise<ChatServerResult<{ bots: Array<{ actorId: string; name: string }> }>>;refreshProfile(): Promise<ChatServerResult<Record<never, never>>>;status(): Promise<{ enabled: boolean; connected: boolean }>;- thread(input: { groupId: string; rootId: string; before?: number }): Promise<ChatServerResult<{+ thread(input: { groupId: string; rootId: string; before?: number; sourceMessageIds?: string[] }): Promise<ChatServerResult<{root: BotGroupMessageView; replies: BotGroupMessageView[]; hasMore: boolean;+ /** Same authoritative state as the main timeline; root and replies use one projection. */+ executionFailures?: BotGroupExecutionFailureView[];}>>;reply(input: { groupId: string; rootId: string; text: string; clientId: string; mentions: BotGroupMention }): Promise<ChatServerResult<{ messageId: string }>>;react(input: { groupId: string; messageId: string; emoji: string; present: boolean }): Promise<ChatServerResult<Record<never, never>>>;diff --git a/packages/maker-shared/src/botGroupPresentation.ts b/packages/maker-shared/src/botGroupPresentation.tsindex fa3b05f17b..c7b049ebdc 100644--- a/packages/maker-shared/src/botGroupPresentation.ts+++ b/packages/maker-shared/src/botGroupPresentation.ts@@ -7,6 +7,7 @@ import {isBotGroupPlanOpen,type BotGroupDetail,type BotGroupErrorCode,+ type BotGroupExecutionFailureView,type BotGroupMemberView,type BotGroupMessageView,type BotGroupNoticeCode,@@ -60,17 +61,44 @@ export function continuableRoundEndId(return null;}-/** Merge an older page under the latest page, keyed by sequence. */+/** Merge real message pages; current execution state never enters the page cache. */export function mergeBotGroupMessages(older: readonly BotGroupMessageView[],latest: readonly BotGroupMessageView[],): BotGroupMessageView[] {const bySequence = new Map<number, BotGroupMessageView>();- for (const message of older) bySequence.set(message.sequence, message);- for (const message of latest) bySequence.set(message.sequence, message);+ for (const message of [...older, ...latest]) bySequence.set(message.sequence, message);return [...bySequence.values()].sort((a, b) => a.sequence - b.sequence);}+/** Bound each HTTP reconciliation request to 100 displayed sources, without truncating loaded history. */+export function botGroupExecutionFailureBatches(sourceIds: readonly string[]): string[][] {+ const unique = [...new Set(sourceIds)];+ const batches: string[][] = [];+ for (let offset = 0; offset < unique.length; offset += 100) batches.push(unique.slice(offset, offset + 100));+ return batches;+}++/** Derive notices once, after pagination, from the latest authorized execution snapshot. */+export function projectBotGroupExecutionFailures(+ messages: readonly BotGroupMessageView[],+ failures: readonly BotGroupExecutionFailureView[] = [],+): BotGroupMessageView[] {+ const bySource = new Map<string, BotGroupExecutionFailureView[]>();+ for (const failure of failures) {+ const entries = bySource.get(failure.sourceMessageId) ?? [];+ entries.push(failure);+ bySource.set(failure.sourceMessageId, entries);+ }+ return messages.flatMap(source => [source, ...(source.deleted ? [] : bySource.get(source.id) ?? []).map((failure): BotGroupMessageView => ({+ id: `execution-failure:${failure.executionId}:${failure.epoch}`, sequence: source.sequence,+ kind: 'notice', authorKind: 'system', authorBotId: failure.botId, authorName: failure.botName,+ content: '', noticeCode: failure.code === 'RUNTIME_TIMEOUT' ? 'member-timeout' : 'member-failed',+ runtimeFailureCode: failure.code, mentions: { all: false, botIds: [] }, planId: failure.planId,+ threadRootId: source.threadRootId ?? null, files: [], attachments: [], createdAt: failure.updatedAt ?? source.createdAt,+ }))]);+}+/** Copy variant for a refused group action; null keeps the caller's own fallback. */export type BotGroupErrorVariant =| 'invalidAttachment'