Skip to content

[BUG] Reasoning content not preserved across turns for generic OpenRouter provider, causes repeated/looping thinking (e.g. poolside/laguna-s-2.1) #1107

Open

Description

@alexzandermatveev

When using a reasoning-capable model through the generic OpenRouter provider (not Ollama, not DeepSeek-native), the reasoning/thinking content from previous assistant turns is not sent back to the model on subsequent requests. As a result, the model repeatedly re-derives the same reasoning from scratch on every turn instead of building on prior thinking. In long agentic tasks this causes visible repeated/looping chains of thought (the same reasoning text, near-verbatim, appears again and again across turns), wasting several minutes per turn and sometimes stalling the task entirely.

I can see the thinking blocks are actually captured and displayed in the UI, but based on the repeated content it looks like they are not being included in the request payload sent back to the model on the next turn.

This looks related to #201 (DeepSeek reasoning_content not passed back) and to the upstream Roo Code issue RooCodeInc/Roo-Code#9125 ("OpenRouter provider supports reasoning_details"), but is specifically about the generic OpenRouter provider path rather than a single hardcoded model integration.

To Reproduce

  1. Create an OpenRouter provider profile with a reasoning model that supports interleaved/preserved thinking, e.g. poolside/laguna-s-2.1.
  2. Enable reasoning/thinking if there's a toggle for it.
  3. Run a multi-step agentic task (several tool calls / turns).
  4. Observe the "thinking" content in each new assistant turn — it re-derives the same reasoning already produced in a previous turn, sometimes near-verbatim, instead of continuing from it.

Expected behavior
Reasoning/thinking content (e.g. OpenRouter's reasoning_details field) from prior assistant turns should be preserved and sent back in the message history on subsequent requests, per OpenRouter's guidance: https://openrouter.ai/docs/guides/best-practices/reasoning-tokens#preserving-reasoning-blocks
This should let the model continue its reasoning instead of restarting it, and should reduce/eliminate repeated reasoning loops.

What version of zoo are you running
3.74.0

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions