Skip to content

Content parsing issue with OpenCode / Ollama #137

@mtfoley

Description

@mtfoley

Hey, I've enjoyed trying out this project! I wound up trying to set it up with OpenCode and Ollama (using tapes start opencode ...) and found that it wasn't capturing the conversation turns. I found errors in the logs with regard to json.Unmarshal, and so I retooled ollama.go a little bit to save the raw request payloads out temporarily. I saw that the recorded payloads looked like this:

    "model": "qwen3-coder:30b",
    "max_tokens": 32000,
    "top_p": 1,
    "messages": [
        {
            "role": "system",
            "content": "You are opencode, an interactive CLI tool [OTHER SYSTEM MESSAGE PARTS]...\n"
        },
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "I want to plan a unit test for the new ExtractTextFromContent function in pkg/utils/string.go"
                },
                {
                    "type": "text",
                    "text": "<system-reminder>\n# Plan Mode - System Reminder\n\n[OTHER SYSTEM REMINDER PARTS]\n"
                }
            ]
        }
    ],

So it looks like the content property has a couple of possible structures. I also saw some json.Unmarshal errors with regard to parsing tool calls but I haven't run to ground just yet.

I've forked the repo and I have some changes locally that appear to resolve this particular case, so I'm happy to prepare a PR if y'all would like me to.

PS: I enjoyed using tapes to record conversations of working on itself 💯

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions