Skip to content

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

Open
iwasatapex wants to merge 2 commits into
continuedev:mainfrom
iwasatapex:fix/ollama-multistep-tools
Open

fix(ollama): preserve tools across agent turns#13276
iwasatapex wants to merge 2 commits 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 contains 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, which could stall or break the agent loop.

What changed

  • Always attach configured tools to Ollama chat requests.
  • Removed the incorrect requirement that the last message must have role user.
  • Added regression tests covering:
    • first-turn tool attachment
    • continuation after a tool result
    • multiple tool calls in the same agent loop

Testing

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

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

The patched installation successfully handled multi-step sequences including:

read → edit → read → verify

and additional sequential tool calls without falling back to raw textual/XML tool syntax.

Scope

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

No unrelated package/version changes are included.

@iwasatapex
iwasatapex requested a review from a team as a code owner September 14, 2026 04:55
@iwasatapex
iwasatapex requested review from sestinj and removed request for a team September 14, 2026 04:55
@iwasatapex
iwasatapex force-pushed the fix/ollama-multistep-tools branch from 0a705fc to 63448c6 Compare September 14, 2026 05:00
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.

1 participant