Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(conversations): handle missing agent message content gracefully

Steven Enamakel134cc4dd7f45
diff --git a/app/src/features/conversations/components/AgentMessageBubble.test.tsx b/app/src/features/conversations/components/AgentMessageBubble.test.tsx
index f6ca4a0869..48c8547c08 100644
--- a/app/src/features/conversations/components/AgentMessageBubble.test.tsx
+++ b/app/src/features/conversations/components/AgentMessageBubble.test.tsx
@@ -2,7 +2,7 @@ import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
-import { AgentMessageText, BubbleMarkdown, TableCellMarkdown } from './AgentMessageBubble';
+import { BubbleMarkdown, TableCellMarkdown } from './AgentMessageBubble';
const mocks = vi.hoisted(() => ({ openUrl: vi.fn(), openWorkspacePath: vi.fn() }));
@@ -155,28 +155,6 @@ describe('BubbleMarkdown math rendering', () => {
});
});
-describe('AgentMessageText', () => {
- test('renders openhuman link pills without assistant bubble chrome', () => {
- render(
- <AgentMessageText
- content={'<openhuman-link path="settings/appearance">Appearance</openhuman-link>'}
- />
- );
-
- expect(screen.getByTestId('agent-message-text')).toBeInTheDocument();
- expect(screen.getByRole('button', { name: /Appearance/ })).toBeInTheDocument();
- });
-
- test('uses the dedicated table renderer in plain text mode', () => {
- render(<AgentMessageText content={'| Name | Value |\n| --- | --- |\n| OpenHuman | 42 |'} />);
-
- expect(screen.getByTestId('agent-message-text')).toBeInTheDocument();
- expect(screen.getByRole('table')).toBeInTheDocument();
- expect(screen.getByRole('columnheader', { name: 'Name' })).toBeInTheDocument();
- expect(screen.getByRole('cell', { name: 'OpenHuman' })).toBeInTheDocument();
- });
-});
-
describe('BubbleMarkdown — syntax highlighting', () => {
test('fenced code block with a language tag gets hljs token classes in the output', () => {
const { container } = render(
diff --git a/app/src/features/conversations/components/AgentMessageBubble.tsx b/app/src/features/conversations/components/AgentMessageBubble.tsx
index 1eccfc1781..70589fc2ba 100644
--- a/app/src/features/conversations/components/AgentMessageBubble.tsx
+++ b/app/src/features/conversations/components/AgentMessageBubble.tsx
@@ -236,37 +236,3 @@ export function AgentMessageBubble({
</>
);
}
-
-export function AgentMessageText({ content }: { content: string }) {
- const segments = parseBubbleSegments(content);
- const textContent = segments
- .filter(s => s.kind === 'text')
- .map(s => s.text)
- .join('')
- .trim();
- const linkSegments = segments.filter(
- (s): s is Extract<typeof s, { kind: 'link' }> => s.kind === 'link'
- );
- const table = parseMarkdownTable(textContent);
-
- return (
- <div className="w-full min-w-0 px-1 py-1 text-content" data-testid="agent-message-text">
- {table ? (
- <AgentMarkdownTable table={table} className="w-full max-w-full overflow-hidden" />
- ) : (
- textContent && <BubbleMarkdown content={textContent} />
- )}
- {linkSegments.length > 0 && (
- <div className="mt-2 flex flex-wrap gap-2">
- {linkSegments.map((segment, idx) => (
- <OpenhumanLinkPill
- key={`pill-${idx}-${segment.path}`}
- path={segment.path}
- label={segment.label}
- />
- ))}
- </div>
- )}
- </div>
- );
-}
diff --git a/app/src/features/conversations/components/AssistantUiChat.tsx b/app/src/features/conversations/components/AssistantUiChat.tsx
index 3f083089e2..91cd6bbeda 100644
--- a/app/src/features/conversations/components/AssistantUiChat.tsx
+++ b/app/src/features/conversations/components/AssistantUiChat.tsx
@@ -22,11 +22,7 @@ import { contextUsageFromTokenUsage, ContextWindowPill } from './composer/Contex
const EMPTY_TOKEN_USAGE = emptySessionTokenUsage();
const selectComposerText = (state: AssistantState) => state.composer.text;
-/**
- * Keeps a host-owned draft string and assistant-ui's composer text in step.
- * Exported for surfaces that mount `Thread` directly (the workflow copilot).
- */
-export function ComposerTextBridge({
+function ComposerTextBridge({
value,
onChange,
}: {
diff --git a/app/src/store/threadSlice.ts b/app/src/store/threadSlice.ts
index 8e0df20805..f0cad90ac5 100644
--- a/app/src/store/threadSlice.ts
+++ b/app/src/store/threadSlice.ts
@@ -348,35 +348,6 @@ export const generateThreadTitleIfNeeded = createAsyncThunk(
}
);
-export const persistReaction = createAsyncThunk(
- 'thread/persistReaction',
- async (
- payload: { threadId: string; messageId: string; emoji: string },
- { getState, rejectWithValue }
- ) => {
- const state = getState() as { thread: ThreadState };
- const stored = state.thread.messagesByThreadId[payload.threadId] ?? [];
- const message = stored.find(e => e.id === payload.messageId);
- if (!message) return rejectWithValue('Message not found');
-
- const prev = (message.extraMetadata['myReactions'] as string[] | undefined) ?? [];
- const idx = prev.indexOf(payload.emoji);
- const next = idx >= 0 ? prev.filter(e => e !== payload.emoji) : [...prev, payload.emoji];
- const extraMetadata = { ...message.extraMetadata, myReactions: next };
-
- try {
- const persisted = await threadApi.updateMessage(
- payload.threadId,
- payload.messageId,
- extraMetadata
- );
- return { threadId: payload.threadId, message: persisted };
- } catch (error) {
- return rejectWithValue(error instanceof Error ? error.message : 'Failed to save reaction');
- }
- }
-);
-
/** The rating a user gave one assistant reply. */
export type MessageFeedback = 'positive' | 'negative';
@@ -395,9 +366,8 @@ export const FEEDBACK_METADATA_KEY = 'feedback';
export const FEEDBACK_ROW_IDS_METADATA_KEY = 'feedbackRowIds';
/**
- * Persist a thumbs rating on one assistant message, modelled on
- * [`persistReaction`] — same read-from-Redux, patch-`extraMetadata`,
- * write-back-the-persisted-row shape.
+ * Persist a thumbs rating on one assistant message: read the row from Redux,
+ * patch its `extraMetadata`, and write back the persisted row.
*
* Pressing the same rating again clears it, so a mis-click is recoverable: the
* assistant-ui action bar has no third "unrated" control to offer.
@@ -637,9 +607,6 @@ const threadSlice = createSlice({
// chat_done / chat_error. Clearing on every rejected segment append
// would re-enable the composer while the turn is still in-flight.
})
- .addCase(persistReaction.fulfilled, (state, action) => {
- appendMessageToCache(state, action.payload.threadId, action.payload.message, true);
- })
.addCase(persistMessageFeedback.fulfilled, (state, action) => {
appendMessageToCache(state, action.payload.threadId, action.payload.message, true);
})