#2605·rig

Responses streaming can report success after an empty decoded stream

Author: BANG404Created Sep 26, 2026Updated Sep 26, 2026

Summary

The OpenAI Responses streaming path can finish with no assistant text, no tool call, and no error being surfaced to the caller. In this state the stream consumer receives None (or all provider events are skipped during decoding), and the request is treated as a successful completion.

Environment

  • Rig revision used by the consumer: ca7a43f4c50401c0baae8af20d33a75a819260b5
  • Provider: Gitee AI OpenAI-compatible Responses API (https://ai.gitee.com/v1)
  • Model: DeepSeek-V4-Flash
  • API: POST /responses, stream: true
  • Consumer: OpenAgent runtime

Observed behavior

An OpenAgent dev conversation containing only the user prompt 查下今日的科技新闻 ended after about 6.5 seconds with:

status=completed
terminal_event=chat-done

The persisted checkpoint contained the user message but no assistant message. The corresponding task trace had:

json
{"status":"completed","completion":null,"usage":null,"error":null}

No cancellation or transport error was reported.

The same endpoint and model return HTTP 200 and response.output_text.delta events for a minimal request without tools. When a function tool definition is included, the request also returns HTTP 200, but no event that the consumer can use was observed during a 30-second capture. This suggests a provider-specific Responses event shape or a long reasoning/tool prelude, but the consumer must not convert that state into a successful empty completion.

Expected behavior

If a streaming response ends without at least one valid assistant text item, tool call, or explicit provider terminal error, Rig should return a descriptive streaming error. The caller should be able to distinguish:

  • a successful assistant response;
  • an explicit response.failed / response.incomplete response; and
  • an EOF or decode path that produced no usable completion items.

Malformed or unsupported SSE frames should not be silently discarded without diagnostic context.

Suspected root cause

The streaming decoder appears to tolerate/skip events it cannot deserialize. The outer stream consumer then observes end-of-stream without a StreamingError. A caller that only checks stream_error can therefore persist an empty completion as completed.

This is related to the silent event-loss cases reported in #1827 and #1861, but the failure here is the missing terminal error for an entirely empty decoded stream.

Minimal consumer-side guard

The consumer currently has logic equivalent to:

rust
while let Some(item) = stream.next().await {
    // process item
}
// no item and no error can still be treated as success

A regression test should cover an SSE response that contains only unsupported or skipped events, followed by EOF, and assert that the stream returns an error or an explicit incomplete result instead of an empty successful completion.

Related issues

  • #1827 Streaming Responses function-call argument deltas can be silently dropped
  • #1861 OpenAI Responses Output::Unknown discards unrecognized output-item payloads at decode