Local LLMs have no session context #2197

Closed
opened 2026-02-16 17:34:38 -05:00 by yindo · 7 comments
Owner

Originally created by @Armada3334 on GitHub (Oct 20, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Every message within a same-session conversation starts a new dialogue with local LLMs on a fresh install.
Image

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama (local)",
      "options": {
        "baseURL": "http://10.60.90.90:11434/v1"
      },
      "models": {
        "gpt-oss:120b": {
          "name": "gpt-oss:120b"
        },
        "llama3.1:70b": {
          "name": "llama 3.1 70b"
        }
      }
    }
  }

Above is my configuration

When using models like Grok, conversational history works perfectly. However, with local models it seems to not work at all. I've gone through pretty much all of the documentation on the opencode website. Haven't found anything to suggest my issue yet.

Issue also happens with other models

Image

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @Armada3334 on GitHub (Oct 20, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description Every message within a same-session conversation starts a new dialogue with local LLMs on a fresh install. <img width="1483" height="617" alt="Image" src="https://github.com/user-attachments/assets/8ccdae83-49db-4eac-b5f0-e905a040a06f" /> ``` { "$schema": "https://opencode.ai/config.json", "provider": { "ollama": { "npm": "@ai-sdk/openai-compatible", "name": "Ollama (local)", "options": { "baseURL": "http://10.60.90.90:11434/v1" }, "models": { "gpt-oss:120b": { "name": "gpt-oss:120b" }, "llama3.1:70b": { "name": "llama 3.1 70b" } } } } ``` Above is my configuration When using models like Grok, conversational history works perfectly. However, with local models it seems to not work at all. I've gone through pretty much all of the documentation on the opencode website. Haven't found anything to suggest my issue yet. Issue also happens with other models <img width="2321" height="765" alt="Image" src="https://github.com/user-attachments/assets/98dd43d1-c941-4a54-8e7d-2bd996c6ec73" /> ### OpenCode version _No response_ ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the bug label 2026-02-16 17:34:38 -05:00
yindo closed this issue 2026-02-16 17:34:38 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 20, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #917: Session memory isn't passed in Non-Interactive mode - Reports that local models don't maintain conversation history, similar symptoms where bot has no memory of previous messages

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 20, 2025): This issue might be a duplicate of existing issues. Please check: - #917: Session memory isn't passed in Non-Interactive mode - Reports that local models don't maintain conversation history, similar symptoms where bot has no memory of previous messages Feel free to ignore if none of these address your specific case.
Author
Owner

@Armada3334 commented on GitHub (Oct 20, 2025):

OpenCode version

v0.15.10

Steps to reproduce

Use a local model from OLLAMA

Operating System

Ubuntu 24.04 and Arch (updated after issue, replicated still)

Terminal

Bash, ZSH

@Armada3334 commented on GitHub (Oct 20, 2025): ## OpenCode version v0.15.10 ## Steps to reproduce Use a local model from OLLAMA ## Operating System Ubuntu 24.04 and Arch (updated after issue, replicated still) ## Terminal Bash, ZSH
Author
Owner

@EvanCoppa commented on GitHub (Oct 20, 2025):

This is also happening in Fedora V42. There is no context provided to local models and it gets stuck in this loop. Grok works great issue is just with local models.

@EvanCoppa commented on GitHub (Oct 20, 2025): This is also happening in Fedora V42. There is no context provided to local models and it gets stuck in this loop. Grok works great issue is just with local models.
Author
Owner

@rekram1-node commented on GitHub (Oct 21, 2025):

@EvanCoppa did you set num_ctx in ollama? Ollama defaults to like ~4k tokens so u are gonna need to increase that

@rekram1-node commented on GitHub (Oct 21, 2025): @EvanCoppa did you set num_ctx in ollama? Ollama defaults to like ~4k tokens so u are gonna need to increase that
Author
Owner

@EvanCoppa commented on GitHub (Oct 21, 2025):

@rekram1-node wow that did the trick! Where did I miss that, In the docs? Thank you so much, I apologize for missing it.

@EvanCoppa commented on GitHub (Oct 21, 2025): @rekram1-node wow that did the trick! Where did I miss that, In the docs? Thank you so much, I apologize for missing it.
Author
Owner

@rekram1-node commented on GitHub (Oct 21, 2025):

@EvanCoppa we do document it here: https://opencode.ai/docs/providers/#ollama

I heard there is a way to set it from the client, which may help "solve" for this and we have another ticket tracking that.

Going to close this out since we resolved your issue, happy to help!

@rekram1-node commented on GitHub (Oct 21, 2025): @EvanCoppa we do document it here: https://opencode.ai/docs/providers/#ollama I heard there is a way to set it from the client, which may help "solve" for this and we have another ticket tracking that. Going to close this out since we resolved your issue, happy to help!
Author
Owner

@Armada3334 commented on GitHub (Oct 21, 2025):

Yea that did it for me.

@Armada3334 commented on GitHub (Oct 21, 2025): Yea that did it for me.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2197