Skip to content

Conversation

@Kitenite
Copy link
Contributor

@Kitenite Kitenite commented Sep 13, 2025

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Release
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes


Important

Fix GPT-5 stutter by updating dependencies and refactoring chat message handling components.

  • Dependencies:
    • Update @ai-sdk/react to 2.0.44 and ai to 5.0.44 in package.json and bun.lock.
  • Chat Message Handling:
    • Refactor ChatMessages in index.tsx to use new MessageList component.
    • Remove useMemo and useCallback hooks for message rendering logic.
    • Simplify StreamMessage logic in stream-message.tsx.
  • New Components:
    • Add MessageList component in message-list.tsx for rendering chat messages.
  • Function Changes:
    • Modify handleToolCall in tools.ts to accept addToolResult callback for tool result handling.

This description was created by Ellipsis for 137e519. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • Refactor

    • Streamlined chat rendering to use engine messages with a new centralized message list.
    • Simplified streaming behavior and loading state to a single “Thinking…” indicator.
    • Improved empty-state handling and reduced re-render complexity.
  • Style

    • Updated reasoning block to conditionally handle overflow when not streaming.
    • Applied tighter, smaller Markdown styling for reasoning content.
  • Chores

    • Upgraded AI-related dependencies across the app and packages to latest minor versions.

@vercel
Copy link

vercel bot commented Sep 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs Ready Ready Preview Comment Sep 13, 2025 8:01am
web Building Building Preview Comment Sep 13, 2025 8:01am

@supabase
Copy link

supabase bot commented Sep 13, 2025

This pull request has been ignored for the connected project wowaemfasoptxrdjhilu because there are no changes detected in apps/backend/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai
Copy link

coderabbitai bot commented Sep 13, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Refactors chat message rendering to use engine-provided messages via a new MessageList, simplifies streaming UI, and adjusts message-content styling. Updates tool-call control flow to push results via a callback. Bumps ai and @ai-sdk/react dependencies in multiple packages. No public UI component signatures changed; one tools API signature updated.

Changes

Cohort / File(s) Summary
Dependency bumps
apps/web/client/package.json, packages/ai/package.json, packages/models/package.json
Updated @ai-sdk/react 2.0.25→2.0.44 and ai 5.0.26→5.0.44 (including devDependency). No code changes.
Chat rendering refactor
apps/web/client/src/app/project/[id]/_components/right-panel/chat-tab/chat-messages/index.tsx, .../chat-messages/message-list.tsx, .../chat-messages/stream-message.tsx
Switched rendering to engine messages; introduced MessageList; removed role-based per-message switch; simplified stream handling and loading UI; eliminated duplicate streaming message filtering from parent; adjusted keys.
Message content styling
.../chat-messages/message-content/index.tsx
Added conditional overflow via cn(...); applied compact styles to Markdown in reasoning block; behavior unchanged aside from styling under non-stream.
Tool-call flow update
apps/web/client/src/app/project/[id]/_hooks/use-chat.tsx, apps/web/client/src/components/tools/tools.ts
handleToolCall now non-async, accepts optional addToolResult callback; use-chat passes callback and no longer awaits result; success/error results emitted via callback.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant ChatUI as Chat UI
  participant Engine as EditorEngine
  participant Tools as handleToolCall
  participant ChatStore as chat.addToolResult

  User->>ChatUI: Triggers tool call
  ChatUI->>Engine: Prepare toolCall
  ChatUI->>Tools: handleToolCall(toolCall, Engine, addToolResult)
  note right of Tools: Executes async internally
  Tools-->>ChatStore: addToolResult({ toolCallId, result | error })
  ChatStore-->>ChatUI: State updates (message with tool result)
  ChatUI-->>User: Renders updated messages
Loading
sequenceDiagram
  autonumber
  participant Engine as EditorEngine.chat.conversation
  participant ChatList as MessageList
  participant Stream as StreamMessage
  participant View as ChatMessages

  Engine-->>View: messages
  View->>ChatList: Render with engine messages
  alt Waiting (streaming)
    Stream-->>View: isWaiting=true, streamMessage
    Note over Stream,View: Show single "Thinking ..." indicator
  end
  ChatList-->>View: Render mapped user/assistant messages
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

In cables of chat where the messages stream,
I nibble the logs with a byte-sized beam.
Tools hop results with a callback’s grace,
Engine now leads in the rendering race.
Versions bumped, whiskers twitch—so neat!
Thump-thump: shipped changes, carrot-complete. 🥕🐇

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugs/gpt-5-rendering

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f1c5fe and 137e519.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • apps/web/client/package.json (2 hunks)
  • apps/web/client/src/app/project/[id]/_components/right-panel/chat-tab/chat-messages/index.tsx (3 hunks)
  • apps/web/client/src/app/project/[id]/_components/right-panel/chat-tab/chat-messages/message-content/index.tsx (2 hunks)
  • apps/web/client/src/app/project/[id]/_components/right-panel/chat-tab/chat-messages/message-list.tsx (1 hunks)
  • apps/web/client/src/app/project/[id]/_components/right-panel/chat-tab/chat-messages/stream-message.tsx (2 hunks)
  • apps/web/client/src/app/project/[id]/_hooks/use-chat.tsx (1 hunks)
  • apps/web/client/src/components/tools/tools.ts (1 hunks)
  • packages/ai/package.json (1 hunks)
  • packages/models/package.json (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Kitenite Kitenite merged commit 740ec31 into main Sep 13, 2025
4 of 6 checks passed
@Kitenite Kitenite deleted the bugs/gpt-5-rendering branch September 13, 2025 08:02
console.error('Error handling tool call', error);
return 'error handling tool call ' + error;
}
executeToolCall();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical bug: executeToolCall() is called without await, causing the function to return undefined instead of the tool result. This breaks the tool execution flow and will cause runtime errors when the result is expected. Change to: return executeToolCall(); or return await executeToolCall();

Suggested change
executeToolCall();
return executeToolCall();

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants