Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(task): let links in run output be clicked again (#18253)

LiJian1c6628e5b19f
diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicCard.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicCard.test.tsx
new file mode 100644
index 00000000000..9d646bdcb58
--- /dev/null
+++ b/src/features/AgentTasks/AgentTaskDetail/TopicCard.test.tsx
@@ -0,0 +1,67 @@
+/**
+ * @vitest-environment happy-dom
+ */
+import type { TaskDetailActivity } from '@lobechat/types';
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import type { ReactNode } from 'react';
+import { describe, expect, it, vi } from 'vitest';
+
+import TopicCard from './TopicCard';
+
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({ t: (key: string) => key }),
+}));
+
+vi.mock('@/store/task', () => ({
+ useTaskStore: (selector: (state: any) => unknown) =>
+ selector({
+ activeTaskId: 'T-1',
+ addComment: vi.fn(),
+ cancelTopic: vi.fn(),
+ openTopicDrawer: vi.fn(),
+ taskDetailMap: {},
+ }),
+}));
+
+vi.mock('@/hooks/usePermission', () => ({
+ usePermission: () => ({ allowed: true }),
+}));
+
+vi.mock('@/hooks/useActivityTime', () => ({
+ useActivityTime: () => ({ text: '4m ago', title: '4m ago' }),
+}));
+
+// None of these render for this activity; they are stubbed only to keep the
+// reply editor's upload stack and the verify feature out of the module graph.
+vi.mock('./RunReplyEditor', () => ({ default: () => null }));
+vi.mock('./RunVerifyDetail', () => ({ default: () => null }));
+vi.mock('./RunVerifyTag', () => ({ default: () => null }));
+
+vi.mock('@/features/AgentProfileCard/AgentProfilePopup', () => ({
+ default: ({ children }: { children: ReactNode }) => <>{children}</>,
+}));
+
+const activity = {
+ content: 'See [primes.py](https://example.com/primes.py) for the script.',
+ id: 'run-1',
+ operationId: 'op-1',
+ status: 'success',
+ time: new Date('2026-08-13T00:00:00.000Z').toISOString(),
+ title: 'Run title',
+ topicId: 'topic-1',
+ type: 'topic',
+} as unknown as TaskDetailActivity;
+
+describe('TopicCard', () => {
+ it('leaves links in the run output clickable', async () => {
+ render(<TopicCard activity={activity} />);
+
+ const link = screen.getByRole('link', { name: 'primes.py' });
+
+ // The run body used to carry `pointer-events: none` so that clicks fell
+ // through to the card behind it. user-event refuses to click through that
+ // rule, which is exactly what a reader hit: a link that ignores the mouse.
+ await expect(userEvent.click(link)).resolves.not.toThrow();
+ });
+});
diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx
index 87529ae5491..398bfa5dccc 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx
@@ -54,11 +54,17 @@ const formatDuration = (ms: number): string => {
// the shared collapse clamps it with a fade and offers "show more", while the
// run drawer remains available from the explicit overflow action. The preview
// itself is reading content, not an unlabeled navigation target.
+//
+// It also stays interactive. While the whole card was one big button to the run
+// drawer, the body carried `pointer-events: none` so clicks fell through to it;
+// the card stopped being that button, and the rule was left behind killing every
+// link, code-copy and text selection in the output with nothing to fall through
+// to. Anything added here that swallows clicks has to earn it again.
const RUN_CONTENT_MAX_HEIGHT = 160;
const RunContent = memo<{ content: string }>(({ content }) => (
<CollapsibleContent key={content} maxHeight={RUN_CONTENT_MAX_HEIGHT}>
- <Markdown style={{ overflow: 'unset', pointerEvents: 'none' }} variant={'chat'}>
+ <Markdown style={{ overflow: 'unset' }} variant={'chat'}>
{content}
</Markdown>
</CollapsibleContent>