Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • fixed messages array for ollama, added gpt-5.2

Type of Change

  • Bug fix
  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Dec 11, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Dec 11, 2025 9:42pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 11, 2025

Greptile Overview

Greptile Summary

Fixed a bug in Ollama provider integration where messages were being duplicated, and added support for the new gpt-5.2 model.

Key Changes:

  • Fixed message duplication in Ollama by conditionally setting the context field to undefined when valid messages exist (previously context was always populated, causing Ollama to add it as an additional user message even when messages were already provided)
  • Added gpt-5.2 model to both OpenAI and Azure OpenAI providers with pricing ($1.75 input, $14.0 output), 400K context window, and support for reasoningEffort and verbosity capabilities

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Both changes are straightforward and correct. The bug fix prevents message duplication by properly handling the context field based on message validity, and the model addition follows the established pattern with consistent configuration across OpenAI and Azure providers. No logical errors or security issues found.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/executor/handlers/agent/agent-handler.ts 5/5 Fixed Ollama duplicate message bug by conditionally setting context field to undefined when valid messages exist
apps/sim/providers/models.ts 5/5 Added gpt-5.2 model definition to OpenAI and Azure OpenAI providers with pricing and capabilities

Sequence Diagram

sequenceDiagram
    participant Agent as AgentBlockHandler
    participant Builder as buildProviderRequest
    participant Provider as executeProviderRequest
    participant Ollama as OllamaProvider
    
    Agent->>Builder: buildProviderRequest(config)
    Builder->>Builder: validateMessages(messages)
    
    alt validMessages = true
        Note over Builder: Messages are valid<br/>Set context = undefined<br/>Set systemPrompt = undefined
        Builder->>Provider: { messages, context: undefined }
        Provider->>Ollama: { messages: [...] }
        Ollama->>Ollama: allMessages.push(...messages)
        Note over Ollama: No duplicate messages
    else validMessages = false
        Note over Builder: Messages invalid<br/>Set context = stringifyJSON(messages)<br/>Use systemPrompt
        Builder->>Provider: { context, systemPrompt }
        Provider->>Ollama: { context: "..." }
        Ollama->>Ollama: allMessages.push({ role: 'user', content: context })
        Note over Ollama: Context added as user message
    end
    
    Ollama-->>Provider: Response
    Provider-->>Agent: Result
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Additional Comments (1)

  1. apps/sim/providers/ollama/index.ts, line 110-124 (link)

    logic: removed request.context handling that exists in all other providers - this breaks context passing

    All other providers (OpenAI, Anthropic, Google, etc.) handle request.context by inserting it as a user message between the system prompt and the messages array. Removing this from Ollama breaks parity and will cause context to be ignored when using Ollama.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1
Copy link
Collaborator Author

@greptile

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit d02499a into staging Dec 11, 2025
9 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/ollama branch December 11, 2025 21:51
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