Skip to content

fix: Preserve OpenAI stream errors and model compatibility - #12

Open
mvanhorn wants to merge 1 commit into
boldsoftware:mainfrom
mvanhorn:fix/1-openai-stream-errors
Open

fix: Preserve OpenAI stream errors and model compatibility#12
mvanhorn wants to merge 1 commit into
boldsoftware:mainfrom
mvanhorn:fix/1-openai-stream-errors

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Aug 5, 2026

Copy link
Copy Markdown

OpenAI-backed runs can terminate with openai stream error :, discarding the provider's actionable error details. Two reporters reproduce the failure on the current release, and one confirmed that direct streaming Responses API calls succeed while meat fails across multiple reasoning models.

The same report identifies a separate deterministic compatibility problem: meat sends reasoning.effort to models that do not support reasoning parameters, which reject the field with HTTP 400.

This change updates meat/openai.go so request construction determines whether the resolved model belongs to a reasoning-capable family, retaining the current default effort and encrypted-reasoning include for those models while omitting reasoning-only fields for the rest. That capability decision stays in the production request path rather than adding a test-only seam, and the existing behavior for meat's default model is preserved.

It also extends the SSE wire representation and decoder to extract provider details from both the event's direct error fields and an embedded error object used by compatible response envelopes, preferring non-empty code/type/message values and returning a descriptive fallback when the event is malformed, instead of emitting a blank error.

The issue is confined to OpenAI request construction and SSE error decoding; Anthropic and the provider-agnostic agent loop are out of scope.

Testing: a reasoning-capable request still serializes the configured/default reasoning effort and reasoning.encrypted_content, and a normal completed stream remains unchanged. Requests to models without reasoning support omit reasoning-only fields entirely while retaining the common Responses API fields, preventing the reported unsupported-parameter response. go build ./... and go test ./meat/... both pass (16 tests).

Fixes #1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

meat: model generate: openai stream error :

1 participant