fix: Ollama MCP tool calling for Mistral and Gemma3 models#11523
fix: Ollama MCP tool calling for Mistral and Gemma3 models#11523joaquinhuigomez wants to merge 6 commits intocontinuedev:mainfrom
Conversation
…ev#9249) Fix two issues with Ollama tool calling: 1. Mistral/Ministral: reorder messages so system messages never follow tool messages (causes "Unexpected role 'system' after role 'tool'") 2. Gemma3: strip unsupported fields (index, id, type) from tool_calls when converting assistant messages to Ollama format (causes "unknown variant 'index'") Also forward assistant toolCalls to Ollama's tool_calls format for proper multi-turn tool calling conversations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (unresolved 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="core/llm/llms/Ollama.ts">
<violation number="1" location="core/llm/llms/Ollama.ts:331">
P2: Unguarded `JSON.parse` of string tool-call arguments can throw and abort `_streamChat` before the Ollama request is sent.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
I have read the CLA Document and I hereby sign the CLA |
Remove .js extensions from jest.mock paths so the moduleNameMapper resolves ollamaHelper and url modules correctly. Apply prettier formatting to both changed files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The jest ESM config resolves relative mock paths from the setup file context, not the test file, causing 'Cannot find module' errors. These mocks are unnecessary since the test bypasses the constructor via Object.create() and only tests pure transformation methods. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wrap JSON.parse of tool-call arguments in _convertToOllamaMessage and pull-progress lines in installModel with try/catch to prevent unhandled exceptions from aborting the request flow. Addresses Cubic review feedback on PR continuedev#11523. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Joaquin Hui Gomez <joaquinhui1995@gmail.com>
TypeScript rejects a direct cast from string to JSONSchema7Object. Cast through unknown first to satisfy the type checker. Signed-off-by: Joaquin <joaquin@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Update: latest CI is green on the code/test side. Remaining blockers appear to be CLA/process-related rather than the implementation itself. |
|
recheck |
1 similar comment
|
recheck |
No description provided.