Skip to content

chat template: fix stream resumption#121

Open
bbqiu wants to merge 8 commits intodatabricks:mainfrom
bbqiu:bbqiu/chatbot-reasoning-strat-bug
Open

chat template: fix stream resumption#121
bbqiu wants to merge 8 commits intodatabricks:mainfrom
bbqiu:bbqiu/chatbot-reasoning-strat-bug

Conversation

@bbqiu
Copy link
Contributor

@bbqiu bbqiu commented Feb 18, 2026

if resuming a stream from a cursor, and the first chunk back is not a reasoning-start or similar "start" chunk, the client will throw a validation error that will stop streaming in the UI even though nothing is actually wrong

context + manual test: https://databricks.slack.com/archives/C065NC65Q9F/p1771025954749819?thread_ts=1770932241.614159&cid=C065NC65Q9F

bbqiu and others added 8 commits February 17, 2026 17:16
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
Use `delete process.env.API_PROXY` instead of `= undefined` because
Node.js converts undefined assignments to the string "undefined",
causing tests to fail.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
.
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
.
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
.
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
.
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
@bbqiu bbqiu requested a review from fanzeyi February 19, 2026 18:16
// Merge duplicate parts once when resuming a stream
// This runs after the synthetic start event creates a duplicate, keeping the UI clean
useEffect(() => {
if (!resumeStateRef.current.isResuming || resumeStateRef.current.hasMerged) return;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be an O(1) check even though it will run on every change to messages

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

Comments