Repository navigation
fix(chat): follow suspended replies after a prompt is answered - #6217
Open
wang-leigang wants to merge 2 commits into
Open
wang-leigang wants to merge 2 commits into
wang-leigang wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Answering a suspended agent prompt can return
resumed: truewhile the original chat stream is still open. Platform chat and the visitor widget could discard that acknowledgement and stay on the answered card. The widget also had no signed continuation endpoint to deliver the next question while the agent was still waiting for an answer.Both views now finish reading the original stream and attach to the same assistant message with the answered prompt’s
resume_pending_id. The widget sends its channel token and signed session handle to the new embed route, which applies the existing visitor session checks before delegating to the continuation handler. A hot answer (resumed: false) keeps its current stream.A disconnected or stalled stream can recover from the saved assistant row. If SSE remains unavailable, the widget can display a new actionable question and keep following a long-running reply through signed history. A final reply delivered through either path notifies the host page and webhook once per displayed turn. When a failed buffer reset leaves multiple segments together, a scoped replay starts at the matching segment and keeps the original store cursor for new events.
Type of Change
Related Issue
Reproduced on
a33076802while testing the suspendedask_userflow.Testing
In a real Chrome iframe, submit Shanghai while the original SSE is still open. After the answer POST acknowledges the resume, finish the old SSE, then have the resumed agent ask for a SKU before suspending again.
message_receivedand the browser submitted one webhook relay in both browser scenarios.Chrome used the actual Vue pages and a controlled HTTP fixture to exercise the response order. The Go route tests exercised the backend independently.
npm run type-checkand the Vite production build passed.make testpassed with the project’s uv-managed Python 3.13 on PATH. The signed-route and resumed-segment tests also passed undergo test -race. Diff-scoped golangci-lint reported zero issues.Checklist
git diff --check origin/main...HEADpassesScreenshots / Recordings
Before. The user has answered, and the conversation stays on the card.
After. The same interaction displays the warehouse stock count.
Visitor widget. The resumed stream displays the next question while it can still be answered live.