Skip to content

armgit / cindy

Public Imported from GitHub
0

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

fix(bots): 群里来自未知作者的任务卡按快照显示

Chrisc53b4c813111
diff --git a/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx b/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx
index c43ffd589c..a11644d473 100644
--- a/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx
+++ b/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx
@@ -1117,8 +1117,10 @@ function BotGroupTimelineItem({
) : (
<>
{quoteDisplay ? <BotGroupQuoteBlock display={quoteDisplay} onLocate={onLocateQuote} /> : null}
- {/* A task this teammate started from the group; mine is live, another owner's is a snapshot. */}
- {message.task ? <BotGroupTaskCard task={message.task} owned={member?.isOwned !== false} /> : null}
+ {/* A task this teammate started from the group; mine is live, another owner's is a snapshot.
+ An author no longer in the group is unknown: its task may run on another computer, so it
+ stays a snapshot rather than a lookup on this one. */}
+ {message.task ? <BotGroupTaskCard task={message.task} owned={member !== undefined && member.isOwned !== false} /> : null}
{hasText ? (
<div className={`min-w-0 text-[var(--msg-assistant-text)] ${CHAT_BODY_CLASS}`}>
<MarkdownRenderer workingDir="" content={message.content} allowPrivilegedLinks={false} />
diff --git a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
index d1a192e7ef..a27bb57709 100644
--- a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
+++ b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
@@ -85,6 +85,11 @@ vi.mock('../BotGroupPendingInteraction', () => ({
<div data-testid="pending-interaction">{sessionId}</div>
),
}));
+vi.mock('../BotGroupTaskCard', () => ({
+ BotGroupTaskCard: ({ task, owned }: { task: { title: string }; owned: boolean }) => (
+ <div data-testid="bot-group-task" data-owned={String(owned)}>{task.title}</div>
+ ),
+}));
vi.mock('../BotAvatar', () => ({
BotAvatar: ({ bot }: { bot: { name: string } }) => <span data-avatar={bot.name} />,
}));
@@ -376,6 +381,18 @@ describe('BotGroupChatView', () => {
} finally { cleanup(); motion.restore(); }
});
+ it('shows a task card live only for a member of this group; an author who left is a snapshot', async () => {
+ const task = { state: 'running', title: '整理行程', summary: null, meta: { role: 'delegation-request', objective: '整理行程', parentSessionId: 'p1', childSessionId: 'c1' } } as never;
+ mocks.getBotGroup.mockResolvedValue({ ok: true, group: detail({ messages: [
+ msg({ id: 'b1', sequence: 2, authorKind: 'bot', authorBotId: 'xiaoman', authorName: '小满', content: '开了一条任务', task }),
+ msg({ id: 'b2', sequence: 3, authorKind: 'bot', authorBotId: 'gone', authorName: '离开的伙伴', content: '我也开了', task }),
+ ] }) });
+ renderView();
+ const cards = await screen.findAllByTestId('bot-group-task');
+ // Only a current member's teammate is looked up on this computer; unknown authors stay snapshots.
+ expect(cards.map((card) => card.getAttribute('data-owned'))).toEqual(['true', 'false']);
+ });
+
it('cancels an interrupted close and does not animate or later close the newly selected thread', async () => {
const motion = mockThreadMotion('200ms');
try {