Skip to content

[Bug] Synthesized Responses text events lose content_index and crash SDK consumers #7401

Closed

Description

@Afloat16

Description

Several Responses SSE producers drop the content-part address while retaining the item address. The official OpenAI Node SDK uses output.content[event.content_index]; the resulting undefined index makes finalResponse() reject with missing content at index undefined.

The affected paths share the same missing metadata:

  • The proxy adapter's synthesized text and ACP marker lifecycles omit content_index from all four text/content-part events.
  • The existing opt-in legacy stream-error completion does the same.
  • Proxy and plugin text filters preserve the source item/output indices but lose the source content index when flushing a buffered tail, including the plugin retry path.

This also affects ordinary successful text. A valid answer ending in Length: 10 m temporarily buffers the final m; the freshly constructed tail delta has no content index and the SDK rejects the response.

Reproduction

On the tested master, pass a valid Responses stream through createResponsesAdapter().parseStream() or pipePluginResponsesWithStrip(). The fixture has the normal response/item/content-part lifecycle and an indexed text delta containing Length: 10 m. Consume the resulting bytes through the actual OpenAI.responses.stream().finalResponse() client. Both modes throw the error above for content index 0 and 1.

The prepared regression also invokes the real emitText(), emitMarker(), legacy emitStreamError(), and plugin empty-turn retry producers. It uses the existing development dependency's official OpenAI SDK 6.26.0, with a synthetic Fetch transport and no external model calls.

Expected: synthesized single-part messages identify content part 0; flushed text retains the valid source part index, so the consumer receives the text and completes normally.

SDK source: OpenAI ResponseStream v6.26.0.

bili version

0.1.216, tested master 1e357bf2d6632bfbd2a74ffb70ecee1af1ec7cc3.

Usage mode

Both proxy mode and plugin mode. Cross-client Responses SSE code.

Client and version

Official OpenAI Node SDK 6.26.0; Node.js 24.22.3.

Operating system

Linux x86_64.

Upstream and model

Synthetic valid Responses SSE; no external provider or model is needed for this reproduction.

Configuration

The text/marker and tail-flush defects occur on the normal paths. The error-completion reproduction additionally selects the existing compat.streamErrorShape="completion" option.

Validation and related work

Restoring all three production files to the unchanged master produces 10 failing regressions and 10 passing controls. The fix passes 193/193 targeted tests, including nine actual SDK-consumption cases and the existing adapter, tag-filter, plugin retry and wire-contract suites. Typecheck, build, unused-export, test-import-graph and whitespace checks pass.

The fix records WC-026 and checks the matching fake's emitted frames. The Codex preflight finds the CLI and built artifact, but the local upstream at port 8199 is unavailable; the live four-phase run has not been performed. Full regression remains the remote CI lanes on the PR head.

All-author/all-state searches for content_index, legacy Responses errors, and missing-content errors found no equivalent fix. The latest 100 open PRs and exact head lookup were also checked. Related #2691 covers the Anthropic lifecycle; #1464 established the native error policy; #5057 adds a separate preflight failure body.

Triage

Priority: p1 (Responses consumer failure). Scope: scope/wiring. Topic: N (server miscellaneous). Cross-client code; no single host-lane label.

Prepared branch: Afloat16/billion-context@2026-11-20_preserve-responses-content-indices.

Activity

  1. Afloat16 commented on Nov 20, 2026

    @Afloat16
    ContributorAuthor

    (ai: OpenAI/GPT-6 Astra Pro)

    The fix is in PR #7402: #7402 . Synthesized single-part Responses messages now carry content_index=0, and proxy/plugin tail flushes retain their source part index, including plugin retries. The actual OpenAI SDK consumes the resulting streams successfully.

    The unchanged base fails ten regressions with ten controls passing; the fix passes all 193 targeted tests plus typecheck/build and static gates. The local Codex upstream is unavailable, so live-provider coverage and the full regression verdict remain with the PR's CI/review.

    Triage: bug, p1, scope/wiring; Topic N. Cross-client code; no single host-lane label applies.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions