Skip to content

Parse Pollinations reasoning and tool-call output instead of exposing raw protocol text #866

Backlog

Description

@mdev34-lab

Problem

A live run through the Pollinations provider can return the model's internal reasoning and tool-call payload as ordinary assistant text. The agent UI displays the raw <think>...</think> block and serialized JSON objects instead of treating them as reasoning metadata and tool invocations.

Observed with GLM 5.3 Flash (FREE) (community, free) in a Silvercode session on 2026-11-26. The visible assistant output contained:

  • A literal <think> block describing that the user only said “Hello”.
  • A JSON object containing {"name":null,"message":"Hello! How can I help you today?"}.
  • A second literal <think> block describing a call to finish.
  • A serialized {"name":"finish","arguments":{...}} object.

The finish call was printed in the conversation rather than being dispatched as a tool call. The run therefore exposes protocol/control-flow output to the user and risks leaving the agent workflow incomplete.

Expected behavior

  • Parse Pollinations responses into Silvercode's normal assistant-message, reasoning, and tool-call events.
  • Dispatch tool calls through the normal tool execution path; do not render serialized tool-call JSON as user-facing prose.
  • Keep reasoning content out of the ordinary visible message body, following Silvercode's existing reasoning visibility behavior.
  • Handle both streaming and non-streaming responses, including fragmented tool-call arguments.
  • If a model returns an unsupported or malformed response shape, surface a clear provider/protocol error rather than silently presenting internal control data as a successful assistant answer.

Investigation

PR #861 describes Pollinations as an OpenAI-compatible gateway and currently routes chat through @ai-sdk/openai-compatible unchanged. Verify the actual response/stream shape returned by Pollinations for affected models, then determine whether the incompatibility is in the upstream response, the SDK adapter configuration, or Silvercode's event mapping.

Do not assume that every Pollinations model uses the same output format. Add a captured fixture for the observed GLM 5.3 Flash response and regression tests for reasoning, tool calls, and normal text output.

Reproduction

  1. Configure the Pollinations provider and select GLM 5.3 Flash (FREE) (community, free).
  2. Start an agent session with a simple prompt such as Hello..
  3. Observe that reasoning tags and JSON-shaped assistant/tool-call payloads appear verbatim in the conversation instead of being parsed and executed.

Parent context

Discovered immediately after merging the Pollinations provider integration in PR #861. This is a functional protocol-handling issue, separate from the catalog metadata follow-ups in #862 and #863.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions