Skip to content

fix(react): correct useStreaming completion content - #312

Open
Fhatu12 wants to merge 2 commits into
hanzoai:mainfrom
Fhatu12:fix/issue-308-stream-completion
Open

Fhatu12 wants to merge 2 commits into
hanzoai:mainfrom
Fhatu12:fix/issue-308-stream-completion

Conversation

@Fhatu12

@Fhatu12 Fhatu12 commented Nov 11, 2026

Copy link
Copy Markdown

What changed

  • Fix useStreaming so onComplete receives the latest completed assistant response.
  • Handle the actual HanzoProvider stream contract: user messages followed by cumulative assistant snapshots.
  • Prevent user-message inclusion and duplicated snapshot content.
  • Preserve incremental onChunk delivery and stable callback identity.

Why

Previously, onComplete used stale currentMessage state and could return the previous response or an empty value.

The correction also ensures that cumulative assistant snapshots are not treated as independent text deltas.

How it was checked

  • Focused tests: 9/9 PASS
  • React package: 20/20 PASS
  • Typecheck: PASS
  • CJS/ESM/declaration build: PASS
  • Focused formatting: PASS
  • Real-provider mocked-SSE tests: PASS
  • No live API calls used

Changes are limited to useStreaming and its focused regression tests. No dependency, provider, or public API changes.

Closes #308

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T09:27:42.604747Z ac030db PR opened
ℹ️ 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.

This branch has not been deployed

No deployments
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.

useStreaming passes the previous reply to onComplete, not the one just streamed

1 participant