Skip to content

feat(ai): AI model handling with reasoning support - #8539

Merged
sid-bruno merged 2 commits into
usebruno:mainfrom
naman-bruno:fix/ai-reson
Jul 8, 2026
Merged

sid-bruno merged 2 commits into
usebruno:mainfrom
naman-bruno:fix/ai-reson

Conversation

@naman-bruno

@naman-bruno naman-bruno commented Jul 8, 2026 •

Copy link
Copy Markdown
Collaborator

Description

  • Added reasoning model support in the model definitions for OpenAI and Anthropic.
  • Updated temperature handling for reasoning models to prevent unnecessary parameters.
  • Implemented error handling in the AI chat stream to manage stream errors effectively.

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • Bug Fixes

    • Improved AI streaming reliability by surfacing stream errors instead of silently ignoring them.
    • AI responses now better respect model type, avoiding settings that can interfere with reasoning-focused models.
  • New Features

    • Expanded support for additional reasoning-capable AI models.
    • Model selection now more accurately adapts behavior based on the chosen provider and model type.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (1)
  • packages/bruno-electron/src/ipc/ai/autocomplete.js
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fdef1b65-6714-4f35-ae7e-0da3847e3d4f

📥 Commits

Reviewing files that changed from the base of the PR and between b5da1cb and 8580735.

📒 Files selected for processing (1)
  • packages/bruno-electron/src/ipc/ai/autocomplete.js

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR fixes stream error propagation in the AI chat handler and adds reasoning-model awareness to the AI providers module, conditionally omitting the temperature parameter for reasoning models in both text generation and streaming handlers.

Changes

AI Chat and Reasoning Model Support

Layer / File(s) Summary
Stream error propagation
packages/bruno-electron/src/ipc/ai/chat.js
Adds a streamError variable and handles type: 'error' stream parts by capturing and throwing the error after the stream loop, ensuring it reaches the existing catch block.
Reasoning model detection and SDK instantiation
packages/bruno-electron/src/ipc/ai/providers.js
Marks additional models with reasoning: true, adds isReasoningModel and isOpenAiReasoningModel helper functions (exported), and updates getModel to use sdk.chat(...) for OpenAI-compatible providers.
Conditional temperature for reasoning models
packages/bruno-electron/src/ipc/ai/index.js
Imports isReasoningModel and conditionally omits the temperature parameter in both generateText and streamText handlers when the selected model is a reasoning model.

Estimated code review effort: 2 (Simple) | ~12 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Renderer
  participant ChatHandler as chat.js
  participant FullStream as result.fullStream
  participant Catch as catch block

  Renderer->>ChatHandler: renderer:ai-stream-text
  ChatHandler->>FullStream: iterate stream parts
  FullStream-->>ChatHandler: part { type: 'error' }
  ChatHandler->>ChatHandler: streamError = part.error
  ChatHandler->>ChatHandler: throw streamError (after loop)
  ChatHandler->>Catch: error handled
  Catch-->>Renderer: error response
Loading

Possibly related PRs

  • usebruno/bruno#8358: Both PRs modify the Electron AI chat streaming IPC logic in packages/bruno-electron/src/ipc/ai/chat.js, one fixing stream error surfacing and the other introducing the streaming flow itself.

Suggested reviewers: helloanoop, bijin-bruno, lohit-bruno, sid-bruno, vijayh-bruno, utkarsh-bruno

Poem

A stream once erred and slipped away,
now caught and thrown, it can't betray. 🐰
Reasoning models, cool and terse,
skip the heat, no need to converse.
Bruno hops on, smarter still,
chatting on with sharper skill. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: AI model handling updated to support reasoning models.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@sid-bruno
sid-bruno merged commit 12961db into usebruno:main Jul 8, 2026
14 of 16 checks passed
ravindra-bruno pushed a commit to ravindra-bruno/bruno that referenced this pull request Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants