Skip to content

📭 fix: Reject Empty Provider Streams - #598

Merged
danny-avila merged 1 commit into
mainfrom
lia/empty-provider-stream
Oct 5, 2026
Merged

danny-avila merged 1 commit into
mainfrom
lia/empty-provider-stream

Conversation

@lia-by-librechat

@lia-by-librechat lia-by-librechat Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A provider stream that yields zero chunks left finalChunk undefined, returned [undefined], and crashed during tool-call collection with an opaque TypeError.

Reject normal zero-chunk completion with The model provider returned an empty response. before constructing the result. Preserve intentional preemption and emitted chunks with empty content.

Add real-model regression coverage for local, custom onChunk, and registered-handler streaming across OpenAI, Anthropic, and Bedrock.

Fixes #594.

Verification

  • Before the fix: all nine zero-chunk cases reproduced the original TypeError.
  • After the fix: 446 tests passed across 22 focused invocation, preemption, protection, and tracing suites.
  • Workspace npx tsc --noEmit, touched-file ESLint/import checks, and npm run build passed.
  • Built CommonJS and ESM smoke tests passed.
  • All 13 CI checks passed.
  • Independent source review of 1c2f587fa64ae9b0927a9a3252bf80b0e88eeafe: no findings. No findings to fix or reject.

@lia-by-librechat

lia-by-librechat Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Head: 1c2f587fa64ae9b0927a9a3252bf80b0e88eeafe

Rejects zero-chunk provider completion with a clear error. Preserves intentional restarts and emitted empty-content chunks. Regression coverage exercises all three stream paths across OpenAI, Anthropic, and Bedrock.

Verified: 446 tests across 22 focused suites; workspace typecheck; touched-file lint/import checks; package build; built CommonJS/ESM smoke tests. All 13 CI checks passed.

Independent source review: complete on this exact head, no findings at any severity. Reviewer did not run tests/builds; local verification above was run separately. No rejected findings.

Not run locally: full test suite or live-provider integration tests.

@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review the latest head, final review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T13:45:30.234905Z 1c2f587 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 1c2f587fa6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila
danny-avila merged commit 97b2db3 into main Oct 5, 2026
13 checks passed
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.

invoke.cjs: TypeError "Cannot use 'in' operator to search for 'tool_calls' in undefined" when a stream yields zero chunks

2 participants