Skip to content

fix: recover text from completed Responses events#937

Draft
jan-kubica wants to merge 1 commit into
TanStack:mainfrom
jan-kubica:fix/openai-completed-response-text
Draft

fix: recover text from completed Responses events#937
jan-kubica wants to merge 1 commit into
TanStack:mainfrom
jan-kubica:fix/openai-completed-response-text

Conversation

@jan-kubica

Copy link
Copy Markdown
Contributor

Summary

  • recover successful OpenAI Responses text when it is only present on response.completed
  • ignore empty response.content_part.added placeholders so they do not suppress the completion fallback
  • cover the behavior at both the adapter and raw-wire E2E boundaries

Root cause

The Responses adapter treated an empty output_text content-part placeholder as streamed content. Some successful responses then carry the populated text only in response.completed.output, but that terminal payload was not used as a backstop. Non-streaming callers consequently received an empty string for a successful response.

Test plan

  • pnpm --filter @tanstack/openai-base test:lib -- responses-text.test.ts
  • pnpm test:pr
  • pnpm --filter @tanstack/ai-e2e test:e2e -- tests/openai-completed-response-text.spec.ts
  • pnpm --filter @tanstack/ai-e2e test:e2e (345 passed, 1 gated live smoke skipped; 4 unrelated tests passed on retry)

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd953e99-9ded-41c9-975c-f832b645fb34

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant