Skip to content

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

fix(chat): keep responses whole and align composer controls

Steven Enamakel6651d3dd4bc0
diff --git a/app/src/components/assistant-ui/thread.tsx b/app/src/components/assistant-ui/thread.tsx
index 852085b1fb..ddd4d29e47 100644
--- a/app/src/components/assistant-ui/thread.tsx
+++ b/app/src/components/assistant-ui/thread.tsx
@@ -600,7 +600,7 @@ const ComposerAction: FC<{
type="button"
variant="default"
size="icon"
- className="aui-composer-cancel size-7 rounded-full"
+ className="aui-composer-cancel size-7 rounded-full bg-primary-500 text-content-inverted hover:bg-primary-600"
data-testid="stop-generation-button"
aria-label="Stop generating">
<SquareIcon className="aui-composer-cancel-icon size-3.5 fill-current" />
diff --git a/app/src/features/conversations/components/ChatToolParts.test.tsx b/app/src/features/conversations/components/ChatToolParts.test.tsx
index 63162031e8..1e6b9283e9 100644
--- a/app/src/features/conversations/components/ChatToolParts.test.tsx
+++ b/app/src/features/conversations/components/ChatToolParts.test.tsx
@@ -64,6 +64,7 @@ describe('ChatToolParts', () => {
expect(screen.getByTestId('assistant-ui-tool-call')).toHaveTextContent('Searched the web');
await userEvent.click(screen.getByRole('button', { name: /Searched the web/ }));
expect(screen.getByText(/Lean open conjectures/)).toBeInTheDocument();
+ expect(screen.queryByText('Query', { exact: true })).not.toBeInTheDocument();
expect(screen.getByText('Found 12 candidate problems')).toBeInTheDocument();
});
diff --git a/app/src/features/conversations/components/ChatToolParts.tsx b/app/src/features/conversations/components/ChatToolParts.tsx
index 0f0097bf35..fef105e5b0 100644
--- a/app/src/features/conversations/components/ChatToolParts.tsx
+++ b/app/src/features/conversations/components/ChatToolParts.tsx
@@ -143,7 +143,7 @@ function ToolDataView({ value }: { value: unknown }) {
// Tool wrappers frequently add bookkeeping beside the actual payload
// (`tool_call_id`, success, timing). When a semantic output field exists,
// show that value directly and hide the wrapper entirely.
- for (const key of ['content', 'output', 'result', 'message']) {
+ for (const key of ['content', 'output', 'result', 'message', 'query', 'q']) {
const semantic = entries.find(([candidate]) => candidate === key)?.[1];
if (hasDisplayValue(semantic)) return <ToolDataView value={semantic} />;
}
diff --git a/app/src/pages/__tests__/Conversations.render.test.tsx b/app/src/pages/__tests__/Conversations.render.test.tsx
index 090a836be4..aa391a27dd 100644
--- a/app/src/pages/__tests__/Conversations.render.test.tsx
+++ b/app/src/pages/__tests__/Conversations.render.test.tsx
@@ -654,7 +654,7 @@ describe('Conversations — smoke render (#1123 welcome-lock removal)', () => {
});
// No past-turn tool call before hydration.
- expect(screen.queryByText(/read_file/)).not.toBeInTheDocument();
+ expect(screen.queryByTestId('assistant-ui-tool-call')).not.toBeInTheDocument();
// Hydrate the older turn's timeline (as fetchAndHydrateTurnHistory would).
await act(async () => {
@@ -669,8 +669,7 @@ describe('Conversations — smoke render (#1123 welcome-lock removal)', () => {
});
// The past turn's tool call is projected into assistant-ui exactly once.
- fireEvent.click(await screen.findByRole('button', { name: /1 tool call/ }));
- expect(await screen.findByText('read_file')).toBeInTheDocument();
+ expect(await screen.findByTestId('assistant-ui-tool-call')).toHaveTextContent('Read File');
});
it('keeps assistant message copy available through assistant-ui', async () => {
@@ -955,7 +954,13 @@ describe('Conversations — smoke render (#1123 welcome-lock removal)', () => {
// The send cleared the composer; with an empty composer mid-send the Send
// button morphs into the Stop button, so there is no Send affordance left
// to fire a duplicate send.
- expect(screen.getByRole('button', { name: 'Stop generating' })).toBeInTheDocument();
+ const stopButton = screen.getByRole('button', { name: 'Stop generating' });
+ expect(stopButton).toBeInTheDocument();
+ expect(stopButton).toHaveClass(
+ 'bg-primary-500',
+ 'text-content-inverted',
+ 'hover:bg-primary-600'
+ );
expect(screen.queryByRole('button', { name: 'Send message' })).not.toBeInTheDocument();
resolveSend?.();
});
diff --git a/src/openhuman/web_chat/presentation.rs b/src/openhuman/web_chat/presentation.rs
index 3db2b671b0..1263affe33 100644
--- a/src/openhuman/web_chat/presentation.rs
+++ b/src/openhuman/web_chat/presentation.rs
@@ -44,12 +44,12 @@ fn usage_payload(usage: Option<&LastTurnUsage>) -> Option<TurnUsagePayload> {
})
}
-/// Deliver an agent response to the frontend, applying local-model
-/// presentation (segmentation + reaction) when the model is available.
+/// Deliver one unmodified agent response to the frontend.
///
-/// Always emits at least one `chat_done` event. When the response is
-/// segmented, emits one `chat_segment` per bubble first, then a final
-/// `chat_done` with the full text for deduplication.
+/// Desktop/web chat owns Markdown layout inside one assistant message. Splitting
+/// paragraphs into `chat_segment` messages duplicates tool/reasoning parts and
+/// turns one answer into several bubbles, so this path always emits exactly one
+/// `chat_done` with the model's original text.
pub(crate) async fn deliver_response(
client_id: &str,
thread_id: &str,
@@ -66,8 +66,10 @@ pub(crate) async fn deliver_response(
let user_msg_owned = user_message.to_string();
let reaction_handle = tokio::spawn(async move { try_reaction(&user_msg_owned).await });
- // Segmentation is pure CPU work, runs immediately.
- let segments = segment_for_delivery(full_response);
+ // Keep the response byte-for-byte in one assistant message. The legacy
+ // segmentation helpers remain available to channel-specific callers/tests,
+ // but the interactive web surface must not cut or reformat model output.
+ let segments = vec![full_response.to_string()];
// Await the reaction result (should already be done or nearly done).
let reaction_emoji = reaction_handle.await.unwrap_or(None);
diff --git a/tests/raw_coverage/channels_bus_presentation_raw_coverage_e2e.rs b/tests/raw_coverage/channels_bus_presentation_raw_coverage_e2e.rs
index 14ff116460..6842d20320 100644
--- a/tests/raw_coverage/channels_bus_presentation_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/channels_bus_presentation_raw_coverage_e2e.rs
@@ -79,16 +79,13 @@ async fn presentation_segments_text_and_delivers_single_bubble_with_citations()
}
#[tokio::test]
-async fn presentation_delivers_segment_events_then_deduping_done_event() {
+async fn presentation_delivers_one_unmodified_done_event() {
let response = [
"First paragraph has enough natural language content to stand alone as a separate chat bubble.",
"Second paragraph also contains enough prose to exercise segmented delivery and delay calculation.",
"Third paragraph ensures the final chat_done event carries the complete response for deduplication.",
]
.join("\n\n");
- let segments = presentation_test_support::segment_for_delivery_for_test(&response);
- assert!(segments.len() >= 2, "expected segmented delivery");
-
let mut rx = subscribe_web_channel_events();
presentation_test_support::deliver_response_for_test(
"round20-client",
@@ -100,30 +97,20 @@ async fn presentation_delivers_segment_events_then_deduping_done_event() {
)
.await;
- let mut seen_segments = 0_u32;
let final_event = timeout(Duration::from_secs(10), async {
loop {
let event = rx.recv().await.expect("presentation event");
if event.request_id != "round20-segmented" {
continue;
}
- match event.event.as_str() {
- "chat_segment" => {
- assert_eq!(event.segment_total, Some(segments.len() as u32));
- assert_eq!(event.segment_index, Some(seen_segments));
- assert!(event.full_response.as_deref().unwrap_or("").len() >= 40);
- seen_segments += 1;
- }
- "chat_done" => break event,
- other => panic!("unexpected presentation event {other}"),
- }
+ assert_eq!(event.event, "chat_done");
+ break event;
}
})
.await
.expect("segmented delivery timeout");
- assert_eq!(seen_segments, segments.len() as u32);
- assert_eq!(final_event.segment_total, Some(segments.len() as u32));
+ assert_eq!(final_event.segment_total, None);
assert_eq!(
final_event.full_response.as_deref(),
Some(response.as_str())