Skip to content

[Bug]: Empty Responses truncation values are forwarded instead of defaulting to disabled #6486

Description

@Alex-wangyang

Prerequisites

  • I searched existing issues and pull requests for duplicates.
  • I reproduced the behavior on the current dev branch.

Description

Some OpenAI-compatible Responses providers emit truncation: "" in response.created. BifrostResponsesResponse.WithDefaults() currently defaults only a nil value, so the empty string is forwarded unchanged.

Strict Responses clients accept only auto or disabled. Grok Build 1.0.5 rejects the empty value before processing the rest of the stream, even though the upstream response otherwise completes successfully.

Steps to reproduce

  1. Send a streaming Responses request through Bifrost to an OpenAI-compatible provider that emits an empty truncation value.
  2. Inspect the forwarded response.created event.
  3. Observe "truncation":"" instead of a valid enum value.

Minimal schema reproduction:

resp := (&BifrostResponsesResponse{Truncation: schemas.Ptr("")}).WithDefaults()
fmt.Println(*resp.Truncation) // currently prints an empty string

Expected behavior

Missing or empty truncation values are normalized to disabled. Valid values such as auto and disabled are preserved.

Actual behavior

An explicit empty string bypasses the default and is emitted on the wire, causing strict Responses clients to reject the stream.

Affected area(s)

Core (Go)

Version

Reproduced on transports/v1.6.11 and current dev (0ac7f7142).

Environment

Client: Grok Build 1.0.5
API: streaming Responses
Provider shape: OpenAI-compatible Responses

Severity

Medium (some functionality impaired)

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