Skip to content

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

Closed
iwasatapex wants to merge 0 commit into
continuedev:mainfrom
iwasatapex:fix/ollama-multistep-tools
Closed

iwasatapex wants to merge 0 commit into
continuedev:mainfrom
iwasatapex:fix/ollama-multistep-tools

Conversation

@iwasatapex

Copy link
Copy Markdown

Description

Fix Ollama tool handling in Continue Agent mode.

The Ollama adapter previously attached tool definitions only when the last message had role user. After a tool call, the next request has a tool message as the latest message, so Continue stopped sending the tool definitions back to Ollama.

This caused multi-step agent loops to fall back to textual/XML tool calls instead of structured tool calls.

This change removes that incorrect restriction so tools remain available across agent turns.

What changed

  • Always attach configured tools to Ollama chat requests.
  • Added regression tests covering:
    • first-turn tool attachment
    • continuation after a tool result
    • multiple tool calls in the same agent loop

Testing

The added Ollama regression tests were run successfully against the patched source.

The fix was also packaged and tested with Continue 2.0.0 in a local VSCodium installation.

Scope

Only the Ollama tool-calling path and its regression tests are changed.

@iwasatapex
iwasatapex requested a review from a team as a code owner September 14, 2026 04:28
@iwasatapex
iwasatapex requested review from sestinj and removed request for a team September 14, 2026 04:28
@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

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

@iwasatapex

Copy link
Copy Markdown
Author

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

@iwasatapex iwasatapex closed this Sep 14, 2026
@iwasatapex
iwasatapex force-pushed the fix/ollama-multistep-tools branch from bc8b58d to c5490d9 Compare September 14, 2026 04:42
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant