Skip to content

Bug: OpenAI Responses API rejects assistant messages containing internal reasoning / step-* parts #28839

@ZanzyTHEbar

Description

@ZanzyTHEbar

Description

When using models that route through the OpenAI Responses API (e.g. gpt-5.5 with provider openai), opencode fails with:

ProviderShared.request: OpenAI Responses assistant messages only support text and tool-call content for now

This happens because internal opencode scaffolding parts (reasoning, step-start, step-finish) present in assistant role messages are not being stripped before the request is sent to the Responses endpoint.

Reproduction

Use a model that triggers the Responses path (e.g. openai/gpt-5.5)
Run a long agentic session with many tool calls and internal reasoning steps (common in tech-lead or complex multi-step tasks)

After some time, attempting to continue the session triggers the above error on the next assistant turn.

The session works fine with models that use the traditional Chat Completions path.

Related

Similar message normalization work was done for Anthropic reasoning blocks in PR #23755 (src/provider/transform.ts).

Existing user demand for a Chat Completions fallback: #7793.

Expected behavior

Internal opencode parts (reasoning, step-start, step-finish, etc.) should be filtered out for any provider/API path that only accepts text + tool-call content in assistant messages, with fallback to Chat Completions API if Responses throws an error.

Plugins

dynamic-context-pruning and opencode-rules

OpenCode version

1.15.7

Steps to reproduce

Use a model that triggers the Responses path (e.g. openai/gpt-5.5)
Run a long agentic session with many tool calls and internal reasoning steps (common in tech-lead or complex multi-step tasks)

After some time, attempting to continue the session triggers the above error on the next assistant turn.

The session works fine with models that use the traditional Chat Completions path.

Screenshot and/or share link

No response

Operating System

Linux amd64

Terminal

kitty

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions