fix(chat): emit SSE error and skip complete on prompt setup failures#2102
Open
shaun0927 wants to merge 3 commits into
Open
fix(chat): emit SSE error and skip complete on prompt setup failures#2102shaun0927 wants to merge 3 commits into
shaun0927 wants to merge 3 commits into
Conversation
The /chat handler previously relied on stream-originated error updates and still emitted a terminal complete event when chatter setup failed before any stream updates were sent. This change forwards a server-side error event for those early failures, suppresses complete after errors, and adds regression coverage for an invalid strategy path. Constraint: Keep the fix narrow to the REST SSE path Rejected: Broad chatter API redesign | unnecessary for a targeted contract fix Confidence: high Scope-risk: narrow Reversibility: clean Directive: Preserve the invariant that complete is emitted only for successful prompt runs Tested: go test ./internal/server -v Not-tested: End-to-end browser SSE client behavior outside package tests Related: danielmiessler#2100
ksylvan
requested changes
Apr 17, 2026
| @@ -0,0 +1,17 @@ | |||
| ### PR [#2102](https://github.com/danielmiessler/Fabric/pull/2102) by [shaun0927](https://github.com/shaun0927): fix(chat): emit SSE error and skip complete on prompt setup failures | |||
|
|
|||
Collaborator
There was a problem hiding this comment.
Hi @shaun0927 while I appreciate that you included this snippet, I'll give the same feedback I gave in your other PR:
The changelog snippet ends up in the ChangeLog and on the Release Notes. It needs to be short, concise, but also accurate. It shouldn't contain all the details or be a mini-PRD. Pleaese make this short and brief.
You can also use the --ai-summarize flag of the generate_changelog CLI tool.
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.
Summary
This PR fixes a REST
/chatSSE contract bug where prompt/session setup failures could still end with a finalcompleteevent.Problem
When
chatter.Send()fails before any stream-originated error update is emitted (for example, whenstrategy.LoadStrategy()fails during request assembly), the handler currently:completeevent.That means an SSE client can interpret the request as successful even though no valid response was produced.
Fix
StreamTypeErrorupdate whenchatter.Send()returns an error that was not already surfaced through stream updatescompleteevent whenever an error was emitted for that promptFiles changed
internal/server/chat.gointernal/server/chat_test.goTests
go test ./internal/server -vRelated issues
Closes #2100