Skip to content

Pollinations free models: tool calls emitted as text break the agent loop (flat envelope dialect, truncation/unknown-tool throws, full buffering) #870

Done

Description

@agenteinstinct1-max

Problem

Some Pollinations backends (observed: community/morriszdweck/glm-5.3-flash-free and community/scriptsnsenses-sys/gpt-6-luna:free, both routed through Poe) return tool calls as text instead of structured tool_calls. The middleware merged in #867 already decoded the nested {"name":"...","arguments":{...}} envelope, but real agent loops still break:

  1. Flat dialect never decoded. In the real agent loop these models emit parameters as top-level keys — {"name":"shell","command":"echo hello-world"} — not nested under arguments. The current decoder only accepts the nested shape, so the call leaks as raw JSON text, the shell never runs, the model hallucinates the command output, and the turn dies after 3 finish-tool nudges.
  2. Truncated think block kills the turn. unterminated reasoning block throw on any token-cap/disconnect truncation.
  3. Hallucinated tool name kills the turn. model requested unavailable tool throw when an envelope names a tool that was not offered.
  4. Everything buffers until stream end. All text replies from Pollinations models appear only when the stream finishes, making the TUI look frozen. Protocol reasoning is also fully buffered.

Repro

opencode run with a Pollinations free model (e.g. glm-5.3-flash-free), prompt run: echo hello-world. Expected: shell executes, clean finish. Actual: raw {"name":"shell","command":"echo hello-world"} JSON visible as assistant text, hallucinated output, turn killed after nudges.

This is the same class of instability previously seen with Qwen Chat tool calls.

Activity

  1. added
    bug
    priority: high
    on Nov 27, 2026
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

    bugpriority: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions