feat(web-react): interleave assistant text and tool chips via ordered message segments#140
Conversation
… message segments
🤖 AI Code Review (ensemble)
SummaryThe PR adds ordered Issues Found3 total — 0 P1 (blocking) · 1 P2 (should fix) · 2 P3 (nice to have)
|
🤖 AI Code Review (ensemble)SummaryThe PR adds ordered message segments to ChatMessages, enabling assistant text and tool chips to interleave chronologically. The implementation is solid with good test coverage for segmented rendering, fallback behavior, and empty segments. Two P2 issues were identified: one regarding streaming caret suppression when the last segment is a tool call, and another about potential key collisions between text and tool segments. Issues Found2 total — 0 P1 (blocking) · 2 P2 (should fix) · 0 P3 (nice to have)
|
🤖 AI Code Review (ensemble)
SummaryThe PR adds optional interleaved text/tool segments for assistant messages, rendering them in emission order with a smooth text effect for streaming, while preserving the legacy fallback. The implementation is largely solid and well-tested, but it has a few user-visible edge cases: an empty text segment can render a blank gap, the streaming caret can disappear when a tool call is the last segment, and tool calls in Issues Found3 total — 0 P1 (blocking) · 3 P2 (should fix) · 0 P3 (nice to have)
|
…fter a trailing tool, keep orphan toolCalls
🤖 AI Code Review (ensemble)
SummaryPR adds interleaved rendering of assistant text and tool-call chips via an ordered Issues Found4 total — 0 P1 (blocking) · 3 P2 (should fix) · 1 P3 (nice to have)
|
…gment streaming caret
🤖 AI Code Review (ensemble)
SummaryThis PR adds ordered message segments to interleave assistant text and tool chips chronologically, with a clean fallback to the legacy content + toolCalls layout. The implementation is solid and well-tested, but the index-based React key for segments and the leftover tool call rendering order introduce fragility under certain producer patterns. Issues Found3 total — 0 P1 (blocking) · 2 P2 (should fix) · 1 P3 (nice to have)
|
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved PR — ae295258
Blanket team auto-approval is enabled for this reviewer service.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
tangletools · auto-approval · reason: blanket_auto_approve · 2026-06-24T00:56:36Z
Overview
ChatMessagesrenders an assistant turn as one header + one markdown body + a tool-chip group after it. A turn that reasons, calls a tool, reasons again, calls another tool renders as one concatenated text blob with every tool chip collected at the bottom — the chronological flow is lost.Change
Add an optional ordered
segmentsarray toChatUiMessage:ChatMessageSegment = { kind: 'text'; content } | { kind: 'tool'; call }.segments, the assistant bubble renders them in order — interleaving text runs and tool cards under the single existing header (and reasoning box). Only the trailing text run of a live turn smooth-types and shows the caret.segmentsis absent, rendering is unchanged: the existingcontentbody +toolCallsgroup. Fully backward-compatible.This is additive — no existing field changes meaning, and producers that don't segment a turn render exactly as before.
Tests
src/web-react/chat-messages-segments.test.tsx: rendersChatMessagesand asserts (a) segmented turns render text/tool/text in DOM order, (b) unsegmented messages still fold to content-then-tools, (c) an emptysegmentsarray falls back tocontent.pnpm test(web-react) green;pnpm build(DTS typecheck) green.