Skip to content

fix(ollama): preserve tools across agent loop turns - #13258

Open
dvd233 wants to merge 1 commit into
continuedev:mainfrom
dvd233:fix/ollama-multistep-tools-13254
Open

fix(ollama): preserve tools across agent loop turns#13258
dvd233 wants to merge 1 commit into
continuedev:mainfrom
dvd233:fix/ollama-multistep-tools-13254

Conversation

@dvd233

@dvd233 dvd233 commented Sep 12, 2026

Copy link
Copy Markdown

Description

Fixes #13254.

Ollama chat requests only attached tool definitions when the last converted message had the user role. After Continue executed the first tool, the next Agent-mode request ended with a tool result, so tools disappeared from the request body and Ollama could not select the next tool.

Attach configured tools whenever CompletionOptions.tools is non-empty. This matches Ollama's current multi-turn agent-loop examples, which pass the available tools on every loop iteration, including after appending tool results.

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created (not applicable: no user-facing API or configuration change)
  • The relevant tests, if any, have been updated or created

Screen recording or screenshot

Not applicable; this is an outbound request-construction bug covered by a focused regression test.

Tests

  • Regression proof on unchanged source: the new test fails because body.tools is undefined, while the 10 existing Ollama tests pass
  • npm test --prefix core -- --runInBand llm/llms/Ollama.test.ts (11/11 passed)
  • npm run tsc:check --prefix core
  • Prettier check for both changed files
  • git diff --check

@dvd233
dvd233 requested a review from a team as a code owner September 12, 2026 12:08
@dvd233
dvd233 requested review from sestinj and removed request for a team September 12, 2026 12:08
@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@dvd233

dvd233 commented Sep 13, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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.

Ollama provider drops tools after the first tool call, breaking multi-step agent loops

1 participant