Polish chat interfaces and unify reasoning UI#39
Merged
Conversation
…ble state rule - Update AI SDK v6 skill and React 19 lint fixes workflow - Polish chat components (chat, conversation, message-assistant, message, reasoning) - Update chat-actions-menu, sidebar-project-menu, project-view - Update dropdown-menu component - Add streaming-ui-rendering troubleshooting doc - Add 080-mutable-external-state cursor rule Co-authored-by: Cursor <cursoragent@cursor.com>
Add className="size-*" alongside HugeiconsIcon size prop across all components to prevent layout-shift from intrinsic SVG sizing. Remove ThinkingBar stop button (API preserved). Fix user message list rendering. Add icon-sizing rule and research docs. Co-authored-by: Cursor <cursoragent@cursor.com>
… docs - Replace per-component reasoning with shared Reasoning/ReasoningContent/ReasoningLabel primitives from components/ui/reasoning.tsx using CSS grid collapse instead of ResizeObserver max-height - Add useReasoningPhase hook for status-driven thinking/done label transitions - Track reasoning duration in route.ts (onChunk + onFinish) and send via messageMetadata - Delete app/components/chat/reasoning.tsx in favor of the unified component - Expand CLAUDE.md quality enforcement with implementation decision framework and research-first workflow; add Implementation Philosophy section to AGENTS.md - Add new skills: history-adaptation-system, provider-reasoning-config, streaming-ui-lifecycle - Update plan.md: renumber items, add SDK feature evaluation ticket (#28), uncheck model persistence for re-verification Co-authored-by: Cursor <cursoragent@cursor.com>
Treat empty reasoning content as non-visible so loading and reasoning UI states transition correctly, and avoid sidebar rail toggles while a dialog is open. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR unifies reasoning/thinking presentation across chat surfaces with a new phase-based flow that tracks reasoning duration both client-side and server-side. The changes harden streaming behavior by safely handling empty reasoning output (preventing frozen "Thinking" indicators) and apply comprehensive icon sizing fixes across 50+ components to prevent Shadcn buttonVariants CSS overrides. Key improvements:
Documentation additions:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Chat UI
participant Route as /api/chat
participant SDK as AI SDK
participant Hook as useReasoningPhase
participant UI as Reasoning Component
Client->>Route: POST message
Route->>SDK: streamText()
Note over Route: reasoningStartMs = null
SDK-->>Route: reasoning-delta chunk
Route->>Route: Set reasoningStartMs = Date.now()
Route-->>Client: Stream reasoning chunk
Client->>Hook: parts updated (reasoning streaming)
Hook->>Hook: phase = "thinking", start timer
Hook-->>UI: isReasoningStreaming = true
UI->>UI: Show shimmer "Thinking" + live duration
SDK-->>Route: text-delta chunk (reasoning done)
Route->>Route: reasoningDurationMs = Date.now() - reasoningStartMs
Route-->>Client: Stream text chunk
Client->>Hook: parts updated (text started)
Hook->>Hook: phase = "complete", freeze timer
Hook-->>UI: isReasoningStreaming = false
UI->>UI: Show "Thought for Xs" + collapsible content
SDK-->>Route: finish
Route->>Route: Freeze reasoningDurationMs if not set
Route-->>Client: messageMetadata with reasoningDurationMs
Note over Client,UI: Historical messages use persistedDurationMs
Last reviewed commit: 188b361 |
There was a problem hiding this comment.
3 issues found across 67 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/components/chat/use-reasoning-phase.ts">
<violation number="1" location="app/components/chat/use-reasoning-phase.ts:28">
P2: `useMemo` depends on a mutable `parts` reference, which can prevent reasoning/phase updates during streaming when parts are mutated in place. Compute this derivation each render or key it off a stable snapshot so streaming updates aren’t memoized away.</violation>
<violation number="2" location="app/components/chat/use-reasoning-phase.ts:119">
P2: `persistedDurationMs` is never used for the last message when it’s already complete, so last historical messages lose their duration. Fall back to `persistedDurationMs` when the live timer is 0.</violation>
</file>
<file name="app/components/chat/use-loading-state.ts">
<violation number="1" location="app/components/chat/use-loading-state.ts:35">
P2: Guard `part.text` before calling `trim()` to avoid runtime errors when reasoning parts have no text yet during streaming.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Avoid memoizing reasoning phase by parts reference because AI SDK mutates parts in place, and guard loading-dot suppression against non-string reasoning text. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
bun run lintbun run typecheckbun run testMade with Cursor
Summary by cubic
Unifies reasoning/thinking across chat surfaces with a shared, phase-aware UI and server-side timing, improving streaming clarity and reliability. Also enforces explicit icon sizing and polishes sidebar interactions, with new docs and rules to prevent common streaming and state bugs.
New Features
Bug Fixes
Written for commit d70ad3e. Summary will update on new commits.