fix(cli): align stream error handling after output-mode merge
Follow up on #1740/#1741 by typing terminal SSE errors in the SDK, classifying them as server.error in the CLI/MCP, marking Projector done on error frames, attaching session_id to MCP stream failures, and migrating the e2e chat step to the bounded JSON envelope.
This commit is contained in:
@@ -111,6 +111,28 @@ func TestProjector_VerboseDoesNotImplicitlyAddReferences(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestProjector_TerminalErrorMarksDone(t *testing.T) {
|
||||
p := sse.NewProjector(false, false, "kb")
|
||||
_, include := p.Chat(&sdk.StreamResponse{
|
||||
ResponseType: sdk.ResponseTypeAnswer,
|
||||
Content: "partial",
|
||||
})
|
||||
if !include || p.Done() {
|
||||
t.Fatalf("answer frame: include=%v done=%v", include, p.Done())
|
||||
}
|
||||
_, include = p.Chat(&sdk.StreamResponse{
|
||||
ResponseType: sdk.ResponseTypeError,
|
||||
Content: "boom",
|
||||
Done: true,
|
||||
})
|
||||
if include {
|
||||
t.Fatal("default projection should not include terminal error event")
|
||||
}
|
||||
if !p.Done() {
|
||||
t.Fatal("terminal error did not mark projector done")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTextRenderer_StreamsSelectedEvents(t *testing.T) {
|
||||
var out bytes.Buffer
|
||||
r := sse.NewTextRenderer(&out, true)
|
||||
|
||||
Reference in New Issue
Block a user